Scala
35 questionsFunctional programming, case classes, traits, pattern matching, implicits, type system, Spark Scala, Akka, and Scala 3 features.
val vs var vs def vs lazy val
Explain the difference between val, var, def, and lazy val in Scala. When do you use each?
Case Classes and Pattern Matching
What are case classes? How does pattern matching work in Scala?
Traits and Mixins
How do traits work in Scala? What's the difference between traits and abstract classes?
Option, Some, None — Null Safety
How does Option work in Scala? Why is it better than null?
Collections: List, Map, Seq, Set
Explain Scala's collection hierarchy. What are the key differences from Java collections?
For-Comprehensions
How do for-comprehensions work in Scala? What do they desugar to?
Either, Try, and Error Handling
Compare Option, Try, and Either for error handling in Scala. When do you use each?
Companion Objects and apply/unapply
What are companion objects in Scala? Explain apply and unapply.
Type System: Variance and Bounds
Explain covariance, contravariance, and invariance in Scala. What are type bounds?
Implicit Conversions and Parameters
How do implicits work in Scala 2? How have they changed in Scala 3?
Higher-Order Functions
What are higher-order functions? Show practical Scala examples.
Currying and Partial Application
Explain currying and partial application in Scala. How are they used in practice?
Monads: flatMap and For-Comprehension
What is a monad in Scala? Why should a data engineer care?
Immutability and Persistent Data Structures
How does Scala achieve efficient immutability? What are persistent data structures?
Tail Recursion
What is tail recursion? How does Scala optimize it? What's @tailrec?
Type Classes
What are type classes in Scala? How do they differ from inheritance?
Futures and Promises
How do Futures work in Scala? How do you handle async composition and error handling?
Partial Functions and Pattern Matching Functions
What are PartialFunctions in Scala? How are they used with collect, orElse, and andThen?
Spark with Scala: RDD Basics
How do you use RDDs in Spark with Scala? Show common transformations and actions.
Spark DataFrames and Datasets in Scala
How do DataFrames and Datasets work in Scala Spark? What's the difference?
Spark UDFs in Scala
How do you create and use UDFs in Spark Scala? What are the performance implications?
Spark Implicit Conversions and Encoders
How do Spark's implicits work? What are Encoders and why are they needed?
Spark Broadcast and Accumulators
Explain broadcast variables and accumulators in Spark Scala.
Spark Window Functions in Scala
Show Spark window functions in Scala with practical examples.
Spark Structured Streaming in Scala
How does Structured Streaming work in Spark Scala? Show a Kafka-to-Delta pipeline.
Spark Optimization: Partitioning and Caching
How do you optimize Spark jobs? Explain partitioning, caching, and common tuning techniques.
Spark Error Handling in Scala
How do you handle errors and bad data in Spark Scala pipelines?
Spark Testing in Scala
How do you unit test Spark code in Scala?
Actors and Akka Basics
What is the Actor model? Show basic Akka actor usage in Scala.
Scala Concurrency: Parallel Collections and Par
How do parallel collections work in Scala? When should you use them?
Scala 3: given/using vs implicit
How does Scala 3 replace implicits? Explain given, using, and extension methods.
Scala 3: Enums and Union Types
What are Scala 3 enums and union types? How do they improve over Scala 2?
Building a Data Pipeline in Scala
Design a production data pipeline in Scala/Spark. Show the architecture and key code.
Scala Best Practices for Data Engineering
What are Scala best practices specific to data engineering?
sbt and Scala Project Structure
How do you structure a Scala/Spark project? Explain sbt basics.