Practice Library
All MCQs
Browse exam-wise, subject-wise, and country-wise MCQs with explanations.
Choose an option to check your answer.
Correct Answer: A. Retains rows satisfying a Boolean condition
Explanation:
Filtering reduces the row set.
Spark may push supported predicates down to the data source.
Choose an option to check your answer.
Correct Answer: D. Projects specified columns or expressions
Explanation:
Projection chooses and computes output columns.
It is analogous to the SELECT list in SQL.
Choose an option to check your answer.
Correct Answer: C. A session-scoped table-like name associated with a DataFrame
Explanation:
Temporary views allow SQL queries over DataFrame data.
They normally disappear when the Spark session ends.
Choose an option to check your answer.
Correct Answer: B. It avoids an inference pass and prevents incorrect type guesses
Explanation:
Inference may scan data and misinterpret unusual values.
An explicit schema gives predictable types and lower startup cost.
Choose an option to check your answer.
Correct Answer: A. Automatically determining column types from input data
Explanation:
Spark can inspect data or file metadata to infer a schema.
Explicit schemas are often faster and more reliable for production.
Choose an option to check your answer.
Correct Answer: D. A definition of column names, data types, and nullability
Explanation:
The schema gives structure to each row.
Spark uses it for validation, planning, and optimized execution.
Choose an option to check your answer.
Correct Answer: C. A Dataset can provide compile-time type information for its records
Explanation:
Typed Datasets use encoders and Scala types.
A DataFrame is conceptually a Dataset of generic Row objects.
Choose an option to check your answer.
Correct Answer: B. A distributed collection of rows organized into named columns
Explanation:
A DataFrame has a schema describing column names and data types.
Its structured representation enables query optimization.
Choose an option to check your answer.
Correct Answer: A. High task scheduling overhead
Explanation:
Each task has launch and coordination costs.
Very small partitions spend disproportionate time on overhead.
Choose an option to check your answer.
Correct Answer: D. Insufficient parallelism and oversized tasks
Explanation:
A small number of partitions limits concurrent work.
Large partitions can also create memory pressure and stragglers.
Choose an option to check your answer.
Correct Answer: C. Reduces the number of partitions with less data movement than a full repartition
Explanation:
Coalesce often merges existing partitions without a full shuffle.
A shuffle option may be used when balance is important.
Choose an option to check your answer.
Correct Answer: B. Redistributes data to a specified number of partitions using a full shuffle
Explanation:
Repartition can increase or decrease partition count and rebalance data.
Its shuffle makes it relatively expensive.