databricks Associate Developer for Apache Spark · Practice questions

Section 4: Troubleshooting and Tuning Apache Spark DataFrame API Applications 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

Which statement about predicate pushdown with Parquet is correct?

  1. The reader skips row groups using Parquet statistics — Correct
  2. Pushdown disables column pruning
  3. Parquet files must be fully loaded before filtering
  4. Pushdown only works for CSV files

Correct answer

The reader skips row groups using Parquet statistics

Explanation

Parquet stores min and max statistics per row group, allowing the reader to skip row groups that cannot match.

Question 2

A query filters a partitioned Parquet dataset with WHERE year = 2026. Which optimization reduces the data read?

  1. Caching the whole dataset first
  2. Speculative execution
  3. Partition pruning — Correct
  4. Broadcast join

Correct answer

Partition pruning

Explanation

Filters on partition columns let Spark skip directories that cannot contain matching rows.

Question 3

How can a developer change the log level of the driver to WARN to reduce output in a notebook?

  1. spark.stop(log='WARN')
  2. df.explain('WARN')
  3. spark.sparkContext.setLogLevel('WARN') — Correct
  4. spark.conf.set('log', 'WARN')

Correct answer

spark.sparkContext.setLogLevel('WARN')

Explanation

setLogLevel changes the root log level at runtime; log4j configuration files can also be customized.

Question 4

A stage spills heavily to disk during a sort. Which change is reasonable?

  1. Replace the sort with collect()
  2. Reduce executor memory
  3. Coalesce to 1 partition before the sort
  4. More shuffle partitions — Correct

Correct answer

More shuffle partitions

Explanation

Spill happens when a task's data exceeds memory; smaller partitions reduce per-task memory needs.

Question 5

A team wants Spark logs delivered to a storage location so they can be analyzed after the cluster terminates. What should be configured?

  1. A broadcast variable for the logs
  2. spark.sql.shuffle.partitions
  3. Caching the logs in memory
  4. Cluster log delivery — Correct

Correct answer

Cluster log delivery

Explanation

Cluster log delivery copies driver and executor logs to a configured location.

Question 6

Which configuration enables Adaptive Query Execution?

  1. spark.sql.adaptive.enabled — Correct
  2. spark.speculation
  3. spark.sql.cbo.enabled
  4. spark.dynamicAllocation.enabled

Correct answer

spark.sql.adaptive.enabled

Explanation

spark.sql.adaptive.enabled turns on AQE (it is on by default in recent Spark versions).

Question 7

Which statement about dynamic partition pruning is correct?

  1. It skips fact partitions using runtime filters from the dimension side — Correct
  2. It removes empty shuffle partitions
  3. It prunes columns not used in the query
  4. It deletes old partitions from storage

Correct answer

It skips fact partitions using runtime filters from the dimension side

Explanation

Dynamic partition pruning uses the join's dimension-side filter to prune partitions of the partitioned fact table.

Question 8

Which code forces a broadcast hash join of a large DataFrame big with a small DataFrame small?

  1. big.join(broadcast(small), 'key') — Correct
  2. broadcast(big).join(small, 'key')
  3. big.join(small.cache(), 'key')
  4. big.join(small, 'key').hint('shuffle')

Correct answer

big.join(broadcast(small), 'key')

Explanation

broadcast() marks the small side to be broadcast. Broadcasting the large side would be inefficient.

Question 9

A job's stage shows 1 task that takes 30 minutes while 199 tasks finish in 20 seconds. Which concept best explains this?

  1. Lazy evaluation of the transformations
  2. Caching with MEMORY_AND_DISK
  3. Too many executor cores
  4. Data skew in that task's partition — Correct

Correct answer

Data skew in that task's partition

Explanation

A straggler task with much more data than others indicates skew, often from a hot key in a join or aggregation.

Question 10

Which statement about spark.sql.autoBroadcastJoinThreshold is correct?

  1. Smaller tables are broadcast automatically; -1 disables it — Correct
  2. It controls the size of each shuffle partition
  3. It sets the maximum number of broadcast variables
  4. It is the memory reserved for caching

Correct answer

Smaller tables are broadcast automatically; -1 disables it

Explanation

The threshold (10 MB by default) governs automatic broadcast joins; -1 disables them.

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