Kotlin Cheat Sheet 2026
The 30 highest-yield Kotlin facts, distilled from real exam questions. Print it, save it as a PDF, or study it here — free, no sign-up.
50 questions
60 min time limit
50.00% to pass
- What is the purpose of generics in Kotlin? → To enable type-safe reusable code that works with different types
- Which keyword is used to define a constant at the top level in Kotlin? → const val
- What will `println(10 / 3)` output in Kotlin? → 3
- Which coroutine builder launches a new coroutine and returns a Job? → launch
- Which Kotlin collection is immutable by default? → List
- What does `produce` coroutine builder create? → A Channel that receives values produced by a coroutine
- What is the difference between `List` and `MutableList` in Kotlin? → List is read-only; MutableList supports add/remove operations
- What keyword makes a Kotlin class open for inheritance? → open
- What does `LaunchedEffect` do in Jetpack Compose? → Runs a suspend function in composition with a given key, relaunching when the key changes
- What is a receiver in the context of Kotlin extension functions? → The object on which the extension function is called, accessible as `this`
- What does `for (i in 1..5)` iterate over in Kotlin? → 1 to 5
- What is an extension property in Kotlin? → A property added to an existing class without modifying its source
- Which function creates a Map in Kotlin from a list of pairs? → both a and b are correct
- Which function combines all elements of a collection into a single result? → fold
- What does the `map` function do on a Kotlin collection? → Transforms each element using a given function and returns a new list
- What is a value class in Kotlin? → A class that wraps a single value and is inlined by the compiler to avoid object overhead
- What is the `Nothing` type in Kotlin primarily used for? → Functions that always throw or loop infinitely
- What does `partition` do in Kotlin? → Splits a collection into two lists: matches and non-matches based on a predicate
- How do you check if a `lateinit var` has been initialized in Kotlin? → Using `::property.isInitialized`
- What are the default classes in Kotlin? → final
- Which operator is used to perform a non-null assertion in Kotlin? → !!
- What does `!!` do in Kotlin? → Non-null assertion that throws NullPointerException if null
- What does the `fold` function do in Kotlin? → Accumulates a value starting from an initial value
- What does the `override` keyword do in Kotlin? → Explicitly marks a method as overriding a parent class or interface member
- What is currying in functional programming as applied to Kotlin? → Transforming a multi-argument function into a sequence of single-argument functions
- Which keyword is used to declare an immutable variable in Kotlin? → val
- How do you implement an interface in Kotlin? → Using `:` after the class name followed by the interface name
- What happens when a coroutine throws an uncaught exception? → The exception propagates to the parent scope and cancels it
- What does the safe cast operator `as?` return when the cast is unsuccessful? → null
- Which Kotlin keyword is equivalent to Java's `instanceof`? → is
Turn these facts into recall: