Question 1
How does a broadcast join work?
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.
databricks Associate Developer for Apache Spark · 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 quizHow does a broadcast join work?
The small table goes to every executor, so the large side is not shuffled
Broadcast hash joins avoid shuffling the large side, which is efficient when one side is small.
Which component of a Spark application converts user code into a DAG of stages and schedules tasks on executors?
The driver
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.
In Spark's execution hierarchy, what triggers the creation of a new job?
An action, such as count() or write()
Each action triggers one or more jobs. Jobs are split into stages at shuffle boundaries, and stages into tasks, one per partition.
Which statement about Spark's fault tolerance for DataFrames is correct?
Lost partitions are recomputed from lineage
Spark tracks lineage and recomputes lost partitions; failed tasks are retried.
Which statement about the following code is correct? df.filter(col('amount') > 100).select('id').filter(col('amount') < 500)
It fails: amount is gone after select('id')
After select('id'), the DataFrame only has the id column, so referencing amount raises an AnalysisException.
Which is a common challenge when using Spark?
Tuning for skew, shuffles and small files
Spark workloads often need tuning for skew, shuffle volume, partitioning and file sizes.
Given: df = spark.range(10) print(df.rdd.getNumPartitions()) Which factor determines the printed value by default?
The cluster's default parallelism
spark.range without a numPartitions argument uses the default parallelism.
In client deployment mode, where does the driver run?
On the machine that submits the application
In client mode the driver runs where the application is launched; in cluster mode it runs on a node inside the cluster.
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?
Only when an action runs on result
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).
Which statement about the Catalyst optimizer is correct?
It optimizes logical plans with rules, then picks a physical plan
Catalyst analyzes, optimizes and plans DataFrame and SQL queries on the driver; Tungsten handles efficient execution.
Create a free QuizAnalyst account to practice the complete question set and save your progress.
Sign up free for the full quiz