Top 30 Easy Android & Kotlin Interview Questions and Answers for Freshers
30 easy multiple-choice Android & Kotlin interview questions, the ones an interviewer opens with: definitions, everyday syntax, and the quick checks that you have really used it. They come from 30 bites in the Android & Kotlin library, the gentlest slice of the 245 Android & Kotlin interview questions in the library. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.
Jetpack Compose, Android Studio, Kotlin, Material You
30 questions. Pick an answer, or open “Show the answer” to read it.
Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.
Question 1 of 30
In Kotlin, what does declaring a variable with val guarantee about the referenced object?
Show the answer
Answer: c · The reference cannot be reassigned, though the object's contents may still mutate
val only prevents reassigning the reference itself, so a val holding a MutableList can still be modified. The most tempting distractor confuses reference immutability with deep object immutability, which val does not enforce.
Read the full bite: Explain val vs var in Kotlin and null safety risks
Question 2 of 30
What is the main advantage of Kotlin's approach to null safety with default non-nullable types?
Show the answer
Answer: d · It shifts the detection of potential NullPointerExceptions from runtime to compile time.
Kotlin's type system is explicitly designed to prevent NullPointerExceptions (NPEs) at compile time, a major benefit over languages that only catch them at runtime. Option B is a common misconception; val declares a read-only reference, not necessarily a compile-time constant.
Read the full bite: Explain val, var, and null safety in Kotlin
Question 3 of 30
Given the Kotlin declaration `val userNames = mutableListOf("Alice")`, which statement accurately describes the `userNames` variable?
Show the answer
Answer: d · The variable `userNames` cannot be reassigned, but the list it points to can be modified.
The `val` keyword creates a read-only reference, meaning the `userNames` variable cannot be reassigned. However, the `mutableListOf` object it points to is still mutable, allowing its contents to be changed. A common misconception is that `val` makes the object itself immutable.
Read the full bite: Explain val vs. var and null safety in Kotlin
Question 4 of 30
If user is null, what happens when evaluating user?.name ?: "Guest"?
Show the answer
Answer: b · It returns Guest without throwing an exception
The safe call operator ?. returns null when user is null, and the Elvis operator ?: then substitutes Guest as the fallback. Option C is tempting because ?. does preserve nullability, but it ignores that ?: immediately provides the default value.
Read the full bite: What do the safe call and Elvis operators do in Kotlin?
Question 5 of 30
Given a nullable `user: User?`, how do you safely get its name's length, returning 0 if either `user` or its `name` property is null?
Show the answer
Answer: d · user?.name?.length ?: 0
The safe call `?.` accesses properties only if the object is not null, and the Elvis operator `?:` provides the default value `0` if the preceding expression is null. The `if/else` block is verbose and not idiomatic Kotlin.
Read the full bite: Purpose of Kotlin's safe call (`?.`) and Elvis (`?:`) operators?
Question 6 of 30
Given `data class User(val name: String?)` and a nullable `val activeUser: User?`, which Kotlin expression correctly retrieves the user's name, providing "Guest" if `activeUser` is null or its `name` property is null?
Show the answer
Answer: d · activeUser?.name ?: "Guest"
Option D correctly uses the safe call operator (?. ) to access 'name' only if 'activeUser' is not null, and then the Elvis operator (?: ) to provide "Guest" if the result is null. Option C, while functionally correct, is considered non-idiomatic Kotlin as it uses a verbose if/else block instead of the more concise and expressive ?. and ?: operators.
Read the full bite: Purpose of safe call (`?.`) and Elvis (`?:`) operators
Question 7 of 30
When running a background task that might fail, how do you defer exception handling until the result is actually needed?
Show the answer
Answer: d · Use `async` and wrap the call to `await()` in a `try-catch` block.
`async` encapsulates any exception, which is re-thrown only when `await()` is called, allowing for deferred handling. In contrast, `launch` propagates exceptions immediately, so a `CoroutineExceptionHandler` would trigger right away.
Read the full bite: Difference between launch and async in Kotlin Coroutines
Question 8 of 30
For a Kotlin Coroutine task that updates a UI element and does not require a return value, which builder is most appropriate?
Show the answer
Answer: d · launch
The correct choice is launch because it is designed for 'fire-and-forget' operations, such as UI updates, where a direct result is not needed and it returns a Job. Using async for such a task would create a Deferred object whose result is never awaited, potentially leading to silently swallowed exceptions.
Read the full bite: Explain launch vs. async in Kotlin Coroutines
Question 9 of 30
You need to fetch two pieces of data in parallel inside a ViewModel and return both results to the caller. Which choice best follows structured concurrency?
Show the answer
Answer: a · Use async for both calls and await each Deferred before returning
async returns a Deferred that lets you retrieve computed values with await, which is exactly what you need when results must be returned, whereas launch is fire-and-forget. Option C is tempting but wrong because injecting a custom Job breaks the parent-child relationship required by structured concurrency.
Read the full bite: Explain the difference between launch and async in Kotlin Coroutines
Question 10 of 30
What is the primary effect of a `suspend` function when it needs to wait for a long-running operation like a network request?
Show the answer
Answer: b · It can pause the coroutine's execution, freeing the underlying thread to perform other work.
A suspend function pauses the coroutine, freeing the thread it was running on for other work. It does not inherently switch threads (that's a dispatcher's job) or block the thread.
Question 11 of 30
Which statement accurately describes the Kotlin language rule for calling a suspend function?
Show the answer
Answer: a · It is only permitted from another suspend function or a coroutine builder.
Kotlin enforces that suspend functions run inside a coroutine context, so they can only be called from another suspend function or a builder like launch or async. Option C is tempting because runBlocking is a valid bridge from regular code, but it is not required for every invocation.
Read the full bite: What is a suspend function in Kotlin and its compiler rules?
Question 12 of 30
What is the fundamental mechanism enabling a Kotlin suspend function to pause execution without blocking its calling thread?
Show the answer
Answer: d · The compiler transforms it into a state machine using Continuation-Passing Style.
The correct answer is B because the card explicitly states the compiler performs a transformation called Continuation-Passing Style (CPS), which creates a state machine allowing the function to pause and resume. Option C is a common misconception; suspend functions do not inherently move execution to a background thread, as suspension is orthogonal to threading.
Read the full bite: What is a Kotlin `suspend` function and how does it work?
Question 13 of 30
You need to create an object and immediately set several of its properties in a single, concise block. Which scope function is most idiomatic for this configuration task?
Show the answer
Answer: d · apply
The `apply` function is designed for object configuration. It returns the context object itself, making it perfect for initialization, while `let` and `run` return the lambda result.
Read the full bite: Explain Kotlin's scope functions: let, run, with, apply, also
Question 14 of 30
You need to configure a new object inside a lambda using receiver syntax, then return the configured object itself for assignment. Which scope function should you use?
Show the answer
Answer: a · apply
apply exposes the object as a receiver (this) and returns the context object itself, making it ideal for builder-style configuration. run is a tempting distractor because it also uses receiver syntax, but it returns the lambda result rather than the configured object.
Read the full bite: Explain the difference between Kotlin's let, run, with, apply, and also
Question 15 of 30
When configuring an object by setting multiple properties and needing to return the configured object itself, which Kotlin scope function is most appropriate?
Show the answer
Answer: a · apply
apply is specifically designed for object configuration, allowing direct access to properties via 'this' and returning the configured object itself. run and let return the lambda's result, while also uses 'it' as an argument, making 'apply' the idiomatic choice for this scenario.
Read the full bite: Explain Kotlin's five scope functions: let, run, with, apply, also
Question 16 of 30
If a developer creates a new Activity but forgets to declare it in AndroidManifest.xml, what happens when the app tries to start that Activity?
Show the answer
Answer: a · The Activity will fail to launch, and the application will crash.
The manifest is a contract with the Android OS; if a component is not declared, the OS is unaware of it. Attempting to start an undeclared Activity will cause a runtime crash, not a compilation error.
Read the full bite: Purpose and Key Elements of AndroidManifest.xml
Question 17 of 30
Which statement best describes the fundamental role of the AndroidManifest.xml file in an Android application?
Show the answer
Answer: d · It acts as a contract with the Android operating system, declaring the app's essential components, required permissions, and hardware features.
The AndroidManifest.xml file is a contract with the OS, informing it about the app's components, permissions, and requirements. Option B is incorrect because build configuration (dependencies, signing) is handled by build.gradle, not the manifest.
Read the full bite: Describe the purpose of the AndroidManifest.xml file
Question 18 of 30
Why must every Activity, Service, BroadcastReceiver, and ContentProvider be declared in AndroidManifest.xml?
Show the answer
Answer: b · To enable the Android system to discover, instantiate, and route requests to them at install time
The manifest serves as the install-time contract with the Android system, allowing it to know what components exist and how to route intents to them. Option A is tempting because permissions are listed in the manifest, but declaring components is unrelated to runtime permission requests and the manifest is read by the system, not just used for runtime checks.
Read the full bite: What is AndroidManifest.xml and what key elements does it declare?
Question 19 of 30
To add a new library like Retrofit for use only within your app module, where should you declare the `implementation` dependency?
Show the answer
Answer: a · In the `dependencies` block of the module-level build.gradle file.
The module-level build.gradle file is for settings specific to that module, including its library dependencies. The project-level file is for global settings, like defining repositories where dependencies are found, not for declaring the dependencies themselves.
Read the full bite: Difference between project and module build.gradle files?
Question 20 of 30
In a multi-module Android project, which configuration belongs in the project-level build.gradle rather than a module-level file?
Show the answer
Answer: d · Plugin repository declarations such as google() and mavenCentral()
The project-level build.gradle manages global build infrastructure like plugin repositories and shared versions, while module-level files handle Android plugins, dependencies, and build types. Option B is a common misconception because the com.android.application plugin must be applied in the app module's build.gradle, not the project-level file.
Read the full bite: What is the difference between project-level and module-level build.gradle?
Question 21 of 30
Which configuration is primarily managed within a module-level build.gradle file in an Android project?
Show the answer
Answer: a · Specifying the minSdk version and application ID for a specific app
The card states that module-level build.gradle files configure settings for that specific module only, including 'setting the minSdk and targetSdk, defining the applicationId'. The other options describe configurations typically handled at the project level or in settings.gradle, applying globally rather than to a single module.
Read the full bite: Project-level vs. module-level build.gradle files
Question 22 of 30
Which method is the most efficient and recommended for providing a distinct layout for an Android activity when the device is rotated to landscape mode?
Show the answer
Answer: b · Create res/layout/my_activity.xml for portrait and res/layout-land/my_activity.xml for landscape, both with the same root filename.
Android's resource qualifier system automatically selects the appropriate layout based on the device's configuration, such as orientation, by using suffixes like -land. Manually checking orientation in lifecycle callbacks (Option A) is inefficient and bypasses this intended automatic mechanism.
Read the full bite: Explain the res/ directory and resource qualifiers for layouts
Question 23 of 30
What is required for Android to automatically select a landscape layout when the device rotates, without adding orientation logic in your Activity?
Show the answer
Answer: a · Create res/layout-land/ and place an XML file with the identical filename used in res/layout/
The framework matches the current configuration to qualifier directories at runtime, but only when XML files share the same name so R.layout.name resolves to the correct variant automatically. Detecting orientation manually or using configChanges prevents this automatic declarative selection and forces unnecessary branching code.
Read the full bite: What is the res directory and how do you use orientation qualifiers?
Question 24 of 30
What is the standard practice for providing a different layout file for landscape orientation on Android?
Show the answer
Answer: c · Create a `res/layout-land/` directory and place a layout file inside it with the same name as the default.
Android's resource system automatically selects the correct layout by using directory name qualifiers. Creating a `layout-land` directory is the standard way to provide an alternative layout, which the system will use without requiring any conditional logic in your code.
Read the full bite: What is the `res/` directory and how do you use resource qualifiers?
Question 25 of 30
When an Android Activity becomes completely invisible because the user navigated away, which lifecycle method is the most appropriate place to release expensive resources like a camera or network connection?
Show the answer
Answer: d · onStop()
onStop() is the correct method because it is called when the Activity is no longer visible, making it suitable for releasing expensive resources. onPause() is incorrect as it must execute very quickly and is for pausing lightweight operations when the Activity is only partially obscured.
Read the full bite: Describe the Android Activity lifecycle when navigating away and back
Question 26 of 30
When a user navigates away from an Activity, why is it better to release a resource-intensive object like a camera in onStop() instead of onPause()?
Show the answer
Answer: d · onPause() execution must be very fast because it blocks the next Activity from appearing.
Correct. onPause() must be lightweight because it blocks the UI thread and can delay the next Activity from appearing. Heavy cleanup belongs in onStop() since the Activity is already hidden from the user.
Read the full bite: Trace an Activity's lifecycle when a user navigates away and returns
Question 27 of 30
Which callback sequence occurs when a user leaves an Activity and returns later without the system destroying it?
Show the answer
Answer: b · onPause, onStop, onRestart, onStart, onResume
Navigating away triggers onPause and onStop, while returning from the stopped state calls onRestart, onStart, and onResume. onCreate only runs after the Activity has been fully destroyed, so including it is a common misconception.
Read the full bite: Describe the Android Activity lifecycle and callback order
Question 28 of 30
When an Android Activity with an EditText (unique ID) and a custom counter (TextView) undergoes screen rotation, how should their states be preserved to survive both rotation and process death?
Show the answer
Answer: d · The EditText's state is automatically handled; the counter's value should be stored in a ViewModel with a SavedStateHandle.
The Android framework automatically saves the state of an EditText with a unique ID. For custom UI state, like a counter, the recommended modern approach is to use a ViewModel with a SavedStateHandle, which ensures data persistence across configuration changes and process death. Option B is incorrect because EditText state is automatic, and a ViewModel alone doesn't survive process death without SavedStateHandle.
Read the full bite: How do you save UI state during screen rotation?
Question 29 of 30
When a user rotates their device, what is the modern, robust, and recommended approach to ensure text in an EditText is not lost?
Show the answer
Answer: a · Use a ViewModel combined with a SavedStateHandle to store the text.
Using a ViewModel with a SavedStateHandle is the modern, recommended architecture. The ViewModel survives the configuration change, and the SavedStateHandle ensures the data also survives system-initiated process death. Relying on the default behavior (Option B) is brittle and doesn't cover all UI state.
Read the full bite: What happens to an Activity and its text on screen rotation?
Question 30 of 30
Under what condition does an EditText automatically preserve its text during a screen rotation?
Show the answer
Answer: b · Only if the EditText has an android:id attribute assigned in its layout
The Android framework automatically saves and restores an EditText's text across configuration changes as long as the view has an android:id. Option C is wrong because it reflects the common misconception that text is always lost by default, ignoring this built-in behavior.
Read the full bite: Activity rotation: what happens to EditText text?
Could you explain these out loud?
That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.