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
  1. Which Spark RDD action returns the first n elements of the RDD? → take(n)
  2. Which method forces Spark to recompute an RDD and remove its cached data? → rdd.unpersist()
  3. What is a Spark Stage? → A phase of the DAG separated by wide transformations (shuffle boundaries)
  4. In Spark Structured Streaming, what does event time refer to? → The time when the record was generated at the source
  5. 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
  6. Which of the following statements about Spark R is correct? → It allows data scientists to analyze large datasets and interactively run jobs
  7. What is predicate pushdown in Spark SQL? → Moving filter conditions to earlier stages of the query plan to reduce data processed
  8. Which method waits for a streaming query to finish in Spark? → query.awaitTermination()
  9. What is a Pipeline in Spark MLlib? → A sequence of stages (Transformers and Estimators) that form an ML workflow
  10. Which Spark MLlib algorithm is suitable for large-scale linear regression? → LinearRegression with L-BFGS optimizer
  11. What is a Spark application's relationship to Spark jobs? → An application contains one or more jobs, each triggered by an action
  12. Which of the following is a valid trigger for Structured Streaming in Spark? → ProcessingTime trigger
  13. Which Spark MLlib algorithm is used for collaborative filtering-based recommendations? → ALS (Alternating Least Squares)
  14. What does the flatMap() transformation do in Spark? → Maps each element to zero or more output elements and flattens the result
  15. Which action computes the sum of all elements in a numeric RDD? → reduce(lambda a,b: a+b)
  16. What is GBTClassifier in Spark MLlib? → A Gradient Boosted Trees Classifier for binary classification
  17. Which method is used to run a SQL query on a registered temporary view in Spark SQL? → spark.sql()
  18. What is the purpose of spark.default.parallelism? → Sets the default number of RDD partitions for transformations that create new partitions
  19. Which method starts a streaming query in Spark Structured Streaming? → df.writeStream.start()
  20. In which deploy mode does the Spark driver run on the machine where spark-submit is executed? → Client mode
  21. What is dynamic partition pruning in Spark 3.x? → Filtering partitions of a fact table at runtime using values from a dimension table join
  22. Which format is recommended for reading structured data in Spark SQL when schema inference is needed? → JSON
  23. Which of the following strategies helps avoid data skew in a join operation? → Salting the join key with a random prefix
  24. In GraphX's `aggregateMessages`, what is the role of the `sendMsg` function? → To define what messages are sent along each edge to neighboring vertices
  25. Which Spark MLlib algorithm performs dimensionality reduction? → PCA (Principal Component Analysis)
  26. What are Spark Executors? → JVM processes launched by the cluster manager that execute tasks and store RDD data
  27. What types of data can be used in Spark Streaming? → All of the above
  28. Which of the following statements about Spark MLlib is correct? → It is the scalable machine learning library which delivers efficiencies
  29. Spark Streaming's fundamental abstraction is → Dstream
  30. 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
Was this helpful?