Spark skill check
Test your Spark: lazy evaluation, partitioning, joins and shuffles, caching, Spark SQL, and tuning. Answers assume Spark 3.5 with PySpark.
15
Questions
11 min
Timer can't pause
Multiple choice
Spark 3.5 (PySpark)
Choose a level
Topics
- RDDs and DataFrames
- Transformations and actions
- Partitioning
- Joins and shuffles
- Caching
- Spark SQL
- Structured Streaming
- Tuning
Do
Use scratch paper or a notepad to work things out. Skip a question and come back to it later.
Don't
Look up answers during the check. Open the check in more than one tab or window.
Easy · 15 questions · 11 min
By starting, you agree to the Terms and Privacy Policy.
Practice checks each answer as you go, with an explanation. The exam is checked when you submit; 9 of 15 passes and earns a certificate.
Checking your levels…
Certificates come from the certified exam: pass with 9 of 15 while signed in. View a sample certificate.
Sample Spark questions with answers
These are never used in a check, so seeing their answers here won't give anything away.
Question 1 · Easy · Transformations and actions
Which of the following operations on an Apache Spark DataFrame is an action that triggers execution across the cluster?- A.
df.count() - B.
df.dropDuplicates(["user_id"]) - C.
df.filter(df["age"] > 21) - D.
df.select("name", "age")
Show answer
A.
df.count()count() returns the number of rows as a Python integer and requires evaluating the lineage graph to compute the result. filter, select, and dropDuplicates are transformations that lazily return a new DataFrame.- A.
Question 2 · Easy · Partitioning
A PySpark developer wants to reduce the number of partitions in a DataFrame from 200 to 10 without triggering an unnecessary full shuffle of the data across cluster nodes. Which method should be used?- A.
df.repartitionByRange(10) - B.
df.coalesce(10) - C.
df.repartition(10) - D.
df.partitionBy(10)
Show answer
B.
df.coalesce(10)coalesce decreases the partition count by collapsing existing partitions locally on executors, avoiding a full shuffle. repartition performs a full shuffle regardless of whether partition counts increase or decrease.- A.
Question 3 · Moderate · Joins and shuffles
In Spark SQL / PySpark, when joining a large 2 TB fact table with a 15 MB lookup dimension table, what is generally the most efficient join strategy to avoid an expensive shuffle?- A.Broadcast Nested Loop Join
- B.
Broadcast Hash Join (Map-side join) - C.Sort Merge Join
- D.Shuffle Hash Join
Show answer
B.
Broadcast Hash Join (Map-side join)A Broadcast Hash Join copies the small table (15 MB, well below typical broadcast thresholds or suitable for explicit broadcast() hint) to all executors, completely avoiding the shuffle of the 2 TB table.Question 4 · Advanced · Caching
Which StorageLevel in Spark causes cached DataFrame partition blocks to be stored as serialized Java objects in memory and dropped directly to disk when memory is exhausted, without recomputation upon subsequent access?- A.MEMORY_AND_DISK
- B.DISK_ONLY_2
- C.MEMORY_AND_DISK_SER
- D.MEMORY_ONLY_SER
Show answer
C. MEMORY_AND_DISK_SER
MEMORY_AND_DISK_SER stores partitions in serialized format in memory; if a partition does not fit in memory, it spills to disk so that it can be read back from disk instead of being recomputed.
How scoring and certificates work
- Each check has 15 multiple-choice questions with one correct answer, and one timer for the whole check. A question you leave unanswered scores nothing.
- Practice is free without an account and shows whether each answer is right as you go, with an explanation.
- The certified exam is scored when you submit. 60% passes, which is 9 of 15. Easy unlocks Moderate, and Moderate unlocks Advanced.
- Passing the exam while signed in earns a free certificate, valid for one year, with its own verification page. See a sample certificate.
Free tools for Spark: JSON to CSV, SQL Formatter