databricks Associate Developer for Apache Spark · Practice questions

Section 1: Apache Spark Architecture and Components 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

How does a broadcast join work?

  1. The larger table is copied to the driver and joined there
  2. The join is executed in the database through JDBC
  3. The small table goes to every executor, so the large side is not shuffled — Correct
  4. Both tables are shuffled by the join key and then sorted

Correct answer

The small table goes to every executor, so the large side is not shuffled

Explanation

Broadcast hash joins avoid shuffling the large side, which is efficient when one side is small.

Question 2

Which component of a Spark application converts user code into a DAG of stages and schedules tasks on executors?

  1. The cluster manager
  2. Each executor's block manager
  3. The worker node's operating system
  4. The driver — Correct

Correct answer

The driver

Explanation

The driver runs the application's main program, creates the SparkSession, builds the logical and physical plans, and schedules tasks on executors. The cluster manager only allocates resources.

Question 3

In Spark's execution hierarchy, what triggers the creation of a new job?

  1. A narrow transformation, such as filter()
  2. Each partition of the input data
  3. Each column referenced in a select()
  4. An action, such as count() or write() — Correct

Correct answer

An action, such as count() or write()

Explanation

Each action triggers one or more jobs. Jobs are split into stages at shuffle boundaries, and stages into tasks, one per partition.

Question 4

Which statement about Spark's fault tolerance for DataFrames is correct?

  1. Lost partitions are recomputed from lineage — Correct
  2. Failed tasks always fail the whole application
  3. Every partition is replicated three times in memory by default
  4. The driver keeps a full copy of the data

Correct answer

Lost partitions are recomputed from lineage

Explanation

Spark tracks lineage and recomputes lost partitions; failed tasks are retried.

Question 5

Which statement about the following code is correct? df.filter(col('amount') > 100).select('id').filter(col('amount') < 500)

  1. Catalyst reorders it so it succeeds
  2. It returns ids with amount between 100 and 500
  3. It returns all ids
  4. It fails: amount is gone after select('id') — Correct

Correct answer

It fails: amount is gone after select('id')

Explanation

After select('id'), the DataFrame only has the id column, so referencing amount raises an AnalysisException.

Question 6

Which is a common challenge when using Spark?

  1. It cannot run on cloud object storage
  2. No support for SQL queries
  3. Inability to read Parquet files
  4. Tuning for skew, shuffles and small files — Correct

Correct answer

Tuning for skew, shuffles and small files

Explanation

Spark workloads often need tuning for skew, shuffle volume, partitioning and file sizes.

Question 7

Given: df = spark.range(10) print(df.rdd.getNumPartitions()) Which factor determines the printed value by default?

  1. Always 1
  2. The cluster's default parallelism — Correct
  3. spark.sql.shuffle.partitions
  4. The number of rows divided by 10

Correct answer

The cluster's default parallelism

Explanation

spark.range without a numPartitions argument uses the default parallelism.

Question 8

In client deployment mode, where does the driver run?

  1. On the machine that submits the application — Correct
  2. On the storage system
  3. In the same JVM as every executor
  4. On a worker node selected by the cluster manager

Correct answer

On the machine that submits the application

Explanation

In client mode the driver runs where the application is launched; in cluster mode it runs on a node inside the cluster.

Question 9

Consider the code: df = spark.read.parquet('/data/events') filtered = df.filter(df.status == 'ok') result = filtered.select('id', 'ts') At which point does Spark read the data?

  1. When filter() is executed
  2. When select() is executed
  3. When spark.read.parquet() is executed
  4. Only when an action runs on result — Correct

Correct answer

Only when an action runs on result

Explanation

Transformations are lazy and only build a plan. Data is read when an action runs (reading the Parquet footer for the schema is metadata only).

Question 10

Which statement about the Catalyst optimizer is correct?

  1. It runs on executors after each task
  2. It optimizes logical plans with rules, then picks a physical plan — Correct
  3. It compiles Python UDFs into JVM bytecode
  4. It only optimizes RDD code

Correct answer

It optimizes logical plans with rules, then picks a physical plan

Explanation

Catalyst analyzes, optimizes and plans DataFrame and SQL queries on the driver; Tungsten handles efficient execution.

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