Question 1
A job fails after a new library was added: a NoSuchMethodError appears for a package that is also part of the Databricks Runtime. What is the most likely cause?
- The cluster is using Photon
- The job's schedule is paused
- A conflict with the runtime's bundled library version — Correct
- The Delta table is missing statistics
Correct answer
A conflict with the runtime's bundled library version
Explanation
Installing a different version of a library already bundled with the runtime can cause method or class mismatches. Align versions or choose a compatible runtime.
Question 2
An executor fails repeatedly with OutOfMemoryError while processing a few very large partitions read from JSON files. Which change is most likely to help?
- Call coalesce(1) before the transformation
- Increase the number of retries on the job task
- Disable Adaptive Query Execution
- Repartition into more, smaller partitions — Correct
Correct answer
Repartition into more, smaller partitions
Explanation
Very large partitions can exceed executor memory. Repartitioning into more partitions spreads the work. coalesce(1) makes it worse.
Question 3
Which statement about narrow and wide transformations is correct?
- Wide ones like join and groupBy shuffle; narrow ones like filter do not — Correct
- Both always require a shuffle
- Only actions can be wide
- Narrow transformations require a shuffle; wide ones do not
Correct answer
Wide ones like join and groupBy shuffle; narrow ones like filter do not
Explanation
Wide transformations depend on data from multiple partitions and trigger shuffles, creating stage boundaries.
Question 4
A job that ran fine yesterday now fails at cluster start with an error from an init script. What should the engineer check first?
- The Delta table history
- The Unity Catalog lineage graph
- The init script logs — Correct
- The job's notification settings
Correct answer
The init script logs
Explanation
Init script failures prevent cluster startup; their logs show which command failed, often a network or package issue.
Question 5
A notebook calls df.collect() on a 40 GB DataFrame, and the job fails with an out-of-memory error. Where is the memory problem occurring?
- On the driver, which receives all collected rows — Correct
- On each executor, because collect() caches partitions in executor memory
- In the Delta transaction log
- In the SQL warehouse result cache
Correct answer
On the driver, which receives all collected rows
Explanation
collect() brings every row back to the driver. For large data, write results to a table or use limit()/take() instead.
Question 6
The Spark UI shows that the driver spends most of its time while executors are idle, during a loop that calls df.count() on many small DataFrames. What is the problem?
- The executors need more memory
- The table is skewed
- Shuffle partitions are too few
- It is driver-bound; use fewer, larger Spark jobs — Correct
Correct answer
It is driver-bound; use fewer, larger Spark jobs
Explanation
Many small actions in a driver loop underutilize executors. Restructuring work into fewer, larger operations improves throughput.
Question 7
When is spark.default.parallelism relevant?
- It sets the number of SQL warehouse clusters
- It sets default partitions for RDD operations — Correct
- It sets the broadcast join threshold
- It sets the number of partitions for DataFrame and SQL shuffles
Correct answer
It sets default partitions for RDD operations
Explanation
default.parallelism applies to RDD operations; DataFrame and SQL shuffles use spark.sql.shuffle.partitions.
Question 8
Which Spark UI metric indicates how much data was moved between executors during a wide transformation?
- Driver memory usage
- Input size read from cloud storage per stage and per executor
- Shuffle read and shuffle write sizes — Correct
- Number of jobs in the application
Correct answer
Shuffle read and shuffle write sizes
Explanation
Shuffle write (map side) and shuffle read (reduce side) show data exchanged across the network for joins and aggregations.
Question 9
Which executor memory issue is indicated by frequent long garbage collection pauses in the Spark UI?
- The cluster is using too little disk
- The driver has too many cores
- Memory pressure on the executors — Correct
- The Delta table has too few versions
Correct answer
Memory pressure on the executors
Explanation
High GC time indicates memory pressure. Reducing data per task, avoiding unnecessary caching or adding memory helps.
Question 10
Which statement about caching a DataFrame with df.cache() is correct?
- It makes subsequent reads of the source table faster for all users
- It is lazy; data is cached on the first action — Correct
- It persists the DataFrame across cluster restarts
- It immediately writes the DataFrame to a Delta table
Correct answer
It is lazy; data is cached on the first action
Explanation
cache() marks the DataFrame for caching in executor memory or disk; it materializes on the first action and is lost when the cluster restarts.