Interviewers often probe for a candidate's understanding of Kotlin's core features, its interoperability with Java, and how to write idiomatic, concise, and safe code. They look for practical application of concepts like null safety, coroutines, and functional programming paradigms, assessing the ability to leverage Kotlin's strengths for robust and maintainable software.
16 questions (4 easy · 7 medium · 5 hard), each with what a strong answer covers and where people lose the point. Free to read, no account.
2.Describe the purpose and usage of the safe call operator (`?.`) and the Elvis operator (`?:`) in Kotlin's null safety system.
Warm-up
What a strong answer covers
The safe call operator `?.` allows you to call a method or access a property on an object only if that object is non-null; otherwise, the entire expression evaluates to `null`.
The Elvis operator `?:` provides a default value when the expression on its left-hand side is `null`.
Explain how these operators help prevent `NullPointerExceptions` at compile time.
Provide code examples demonstrating `user?.name` and `user?.name ?: "Guest"`.
Highlight that these are idiomatic ways to handle nullability gracefully.
Where people lose the point
×Confusing `?.` with `!!` (non-null assertion operator).
×Not explaining that `?.` short-circuits the operation if the receiver is null.
×Failing to provide a clear example of how `?:` provides a fallback value.
3.What is a `data class` in Kotlin, and what are its primary benefits?
Warm-up
What a strong answer covers
A `data class` is a special type of class primarily used to hold data.
The compiler automatically generates useful member functions for data classes: `equals()`, `hashCode()`, `toString()`, `copy()`, and `componentN()` functions.
Explain that `equals()` and `hashCode()` are based on the properties declared in the primary constructor.
Mention `copy()` for creating modified copies of objects while maintaining immutability.
Benefits include reduced boilerplate code, improved readability, and suitability for use in collections (e.g., as map keys).
Where people lose the point
×Forgetting to mention `copy()` or `componentN()` functions.
×Incorrectly stating that `data class` automatically makes all properties `val` (they can be `var`).
×Not emphasizing the primary purpose of data classes: holding data.
5.What are extension functions in Kotlin, and how do they enable you to add functionality to existing classes without modifying their source code?
Core
What a strong answer covers
Extension functions allow you to add new functions to a class without inheriting from it or using design patterns like Decorator.
They are declared with a *receiver type* (the type being extended) prefixed to the function name (e.g., `fun String.lastChar(): Char`).
Inside the extension function, `this` refers to the receiver object.
Explain that extension functions are resolved statically, meaning they are essentially syntactic sugar for static utility functions that take the receiver object as the first argument.
Provide a simple example, like extending `String` or `List`.
Where people lose the point
×Incorrectly stating that extension functions modify the original class or add members to it.
×Failing to mention that they are resolved statically, not dynamically.
×Not explaining the `this` keyword's context within an extension function.
6.Differentiate between an `object` declaration and a `companion object` in Kotlin, providing use cases for each.
Core
What a strong answer covers
An `object` declaration creates a singleton instance of a class. It's a convenient way to define a class and create a single instance of it at the same time.
A `companion object` is an object declared inside a class, marked with the `companion` keyword. It's a singleton associated with its enclosing class, allowing you to define static-like members (factory methods, constants) that can be called directly on the class name.
Use cases for `object`: utility classes, singletons, implementing interfaces without creating a named class.
Use cases for `companion object`: factory methods, constants, extension points for the enclosing class.
Explain that a class can have only one `companion object`.
Where people lose the point
×Confusing the scope or lifecycle of `object` vs `companion object`.
×Not clearly explaining that `companion object` members are accessed via the class name, similar to static members in Java.
×Failing to provide distinct and appropriate use cases for each.
8.Compare and contrast `let` and `apply` scope functions in Kotlin, highlighting their primary use cases.
Core
What a strong answer covers
Scope functions (`let`, `run`, `with`, `apply`, `also`) are functions that execute a block of code on an object and return a result.
`let`: The receiver object is available as `it` inside the lambda. It returns the result of the lambda. Primary use case: performing operations on a nullable object (often with `?.let`) or transforming an object.
`apply`: The receiver object is available as `this` inside the lambda. It returns the receiver object itself. Primary use case: configuring an object (e.g., initializing properties) and then returning it.
Emphasize the difference in how the receiver is referenced (`it` vs `this`) and what is returned.
Provide clear examples for both.
Where people lose the point
×Confusing the return value of `let` (lambda result) with `apply` (receiver object).
×Incorrectly stating how the receiver is accessed (`it` vs `this`).
×Not providing distinct use cases that highlight their strengths.
9.What are `sealed` classes in Kotlin, and when would you use them?
Core
What a strong answer covers
A `sealed` class is a class that restricts its inheritance hierarchy to a fixed set of direct subclasses, all defined within the same file or module.
It's implicitly `abstract` and cannot be instantiated directly. Its constructors are private by default.
The primary benefit is that `when` expressions that work with `sealed` classes can be exhaustive without requiring an `else` branch, as the compiler knows all possible subclasses.
Use cases: Representing a restricted set of states (e.g., `Result` type with `Success` and `Error`), modeling algebraic data types, or defining a finite state machine.
Provide an example of a `sealed` class with a `when` expression.
Where people lose the point
×Confusing `sealed` classes with `abstract` classes without mentioning the restricted inheritance.
×Forgetting the exhaustiveness benefit with `when` expressions.
×Not providing a clear use case where `sealed` classes shine.
10.Explain the purpose of the `suspend` keyword in Kotlin Coroutines. What does it signify about a function?
Core
What a strong answer covers
The `suspend` keyword marks a function or a lambda as "suspendable," meaning it can pause its execution at certain points and resume later.
It indicates that the function is a *coroutine* function and can only be called from another `suspend` function or a coroutine builder (like `launch` or `async`).
Explain that `suspend` functions do not block the thread they are running on; instead, they suspend the coroutine, freeing the thread to do other work.
Mention that the compiler transforms `suspend` functions into state machines, allowing them to manage their own execution flow.
Provide a simple example of a `suspend` function simulating a network call.
Where people lose the point
×Incorrectly stating that `suspend` functions run on a separate thread by default.
×Failing to explain that `suspend` functions are non-blocking.
×Not mentioning the restriction that `suspend` functions can only be called from other `suspend` functions or coroutine scopes.
11.How does Kotlin handle checked exceptions from Java, and what are the implications for interoperability?
Core
What a strong answer covers
Kotlin does not have checked exceptions. All exceptions in Kotlin are unchecked.
When calling Java code that declares checked exceptions, Kotlin treats them as unchecked exceptions.
This means the Kotlin compiler does not force you to catch or declare these exceptions.
Implications: While it simplifies Kotlin code by removing boilerplate `try-catch` blocks, it also means that potential exceptions from Java libraries might not be explicitly handled, requiring careful documentation or runtime handling.
Suggest using `try-catch` blocks in Kotlin where appropriate, even if not enforced, to handle expected Java exceptions gracefully.
Where people lose the point
×Incorrectly stating that Kotlin *has* checked exceptions or that it forces handling.
×Failing to explain the implication of this design choice (less boilerplate but potential for unhandled exceptions).
×Not mentioning that `try-catch` is still available and often necessary.
12.Explain the concept of structured concurrency in Kotlin Coroutines and its benefits.
Hard
What a strong answer covers
Structured concurrency ensures that coroutines are organized in a parent-child hierarchy, where a parent coroutine is responsible for its children.
A `CoroutineScope` defines the lifecycle of coroutines. When a scope is cancelled, all coroutines launched within that scope are also cancelled automatically.
Benefits: Prevents resource leaks (e.g., background tasks continuing after a UI component is destroyed), simplifies error handling (child failures propagate to parent), and improves code readability by making coroutine lifecycles explicit.
Explain how `Job` and `CoroutineContext` play a role in managing this hierarchy.
Provide an example demonstrating how `launch` or `async` within a `CoroutineScope` creates child coroutines.
Where people lose the point
×Failing to explain the parent-child relationship and automatic cancellation.
×Not connecting structured concurrency to `CoroutineScope` and `Job`.
×Overlooking the benefits of resource management and simplified error handling.
13.Describe the delegation pattern in Kotlin and how the `by` keyword simplifies its implementation.
Hard
What a strong answer covers
The delegation pattern involves an object (the delegate) handling requests on behalf of another object (the delegator). It promotes composition over inheritance.
Kotlin provides built-in support for implementing the delegation pattern using the `by` keyword for interfaces.
When a class `A` implements an interface `I` by delegating to an instance `b` of another class `B` (which also implements `I`), `A` automatically forwards all `I`'s method calls to `b`.
Benefits: Reduces boilerplate code for implementing the pattern, promotes code reuse, and allows for easy modification or extension of behavior.
Provide an example: `class MyList<T>(private val innerList: MutableList<T> = mutableListOf()) : MutableList<T> by innerList`.
Where people lose the point
×Not explaining the core concept of delegation (composition over inheritance).
×Failing to mention the `by` keyword's role in simplifying the pattern.
×Providing an example that doesn't clearly demonstrate interface delegation.
14.Explain the concepts of covariance (`out`) and contravariance (`in`) in Kotlin generics, and provide a practical example for each.
Hard
What a strong answer covers
Variance refers to how subtyping between complex types (like generic types) relates to subtyping between their component types.
Covariance (`out`): A generic type `Producer<out T>` is covariant if `Producer<SubType>` is a subtype of `Producer<SuperType>`. The `out` keyword means `T` can only be "produced" (returned) by the class, not "consumed" (passed as an argument).
Contravariance (`in`): A generic type `Consumer<in T>` is contravariant if `Consumer<SuperType>` is a subtype of `Consumer<SubType>`. The `in` keyword means `T` can only be "consumed" (passed as an argument) by the class, not "produced" (returned).
Explain the PECS (Producer-Extends, Consumer-Super) principle from Java and how `out`/`in` map to it.
Examples: `List<out T>` (covariant, can only read `T`), `Comparator<in T>` (contravariant, can only consume `T`).
Where people lose the point
×Confusing `out` and `in` with each other or with Java's `extends`/`super`.
×Not clearly explaining the "producer" and "consumer" roles of the type parameter.
×Failing to provide concrete, understandable examples for both `out` and `in`.
15.What are `inline` functions in Kotlin, and when should you consider using them?
Hard
What a strong answer covers
The `inline` keyword requests the compiler to copy the function's bytecode directly into the call site instead of generating a function call.
Primary benefit: Reduces the overhead of higher-order functions and lambdas (which create anonymous class objects for each call), improving performance, especially in tight loops.
Explain that `inline` functions can also enable `non-local returns` from lambdas, which is not possible with regular lambdas.
Use cases: Higher-order functions that take lambdas as parameters, especially those called frequently or in performance-critical sections.
Caution: Inlining can increase code size (code bloat) if the function is large or called many times, so it should be used judiciously.
Where people lose the point
×Incorrectly stating that `inline` functions always improve performance without mentioning potential code bloat.
×Failing to explain the primary reason for inlining: reducing lambda overhead.
×Not mentioning the `non-local return` capability as a unique feature of inline lambdas.
16.Explain the concept of lambdas with receivers in Kotlin and provide an example of their practical application.
Hard
What a strong answer covers
A lambda with a receiver is a special type of lambda where the function literal has a *receiver type*. Inside the lambda, `this` refers to an instance of the receiver type.
This allows you to call methods and access properties of the receiver object directly, without explicit qualification, making the code more concise and readable.
They are commonly used to build Domain-Specific Languages (DSLs) and in Kotlin's standard library for scope functions like `apply` and `with`.
Provide an example: `StringBuilder.() -> Unit` or a custom DSL-like builder.
Contrast with regular lambdas where `it` refers to the single parameter.
Where people lose the point
×Confusing lambdas with receivers with regular lambdas or extension functions.
×Not clearly explaining that `this` inside the lambda refers to the receiver object.
×Failing to connect them to DSLs or specific standard library functions.
A question a Kotlin panel actually asks, answered out loud, scored on what you said and how you said it. Under two minutes, and nothing to sign up for.
“Explain the difference between `val` and `var` in Kotlin and provide a use case for each.”
We never store the audio. Your answer is deleted within 24 hours unless you save the result.
How Kotlin answers get judged
The weights a Kotlin interviewer is holding, whether or not they say so out loud. Round Zero scores your practice answers against exactly these, and quotes your own words back as the evidence for each.
Correctness
40%
The answer is factually accurate and free of technical errors. All code examples compile and behave as expected.
Conceptual Depth
30%
Demonstrates a thorough understanding of the underlying principles, trade-offs, and implications of the discussed concepts, beyond surface-level definitions.
Idiomatic Kotlin
20%
The solution leverages Kotlin's unique features and best practices, resulting in concise, readable, and maintainable code that aligns with Kotlin's design philosophy.
Communication Clarity
10%
The explanation is clear, well-structured, and easy to understand, effectively conveying complex ideas in a concise manner.
You have read what strong Kotlin answers contain. The next thing that moves the needle is producing one under time, out loud, and finding out where it falls apart.
What Kotlin interview questions should I practice?
Start with the core areas Kotlin interviewers probe: Explain the difference between `val` and `var` in Kotlin and provide a use case for each.; Describe the purpose and usage of the safe call operator (`?.`) and the Elvis operator (`?:`) in Kotlin's null safety system.; What is a `data class` in Kotlin, and what are its primary benefits. This page outlines strong answers and common mistakes, and the scored path drills each one with follow-ups.
Is the Kotlin practice free?
Yes. The Kotlin path runs free inside Round Zero: lessons, practice questions and flashcards. Drills are unlimited on every plan, free included. So is the full scorecard. Free also covers 3 complete scored interviews, no card.
How is this different from a Kotlin question list?
A static list gives you questions with no feedback. Round Zero runs a live scored practice that probes your actual answers, rotates difficulty, and tells you exactly what to fix, grounded in a Kotlin rubric.
How should I prepare for a Kotlin interview?
Learn the concepts, drill the questions until answers come fast, then prove it in a scored mock. Round Zero sequences all three so you know you are ready, not just that you read about Kotlin.
How is a Kotlin answer scored?
Kotlin answers are scored on correctness, conceptual depth, idiomatic kotlin, communication clarity, with evidence quoted from what you actually said, so feedback is specific instead of generic praise.
More free tools
Try everything. Sign up only when you want the full version.