Apache Spark Cheat Sheet 2026
The 30 highest-yield Apache Spark facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.
45 questions
90 min time limit
70.00% to pass
- Which Spark RDD action returns the first n elements of the RDD? → take(n)
- Which method forces Spark to recompute an RDD and remove its cached data? → rdd.unpersist()
- What is a Spark Stage? → A phase of the DAG separated by wide transformations (shuffle boundaries)
- In Spark Structured Streaming, what does event time refer to? → The time when the record was generated at the source
- What is the primary use-case limitation of GraphX compared to dedicated graph databases such as Neo4j? → GraphX is not designed for low-latency, transactional (OLTP-style) single-vertex lookups
- Which of the following statements about Spark R is correct? → It allows data scientists to analyze large datasets and interactively run jobs
- What is predicate pushdown in Spark SQL? → Moving filter conditions to earlier stages of the query plan to reduce data processed
- Which method waits for a streaming query to finish in Spark? → query.awaitTermination()
- What is a Pipeline in Spark MLlib? → A sequence of stages (Transformers and Estimators) that form an ML workflow
- Which Spark MLlib algorithm is suitable for large-scale linear regression? → LinearRegression with L-BFGS optimizer
- What is a Spark application's relationship to Spark jobs? → An application contains one or more jobs, each triggered by an action
- Which of the following is a valid trigger for Structured Streaming in Spark? → ProcessingTime trigger
- Which Spark MLlib algorithm is used for collaborative filtering-based recommendations? → ALS (Alternating Least Squares)
- What does the flatMap() transformation do in Spark? → Maps each element to zero or more output elements and flattens the result
- Which action computes the sum of all elements in a numeric RDD? → reduce(lambda a,b: a+b)
- What is GBTClassifier in Spark MLlib? → A Gradient Boosted Trees Classifier for binary classification
- Which method is used to run a SQL query on a registered temporary view in Spark SQL? → spark.sql()
- What is the purpose of spark.default.parallelism? → Sets the default number of RDD partitions for transformations that create new partitions
- Which method starts a streaming query in Spark Structured Streaming? → df.writeStream.start()
- In which deploy mode does the Spark driver run on the machine where spark-submit is executed? → Client mode
- What is dynamic partition pruning in Spark 3.x? → Filtering partitions of a fact table at runtime using values from a dimension table join
- Which format is recommended for reading structured data in Spark SQL when schema inference is needed? → JSON
- Which of the following strategies helps avoid data skew in a join operation? → Salting the join key with a random prefix
- In GraphX's `aggregateMessages`, what is the role of the `sendMsg` function? → To define what messages are sent along each edge to neighboring vertices
- Which Spark MLlib algorithm performs dimensionality reduction? → PCA (Principal Component Analysis)
- What are Spark Executors? → JVM processes launched by the cluster manager that execute tasks and store RDD data
- What types of data can be used in Spark Streaming? → All of the above
- Which of the following statements about Spark MLlib is correct? → It is the scalable machine learning library which delivers efficiencies
- Spark Streaming's fundamental abstraction is → Dstream
- What is the role of offsets in Spark Structured Streaming with Kafka? → They track the position in the Kafka topic for fault-tolerant exactly-once processing
Turn these facts into recall: