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. Transforms values while preserving keys and partitioning
Explanation:
mapValues applies a function only to each value.
Preserving partitioning can avoid unnecessary shuffles in later operations.
Choose an option to check your answer.
Correct Answer: D. A customizable framework for creating and merging per-key combiners
Explanation:
combineByKey underlies many pair-RDD aggregations.
It separates creation, within-partition merging, and cross-partition merging.
Choose an option to check your answer.
Correct Answer: C. Each key paired with all of its values
Explanation:
groupByKey gathers values across partitions.
It can use substantial network and memory when groups are large.
Choose an option to check your answer.
Correct Answer: B. It performs map-side aggregation before the shuffle
Explanation:
reduceByKey combines values locally within each mapper partition.
This substantially reduces shuffle volume for aggregations.
Choose an option to check your answer.
Correct Answer: A. Different types for input elements and the final accumulator
Explanation:
aggregate uses one function within partitions and another across partition results.
Its zero value can have a different type from RDD elements.
Choose an option to check your answer.
Correct Answer: D. fold supplies a neutral initial value used within partitions and across results
Explanation:
The zero value must behave as an identity for correct parallel folding.
It may be applied more than once in a distributed computation.
Choose an option to check your answer.
Correct Answer: C. Aggregates elements using an associative binary function
Explanation:
Partial results are combined across partitions.
Associativity is required because execution order can vary.
Choose an option to check your answer.
Correct Answer: B. Returns the number of elements in an RDD
Explanation:
count triggers distributed evaluation of the required partitions.
Partial counts are aggregated into one driver result.
Choose an option to check your answer.
Correct Answer: A. It returns only a limited number of elements to the driver
Explanation:
take limits driver-side data volume.
It is useful for checking records without retrieving the whole RDD.
Choose an option to check your answer.
Correct Answer: D. Returns all RDD elements to the driver
Explanation:
collect is safe only when the complete result fits in driver memory.
Large results can crash or overload the driver.
Choose an option to check your answer.
Correct Answer: C. Returns elements of one RDD that are not present in another
Explanation:
subtract performs a set-difference-style operation.
Duplicates and partitioning behavior depend on the API implementation.
Choose an option to check your answer.
Correct Answer: B. Returns elements present in both RDDs
Explanation:
Intersection identifies common elements.
It normally requires data exchange to compare values across partitions.