Practice Library
All MCQs
Browse exam-wise, subject-wise, and country-wise MCQs with explanations.
Choose an option to check your answer.
A.
Checkpointing cuts lineage and uses reliable storage, while caching keeps lineage for recomputation
B.
Caching is always durable across application restarts
C.
Checkpointing never writes data
D.
They are identical operations
Show Answer
Correct Answer: A. Checkpointing cuts lineage and uses reliable storage, while caching keeps lineage for recomputation
Explanation:
Cached blocks may be lost and rebuilt from lineage.
Checkpoint data becomes a new reliable starting point.
Choose an option to check your answer.
A.
Caching it only in executor memory
B.
Collecting it to the driver
C.
Changing its partition key
D.
Saving it to reliable storage and truncating its lineage
Show Answer
Correct Answer: D. Saving it to reliable storage and truncating its lineage
Explanation:
Checkpointing helps when lineage becomes long or cyclic algorithms run many iterations.
It requires materialization to durable storage.
Choose an option to check your answer.
A.
Deletes source data
B.
Stops the SparkContext
C.
Removes cached RDD blocks from executor storage
D.
Removes all lineage
Show Answer
Correct Answer: C. Removes cached RDD blocks from executor storage
Explanation:
Unpersist frees memory or disk occupied by cached partitions.
It should be used when reuse is complete.
Choose an option to check your answer.
A.
When an RDD is used once and cheap to compute
B.
When the same expensive dataset is reused by multiple actions
C.
When executor memory is already exhausted
D.
When the source data are tiny and local
Show Answer
Correct Answer: B. When the same expensive dataset is reused by multiple actions
Explanation:
Caching trades storage for reduced recomputation.
It is valuable in iterative algorithms and interactive analysis.
Choose an option to check your answer.
A.
Persists an RDD using the default storage level
B.
Saves a final file to HDFS
C.
Deletes the RDD lineage
D.
Broadcasts the RDD
Show Answer
Correct Answer: A. Persists an RDD using the default storage level
Explanation:
cache is shorthand for a default persist choice.
Actual materialization occurs when an action evaluates the RDD.
Choose an option to check your answer.
A.
Writes the RDD permanently to the source system
B.
Changes the RDD's lineage
C.
Collects all elements to the driver
D.
Keeps an RDD using a selected storage level for reuse
Show Answer
Correct Answer: D. Keeps an RDD using a selected storage level for reuse
Explanation:
Persistence avoids recomputing reused RDDs across actions.
Storage levels can use memory, disk, or serialized forms.
Choose an option to check your answer.
A.
Accumulators cannot contain numbers
B.
Executors cannot access them
C.
Task retries or speculation can cause update behavior that is unsuitable for exact logic
D.
They always reset after each record
Show Answer
Correct Answer: C. Task retries or speculation can cause update behavior that is unsuitable for exact logic
Explanation:
Accumulators are best for observation rather than dataflow decisions.
The RDD result itself should encode required computation.
Choose an option to check your answer.
A.
A mutable value executors can reliably read and update for program logic
B.
A variable executors can add to for aggregated metrics
C.
A cached RDD partition
D.
A SQL table
Show Answer
Correct Answer: B. A variable executors can add to for aggregated metrics
Explanation:
Accumulators are useful for counters and diagnostics.
Their updates should not determine core computation because task retries can complicate semantics.
Choose an option to check your answer.
A.
When one side of the join is small enough to distribute to all executors
B.
When both sides are extremely large
C.
When no join key exists
D.
When all data must be globally sorted
Show Answer
Correct Answer: A. When one side of the join is small enough to distribute to all executors
Explanation:
Broadcasting the small relation avoids shuffling the large relation.
Executor memory must still be sufficient.
Choose an option to check your answer.
A.
A mutable shared counter
B.
An RDD stored only on the driver
C.
A YARN container request
D.
A read-only value efficiently distributed to executors
Show Answer
Correct Answer: D. A read-only value efficiently distributed to executors
Explanation:
Broadcast variables avoid sending the same large reference object with every task.
Executors cache one local copy per application.
Choose an option to check your answer.
A.
Concatenates records regardless of key
B.
Removes all duplicate keys
C.
Combines values having the same key
D.
Computes a Cartesian product only
Show Answer
Correct Answer: C. Combines values having the same key
Explanation:
A standard join returns each key with pairs of matching values.
It usually requires compatible partitioning or a shuffle.
Choose an option to check your answer.
A.
An RDD containing the values
B.
An RDD containing the keys
C.
A map stored on the driver
D.
A sorted set only
Show Answer
Correct Answer: B. An RDD containing the keys
Explanation:
The pair structure is projected onto its first component.
The result remains distributed.