Scala Cheat Sheet 2026

The 30 highest-yield Scala facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.

  1. How do you mix a trait into a class in Scala? class Foo with Bar
  2. What is `flatMap` used for with Scala Futures? Chaining asynchronous operations where each step depends on the previous result
  3. In the REPL, how do you halt execution? Pressing Ctrl+C
  4. How is pattern matching performed in Scala? using match-case
  5. What is a `for-comprehension` over Futures equivalent to in Scala? Chaining flatMap and map calls for sequential async composition
  6. What happens when the Scala compiler cannot find a required implicit value in scope? It produces a compile-time error
  7. Which Scala collection type guarantees uniqueness of elements? Set
  8. Which method on a Scala Future converts it to a blocking `Try`? Await.ready then future.value
  9. What is variance in Scala generics? How subtyping relationships of type parameters relate to subtyping of parameterized types
  10. What does `unapplySeq` enable compared to `unapply` in Scala extractors? It enables variable-length sequence extraction in patterns
  11. What does the `filter` method do on a Scala collection? Returns only elements satisfying a predicate
  12. What does `scanLeft` do in Scala compared to `foldLeft`? scanLeft returns all intermediate accumulator values, not just the final result
  13. In Scala 3, what is `summon[T]` equivalent to in Scala 2? implicitly[T]
  14. What does `partition` return on a Scala collection? A tuple of two collections: elements satisfying a predicate and those that don't
  15. What best describes a type class in Scala? A pattern using traits and implicits to achieve ad-hoc polymorphism
  16. How are anonymous functions (lambdas) defined in Scala? (x: Int) => x + 1
  17. How do you pattern match a Tuple2 in Scala? case (a, b) =>
  18. Which Scala method combines all elements of a collection into a single value? fold or reduce
  19. Which of the following claims about a functor in Scala is incorrect? It is a built-in construct in Scala
  20. How do you match on a List's head and tail in Scala? case h :: t =>
  21. Which Scala feature lets you add a condition to a pattern match case? Pattern guard using `if`
  22. What is an algebraic data type (ADT) in Scala? A type formed by combining other types using sealed traits and case classes
  23. What is a type class in Scala? A pattern using traits and implicits to add behavior to existing types without inheritance
  24. What is the `Nothing` type in Scala? The type of exceptions; it is a subtype of every type
  25. How do you merge two immutable Maps in Scala? map1 ++ map2
  26. What does `implicit` mean when applied to a parameter in Scala? The compiler automatically finds and passes a matching value from implicit scope
  27. Can case objects be used in pattern matching in Scala? Yes, case objects are matched by reference identity
  28. What does `distinct` do on a Scala Seq? Returns only unique elements in their original order
  29. Which keyword is used to declare an immutable variable in Scala? val
  30. What is a Scala `Future`? A delayed computation that may complete asynchronously with a value or failure
Turn these facts into recall: