Skip to content
tezvyn:

Top 30 Intermediate Android & Kotlin Concepts Quiz

30 intermediate multiple-choice Android & Kotlin concept questions, the mechanics underneath the basics: how the pieces relate and where the usual mental model stops holding. They come from 30 bites in the Android & Kotlin library, the middle slice of the 157 Android & Kotlin concept 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.

  1. Question 1 of 30

    What is the primary reason Kotlin classes are final by default?

    Show the answer

    Answer: a · To encourage explicit design for inheritance and promote composition over inheritance.

    The card states that Kotlin's design makes inheritance an intentional act to encourage more robust code and promotes composition over inheritance. Option A directly captures these core reasons. Option C is incorrect as 'final by default' relates to inheritance, not the mutability of properties, which is controlled by 'val' and 'var'.

    Read the full bite: Kotlin Inheritance: Open for Extension, Closed by Default

  2. Question 2 of 30

    Which statement accurately describes the behavior of the copy() method generated for a Kotlin data class?

    Show the answer

    Answer: d · It performs a shallow copy, meaning references to mutable objects within the data class are shared between the original and the new instance.

    The card explicitly states that the copy() function creates a shallow copy. This means if a data class contains a mutable object, both the original and the copied instance will refer to the same mutable object. Option A is a common misconception, as many expect a copy function to perform a deep copy for safety.

    Read the full bite: Kotlin Data Classes: Automatic Boilerplate for Data Holders

  3. Question 3 of 30

    Under which circumstance is it generally recommended to reconsider using a chain of standard Kotlin collection operations (like filter followed by map) and opt for an alternative?

    Show the answer

    Answer: b · When the collection is extremely large, and creating intermediate lists would be inefficient.

    Standard chained collection operations create new intermediate lists for each step, which can be very inefficient for large collections. In such cases, using 'asSequence()' or a traditional loop is preferred to avoid this overhead. Option C is incorrect because aggregation can also be achieved using functional operations like 'reduce' or 'fold'.

    Read the full bite: Kotlin Collections: Think Transformations, Not Loops

  4. Question 4 of 30

    Which problem does Kotlin's Structured Concurrency primarily aim to solve?

    Show the answer

    Answer: d · Preventing resource leaks from uncancelled background tasks.

    Structured concurrency's main purpose is to enforce lifetime management for concurrent work, preventing resource leaks and unnecessary work by ensuring background tasks are cancelled when no longer needed. While other options are valid concurrency concerns, they are not the primary problem addressed by structured concurrency itself.

    Read the full bite: Structured Concurrency in Kotlin

  5. Question 5 of 30

    What is the key distinction in how a child coroutine's termination impacts its parent Job?

    Show the answer

    Answer: a · An unhandled exception from a child cancels the parent, while a child's normal cancellation does not.

    The card states that if a child Job fails with an exception (other than CancellationException), it cancels its parent. However, if a child is cancelled normally via cancel() (which uses CancellationException), it does not affect the parent.

    Read the full bite: Kotlin's Job: A Handle to a Background Task

  6. Question 6 of 30

    For which scenario is Kotlin's async/await pattern the most appropriate choice?

    Show the answer

    Answer: c · Fetching a user's profile and their friends list concurrently from different API endpoints.

    The card states that async/await is for running multiple independent, long-running tasks concurrently and combining their results, as exemplified by fetching data from different API endpoints. Option B describes an anti-pattern, as async/await is not for sequential, dependent operations.

    Read the full bite: Kotlin Coroutines: async/await for Parallel Results

  7. Question 7 of 30

    What is the primary reason StateFlow is generally not recommended for handling one-time UI events like showing a Snackbar?

    Show the answer

    Answer: a · Its state-holding nature can cause the event to be re-emitted upon UI re-collection (e.g., config change).

    StateFlow is a state-holder that always provides the current value. If used for one-shot events, its state-holding nature means that a UI re-collection (e.g., after a configuration change) would re-receive the last "event" state, causing the event to trigger again. Options A, B, and D describe incorrect characteristics of StateFlow.

    Read the full bite: StateFlow: A Hot Flow for UI State

  8. Question 8 of 30

    What is the fundamental purpose of Kotlin's delegated properties?

    Show the answer

    Answer: b · To allow custom logic for getting and setting a property's value to be encapsulated and reused.

    The card states that delegated properties "let you outsource a property's getter/setter logic" and offer a "reusable, language-level solution to these common behaviors." This directly aligns with encapsulating and reusing custom logic. While lazy initialization (option A) is a key use case, it's one specific application of delegation, not the fundamental purpose of the delegation mechanism itself.

    Read the full bite: Kotlin Delegated Properties: Reusing Getter/Setter Logic

  9. Question 9 of 30

    What is the core function of Gradle when managing build dependencies in an Android project?

    Show the answer

    Answer: c · To ensure that all external libraries and pre-built code are correctly integrated and available for the app.

    The card states that Gradle's role is to "manage these 'build dependencies' to ensure they are correctly included and built into the final application" and is responsible for "finding them, integrating them, and assembling the final product." While Gradle orchestrates the compilation (Option D), its core function regarding dependencies is their integration.

    Read the full bite: Adding Build Dependencies with Gradle in Android

  10. Question 10 of 30

    According to the mental model described, how do Android build types and product flavors combine to form a build variant?

    Show the answer

    Answer: a · They are combined as a cross-product, where every build type-flavor pair yields a unique variant.

    The card states that a build variant is the result of a 'cross-product' and uses the analogy of a 'grid' where build types and product flavors combine to form each unique variant. This means every possible combination of a build type and a product flavor creates a distinct build variant.

    Read the full bite: Android Build Variants: One Codebase, Many Apps

  11. Question 11 of 30

    In the Android Debug Bridge (ADB) architecture, which component is responsible for executing commands directly on the target Android device?

    Show the answer

    Answer: c · The ADB daemon (adbd), which runs on the device and processes commands

    The card states that the 'daemon' (adbd) runs on the Android device and is responsible for executing commands. The client and server components operate on the development machine, handling command initiation and communication management, respectively.

    Read the full bite: Android Debug Bridge (ADB): A Developer's Remote Control

  12. Question 12 of 30

    Which scenario is best suited for implementation using an Android Foreground Service?

    Show the answer

    Answer: d · Providing continuous music playback and controls while the user interacts with other apps.

    The card explicitly states that Foreground Services are for tasks like playing audio, which require continuous operation and user awareness even when the app is not in the foreground. The other scenarios describe deferrable background work that should be handled by WorkManager for better system resource management and to avoid app termination.

    Read the full bite: Android Services: Running Work Without a UI

  13. Question 13 of 30

    What fundamental problem does an Android ContentProvider primarily address in app development?

    Show the answer

    Answer: c · Enabling secure and structured data exchange between separate Android applications.

    ContentProviders were designed to allow structured data sharing between applications, overcoming Android's security sandbox which prevents direct access. They are not intended for simplifying internal data management or consuming external web services, nor do they bypass the sandbox but rather provide a controlled mechanism within it.

    Read the full bite: ContentProvider: Android's Shared Data API

  14. Question 14 of 30

    When is an Android ViewModel typically cleared from memory and its data discarded?

    Show the answer

    Answer: d · When the user navigates back from the screen or the owning UI component is permanently finished.

    The card states that a ViewModel is "only cleared from memory when its owner (the Activity or Fragment) is permanently destroyed, for example, when the user navigates back or the app is closed." Option C describes a configuration change, which is the primary scenario where a ViewModel is retained, not cleared, to preserve data.

    Read the full bite: Android ViewModel: Survive Screen Rotations

  15. Question 15 of 30

    When would using LiveData be an inappropriate choice for handling data updates?

    Show the answer

    Answer: d · When implementing platform-agnostic business logic in data or domain layers.

    The card explicitly states that LiveData is tied to the Android framework and is not ideal for platform-agnostic business logic in data or domain layers, suggesting Kotlin Flows instead. The other options describe scenarios where LiveData is recommended or performs effectively.

    Read the full bite: LiveData: Lifecycle-Aware Data Observation

  16. Question 16 of 30

    When a user taps a link in your app, launching an external browser, what is the expected behavior upon pressing the back button from the browser?

    Show the answer

    Answer: b · The user returns to your app, as the browser typically runs in its own distinct task.

    The card's canonical example explicitly states that launching an external app like a browser typically creates a new, separate Task. When the user presses the back button from this new task, they are returned to the original app's task. Option A is incorrect because while the browser has its own back stack, the primary action when returning from a separate task is to go back to the originating task.

    Read the full bite: Android's Task and Back Stack Explained

  17. Question 17 of 30

    How does an Android ViewModel ensure that UI data persists across a screen rotation?

    Show the answer

    Answer: d · The Android framework retains the ViewModel instance, allowing the new Activity to reconnect to it.

    The card explains that the Android framework acts as a custodian, retaining the ViewModel instance so the new Activity can reconnect to the existing one. Storing a direct reference to an Activity in a ViewModel (option A) is explicitly warned against as it causes memory leaks.

    Read the full bite: ViewModel: Surviving Android Configuration Changes

  18. Question 18 of 30

    What is the primary performance advantage of using ConstraintLayout for complex user interfaces?

    Show the answer

    Answer: b · It enables a flat view hierarchy, which significantly reduces the system's measurement and drawing time.

    The card states ConstraintLayout was created to avoid deep view hierarchies, which are slow for the system to measure and draw, by building complex UIs with a flat hierarchy. Option A describes a benefit, but not the primary performance advantage related to rendering efficiency.

    Read the full bite: ConstraintLayout: Flexible UIs Without Nesting

  19. Question 19 of 30

    What is the primary mechanism RecyclerView uses to efficiently display long, dynamic lists?

    Show the answer

    Answer: a · It recycles view objects that are no longer visible on screen by binding new data to them.

    RecyclerView's core efficiency comes from recycling view objects that scroll off-screen and reusing them for new data items, avoiding the costly creation of new views. Pre-rendering (B) is a different optimization, and creating new views for every item (D) is what RecyclerView aims to avoid.

    Read the full bite: RecyclerView: Efficiently Displaying Dynamic Lists

  20. Question 20 of 30

    For which scenario would an Android Style be the most appropriate solution?

    Show the answer

    Answer: c · Ensuring all instances of a custom button throughout the app share the same padding, font, and color.

    Option C describes applying a consistent look to a specific type of UI element used repeatedly, which is the core purpose of an Android Style. Option D describes a global application-level setting, which is the role of an Android Theme.

    Read the full bite: Android Styles and Themes: UI Consistency at Scale

  21. Question 21 of 30

    Which event directly causes Jetpack Compose to initiate a recomposition for a specific part of the UI?

    Show the answer

    Answer: d · A State object that a Composable function is observing has its value changed.

    Recomposition is automatically triggered when a State object that a composable reads is updated. Developers do not manually call a recompose function; instead, Compose intelligently re-runs only the composables dependent on the changed state, avoiding a full screen refresh.

    Read the full bite: Recomposition: Smart UI Updates in Compose

  22. Question 22 of 30

    What is the primary reason to choose a LazyColumn or LazyRow over a standard Column/Row for displaying a list in Jetpack Compose?

    Show the answer

    Answer: d · To efficiently manage memory and performance by rendering only visible items and recycling composables.

    Lazy layouts are designed to efficiently handle long lists by composing and rendering only the items currently visible on screen, plus a small buffer, and recycling composables. This prevents memory issues and UI freezes that would occur if all items were rendered at once. Option B is incorrect as lazy layouts specifically avoid pre-composing all items.

    Read the full bite: Lazy Layouts: Compose's Answer to Efficient Lists

  23. Question 23 of 30

    A developer wants all Button components in their Compose app to automatically use the correct primary color for both light and dark themes without manual intervention in each button's code. Which aspect of Compose theming primarily enables this?

    Show the answer

    Answer: d · Wrapping the entire UI in a Theme composable that provides a ColorScheme to MaterialTheme.

    The card states that wrapping the UI in a Theme composable allows any component inside to access styles from MaterialTheme, and standard components like Button automatically read from MaterialTheme to style themselves. Option C describes a manual approach within a custom component, which bypasses the automatic, centralized benefit of the core theming system for standard components.

    Read the full bite: Theming in Compose: Style from a Single Source

  24. Question 24 of 30

    What is the fundamental concept guiding screen transitions in Navigation in Compose?

    Show the answer

    Answer: d · Screens are represented as state, and navigation occurs by changing the current route.

    The card explicitly states, "Treat your app's screens like a state machine. Each screen is a composable function identified by a unique string called a 'route'. Navigation is simply the act of changing the current route state." Option C is incorrect because Compose Navigation replaces the fragment-based system.

    Read the full bite: Navigation in Compose

  25. Question 25 of 30

    What is the primary motivation for using interoperability APIs like AndroidView and ComposeView?

    Show the answer

    Answer: c · To facilitate a phased migration of an existing application from the View system to Jetpack Compose.

    The card states these APIs exist to allow for a "gradual, piece-by-piece migration" of existing applications. While performance can be a factor, it's not the primary motivation, and state synchronization is explicitly noted as a "footgun" requiring careful management, not an automatic benefit.

    Read the full bite: Using Android Views in Compose (and Vice Versa)

  26. Question 26 of 30

    What is the primary function of the Repository Pattern in an application's data architecture?

    Show the answer

    Answer: c · To provide a consistent API for data access, abstracting various data sources like network or local storage.

    The Repository Pattern acts as a mediator, providing a unified interface for data operations while abstracting the complexity of fetching data from different sources (like network or database). Option A describes business logic, which the card explicitly states should not be placed in the repository.

    Read the full bite: Repository Pattern: Your App's Single Source of Truth

  27. Question 27 of 30

    Which scenario represents an inappropriate use of Room Type Converters?

    Show the answer

    Answer: d · Serializing a List<CustomObject> into a single String field to manage a one-to-many relationship.

    Type Converters are designed for simple, self-contained data types, not for simulating object relationships like one-to-many. Using them for relationships (as in option D) is explicitly warned against as it breaks database normalization and hinders querying, whereas Room's @Relation annotation is designed for this purpose. Options A, B, and D are all appropriate uses for Type Converters.

    Read the full bite: Room Type Converters: Teach Your Database New Tricks

  28. Question 28 of 30

    When is it crucial to implement a Room database migration?

    Show the answer

    Answer: c · When an app update introduces schema changes for users with existing data.

    The card explicitly states that migrations are used "every time you change the database schema for an app that is in production" to prevent crashes and preserve user data. In early development, the card suggests using `fallbackToDestructiveMigration()`, which is not a true migration.

    Read the full bite: Room Database Migrations: Evolving Your Schema Safely

  29. Question 29 of 30

    For which type of data is app-specific storage generally considered an unsuitable choice?

    Show the answer

    Answer: d · User-created documents intended for long-term retention

    App-specific storage is automatically deleted when the app is uninstalled, making it inappropriate for user-created content like documents that users expect to retain. It is designed for app-internal data such as caches, settings, or downloaded offline content.

    Read the full bite: App-Specific Storage: Your App's Private Locker

  30. Question 30 of 30

    Under Android's Scoped Storage, how does an app typically gain access to a user's shared media files, like photos?

    Show the answer

    Answer: b · By using system-provided APIs like the Photo Picker, which grant temporary access via a content URI.

    Scoped Storage mandates the use of system-provided APIs like the Photo Picker or MediaStore to access shared media, granting temporary access via content URIs. Option A describes the deprecated legacy approach, while A is for specialized file manager apps, not typical applications.

    Read the full bite: Scoped Storage: Your App's Private File Cabinet

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.

Get it on Google PlayiPhone app coming soon