Kotlin Interview Questions 2026
Kotlin is the primary Android language and increasingly used for backend services. Interviews focus on coroutines, null safety, and idiomatic Kotlin vs Java.
Null Safety
Kotlin's type system distinguishes nullable types (String?) from non-nullable (String). The Elvis operator (?:) provides a default. Safe call (?.) short-circuits on null. The !! operator forces unwrap and throws NPE on null.
Common mistake: overusing !! to silence the compiler. This is the Kotlin equivalent of ignoring NullPointerExceptions. Use safe calls, Elvis, or let/run to handle nullability at the point of use.
Coroutines
Coroutines are Kotlin's structured concurrency primitive. launch starts a coroutine that does not return a value. async/await starts one that returns a value via Deferred. All coroutines run within a scope that manages their lifecycle.
Dispatchers control which thread a coroutine runs on: Dispatchers.IO for blocking I/O, Dispatchers.Default for CPU-bound work, Dispatchers.Main for UI updates on Android. withContext(Dispatchers.IO) switches dispatcher within a coroutine.
Data Classes and Sealed Classes
Data classes auto-generate equals, hashCode, toString, copy, and componentN functions. They are appropriate for value objects. Avoid inheritance with data classes.
Sealed classes restrict the hierarchy to a closed set of subclasses known at compile time. Combined with when expressions, the compiler enforces exhaustiveness. This is idiomatic for representing states in a state machine or result types.
Extension Functions
Extension functions add methods to existing types without inheritance or decoration. They are resolved statically (at compile time), not virtually. They cannot access private members of the extended class.
Use extension functions to add utility methods to third-party types, or to organize code by receiver type. Operator overloading is a form of extension function. Know that extension functions do not actually modify the class byte-code.
Browse Android and Mobile Interview Questions
Real mobile engineering questions from top companies.
Browse All Companies