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. Returns an RDD containing elements from both inputs
Explanation:
Union concatenates the distributed collections logically.
Duplicates are retained unless distinct is applied.
Choose an option to check your answer.
Correct Answer: D. Removes duplicate elements from an RDD
Explanation:
Spark must group equal elements to determine uniqueness.
Therefore distinct commonly requires a shuffle.
Choose an option to check your answer.
Correct Answer: C. Retains records for which a predicate returns true
Explanation:
filter is a narrow transformation.
It preserves only records satisfying the condition.
Choose an option to check your answer.
Correct Answer: B. Produces zero or more output elements per input and flattens them
Explanation:
flatMap is useful for expanding records, such as splitting lines into words.
Empty outputs can also remove records.
Choose an option to check your answer.
Correct Answer: A. Produces one output element for each input element
Explanation:
map applies a supplied function independently to every record.
The result is a new RDD.
Choose an option to check your answer.
Correct Answer: D. They require network transfer, serialization, sorting, and often disk I/O
Explanation:
Shuffle data must be exchanged between executors.
This creates more failure points and resource pressure than narrow operations.
Choose an option to check your answer.
Correct Answer: C. Redistributing data across partitions and executors
Explanation:
Shuffles occur for operations requiring new key grouping or partitioning.
They involve network, disk, serialization, and sorting costs.
Choose an option to check your answer.
Correct Answer: B. A child partition depends on data from many parent partitions
Explanation:
groupByKey and repartition create wide dependencies.
They require data exchange across the cluster.
Choose an option to check your answer.
Correct Answer: A. Each child partition depends on a small number of parent partitions
Explanation:
Operations such as map and filter are usually narrow.
They can often be pipelined without shuffling data.
Choose an option to check your answer.
Correct Answer: D. A unit of work that processes one partition within a stage
Explanation:
The scheduler launches tasks on executors.
Parallelism within a stage is largely determined by partition count.
Choose an option to check your answer.
Correct Answer: C. A set of tasks that can run without crossing a shuffle boundary
Explanation:
Wide dependencies divide a job into stages.
Within a stage, narrow transformations can be pipelined.
Choose an option to check your answer.
Correct Answer: B. The computation triggered by an action
Explanation:
An action submits a job to the scheduler.
A Spark application can run many jobs.