databricks Data Engineer Associate · Practice questions

Section 6: Troubleshooting, Monitoring, and Optimization Practice Questions

Review 10 sample questions with their correct answers and explanations. Sign up free to continue with the full topic quiz.

Sign up free for the full quiz

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?

  1. The cluster is using Photon
  2. The job's schedule is paused
  3. A conflict with the runtime's bundled library version — Correct
  4. 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?

  1. Call coalesce(1) before the transformation
  2. Increase the number of retries on the job task
  3. Disable Adaptive Query Execution
  4. 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?

  1. Wide ones like join and groupBy shuffle; narrow ones like filter do not — Correct
  2. Both always require a shuffle
  3. Only actions can be wide
  4. 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?

  1. The Delta table history
  2. The Unity Catalog lineage graph
  3. The init script logs — Correct
  4. 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?

  1. On the driver, which receives all collected rows — Correct
  2. On each executor, because collect() caches partitions in executor memory
  3. In the Delta transaction log
  4. 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?

  1. The executors need more memory
  2. The table is skewed
  3. Shuffle partitions are too few
  4. 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?

  1. It sets the number of SQL warehouse clusters
  2. It sets default partitions for RDD operations — Correct
  3. It sets the broadcast join threshold
  4. 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?

  1. Driver memory usage
  2. Input size read from cloud storage per stage and per executor
  3. Shuffle read and shuffle write sizes — Correct
  4. 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?

  1. The cluster is using too little disk
  2. The driver has too many cores
  3. Memory pressure on the executors — Correct
  4. 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?

  1. It makes subsequent reads of the source table faster for all users
  2. It is lazy; data is cached on the first action — Correct
  3. It persists the DataFrame across cluster restarts
  4. 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.

Ready for the full quiz?

Create a free QuizAnalyst account to practice the complete question set and save your progress.

Sign up free for the full quiz