Skip to content
tezvyn:

Top 30 Easy Android & Kotlin Concepts Quiz for Beginners

30 easy multiple-choice Android & Kotlin concept questions, the vocabulary and first principles, the parts you need before anything else makes sense. They come from 30 bites in the Android & Kotlin library, the gentlest 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

    A developer needs to store a user's current score in a game, which will change throughout gameplay. Which Kotlin keyword should be used?

    Show the answer

    Answer: c · var

    The card states that 'var' should be used for values that need to be reassigned, such as a user's score, while 'val' is for values that remain constant after initial assignment. Choosing 'val' here would lead to a compilation error when trying to update the score.

    Read the full bite: Kotlin Variables: `val` for Constants, `var` for Variables

  2. Question 2 of 30

    What is the main consequence of using the not-null assertion operator (!!) in Kotlin?

    Show the answer

    Answer: b · It tells the compiler to trust that a value is not null, potentially leading to a runtime NullPointerException if it is.

    The not-null assertion operator (!!) bypasses Kotlin's compile-time null safety, forcing the compiler to assume a value is non-null. If the value turns out to be null at runtime, it will result in a NullPointerException, defeating the purpose of Kotlin's null safety. Option A is incorrect because it introduces risk, and options C and D describe the Elvis operator (?:) and safe call operator (?.), respectively.

    Read the full bite: Kotlin Null Safety: Catch Nulls at Compile Time

  3. Question 3 of 30

    What is a mandatory requirement when using an `if` expression to assign a value to a variable in Kotlin?

    Show the answer

    Answer: b · An `else` branch must always be present to cover all possible outcomes.

    When `if` is used as an expression, it must always return a value. To guarantee this, the compiler requires an `else` branch to cover all possible cases. The last line of a branch implicitly becomes its return value, without needing an explicit `return` keyword.

    Read the full bite: Kotlin's Control Flow Expressions: `if` and `when`

  4. Question 4 of 30

    What is the main purpose of using functions in Kotlin?

    Show the answer

    Answer: d · To package reusable logic, preventing code duplication and enhancing structure.

    The card states functions exist "to solve the problem of code repetition and disorganization" by packaging logic into "a single, named block that can be called from anywhere." Option C is incorrect because while good code structure can aid optimization, functions' primary role isn't automatic speed enhancement.

    Read the full bite: Kotlin Functions: Named, Reusable Code Blocks

  5. Question 5 of 30

    Which statement best describes why Dispatchers.Unconfined is generally discouraged for common use cases?

    Show the answer

    Answer: d · Its behavior after a suspending function can lead to unpredictable thread execution.

    Dispatchers.Unconfined is discouraged because it starts on the current thread but can resume on any thread used by a suspending function, leading to unpredictable execution. This is distinct from creating new threads (which is more relevant to newSingleThreadContext) or always running on the main thread.

    Read the full bite: Coroutine Dispatchers: Telling Your Coroutines Which Thread to Use

  6. Question 6 of 30

    What is the primary effect of cancelling a CoroutineScope?

    Show the answer

    Answer: b · All coroutines that were launched within that scope are automatically cancelled.

    The core function of a CoroutineScope is to manage the lifecycle of its child coroutines; thus, cancelling the scope automatically cancels all coroutines launched within it. Option C is incorrect because existing coroutines are also cancelled, not continued, and new launches would fail rather than just being prevented.

    Read the full bite: CoroutineScope: The Parent of Your Coroutines

  7. Question 7 of 30

    What happens if a Kotlin Flow is created but no terminal operator like .collect() is invoked?

    Show the answer

    Answer: b · The Flow's producer code will not execute, and no values will be emitted.

    Flows are 'cold,' meaning their producer code only executes when a terminal operator like .collect() is called. Without a collector, the flow builder block never runs, so no values are emitted. Option C is incorrect because nothing is emitted to be discarded.

    Read the full bite: Kotlin Flow: Asynchronous Data Streams

  8. Question 8 of 30

    What is the main benefit of Android Studio's design for Android app development?

    Show the answer

    Answer: c · It integrates all essential tools like code editing, building, and testing into one platform.

    The card highlights Android Studio as an "all-in-one workshop" and a "single, official, and tightly integrated environment" that combines code editing, building, and testing. The option about a lightweight environment is incorrect as the card explicitly mentions underestimating its resource needs as a "footgun."

    Read the full bite: Android Studio: The Official Workshop for Android Apps

  9. Question 9 of 30

    To properly include a new image asset (like a user avatar) in an Android application, where should it be placed?

    Show the answer

    Answer: c · Within a designated subfolder, such as drawable, inside the res directory.

    The 'res' folder is specifically designed for non-code resources like images, with 'drawable' being the correct subfolder for image assets. Placing it in the 'java' or 'kotlin' folder is incorrect because those are reserved for source code, keeping resources and logic separate.

    Read the full bite: Android Project Structure: Your App's Filing Cabinet

  10. Question 10 of 30

    What is the most likely outcome if a new Activity class is implemented but not declared in AndroidManifest.xml?

    Show the answer

    Answer: d · The app will crash with an ActivityNotFoundException when attempting to launch the Activity.

    The card states that forgetting an Activity declaration will cause the app to crash with an ActivityNotFoundException when launched, as the OS doesn't recognize it. The app will compile successfully without the declaration, making compilation failure (Option B) incorrect.

    Read the full bite: AndroidManifest.xml: The Blueprint for Your App

  11. Question 11 of 30

    What is the main benefit of developing an Android app using Kotlin or Java with the official SDK?

    Show the answer

    Answer: b · It provides the most direct and complete access to all native Android system APIs.

    The card states that using the official stack (Kotlin, Java, C++) "provides the most direct access to the full range of Android APIs." Option A is incorrect because Kotlin and Java are JVM languages and their code runs within the JVM environment, not without it.

    Read the full bite: Android App Development: Core Languages and Tools

  12. Question 12 of 30

    Which of the following scenarios is an appropriate use for Android's Logcat tool?

    Show the answer

    Answer: a · Debugging an app crash by viewing its stack trace in real-time.

    The card explicitly states that Logcat is used 'to see stack traces when your app crashes' and is your 'primary debugging partner.' It also warns against using Logcat for 'production analytics,' 'to store persistent data,' or to log 'sensitive user information' due to security risks and buffer limitations.

    Read the full bite: Logcat: The `tail -f` for Android Apps

  13. Question 13 of 30

    Which scenario best describes the appropriate use of an Android Activity?

    Show the answer

    Answer: c · Representing a distinct, full-screen user interface, like a login page or a settings screen.

    An Activity is designed to represent a single, distinct screen or a major entry point in an application, as described in the card. Displaying minor UI changes (option A) is explicitly mentioned as a scenario where an Activity should not be used, while options B and D describe the roles of other Android components like Services or Fragments/Views.

    Read the full bite: Android Activity: A Single Screen in Your App

  14. Question 14 of 30

    Which scenario best demonstrates the appropriate use of an Android Intent?

    Show the answer

    Answer: d · Requesting another application to display a specific web page.

    The card states Intents are used to "ask other apps to open a URL," which is a classic example of an implicit intent requesting an action from another component. Intents are not suitable for large data transfer or synchronous communication within a single component.

    Read the full bite: Android Intents: The App's Messaging System

  15. Question 15 of 30

    What is the primary reason Android employs an Activity Lifecycle?

    Show the answer

    Answer: d · To provide a predictable mechanism for apps to manage resources and state during system-level interruptions.

    The Activity Lifecycle exists to provide a predictable contract for apps to manage their state and resources, especially when the OS needs to reclaim memory by terminating background apps. Option D directly reflects this purpose. Option A is incorrect because the OS can and does terminate background applications; the lifecycle helps apps gracefully handle this.

    Read the full bite: Android's Activity Lifecycle: A Screen's Journey

  16. Question 16 of 30

    What is the most critical consequence of performing a long-running operation directly within a Broadcast Receiver's onReceive() method?

    Show the answer

    Answer: d · The system may terminate the Broadcast Receiver and its host process due to exceeding execution time limits.

    The card explicitly states that the onReceive() method has a very short execution window (around 10 seconds) before the system may kill it. While running on the main thread can cause UI freezes (option C), the primary and more severe risk emphasized for Broadcast Receivers is system termination due to exceeding this strict time limit.

    Read the full bite: Broadcast Receiver: Responding to System-Wide Events

  17. Question 17 of 30

    When designing an Android UI using the traditional View system, which practice is explicitly identified as a common performance pitfall?

    Show the answer

    Answer: b · Creating an excessively deep hierarchy of nested ViewGroups.

    The card explicitly states that "The common footgun is creating deeply nested ViewGroups, which slows down rendering performance." While having many children (Option D) can impact performance, the card specifically identifies deep nesting of ViewGroups as the primary "common footgun" for performance degradation.

    Read the full bite: View and ViewGroup: The Building Blocks of Android UI

  18. Question 18 of 30

    What is the primary consequence of performing a long-running network request directly within an Android UI event listener's callback method?

    Show the answer

    Answer: c · The user interface will become unresponsive, potentially leading to an Application Not Responding (ANR) error.

    The card states that putting heavy, long-running tasks directly in a listener's callback blocks the main UI thread, causing the app to freeze and potentially an ANR error. The Android system does not automatically offload such tasks; developers must use concurrency tools.

    Read the full bite: Handling Android UI Events: Listeners and Callbacks

  19. Question 19 of 30

    Which of the following is a critical guideline for writing Composable functions to ensure optimal performance?

    Show the answer

    Answer: d · Avoid placing expensive operations like network requests or heavy computations directly inside them.

    The card explicitly states that heavy computations or side-effects like network requests should not be placed directly inside composables because their frequent recomposition can cause severe performance issues. Option C is incorrect because business logic and heavy operations should be handled outside the composable to maintain UI responsiveness.

    Read the full bite: Composable Functions: Building UI with Kotlin Functions

  20. Question 20 of 30

    What is identified as the biggest mistake when building UIs with Compose layouts?

    Show the answer

    Answer: b · Failing to analyze the design and break it into reusable components before coding.

    The card explicitly states, "The biggest mistake is failing to analyze the design first. If you don't break the UI down into a hierarchy of smaller, reusable composables, you will end up with a monolithic, hard-to-manage function." Option A, while potentially leading to less efficient code in some cases, is not framed as the primary architectural pitfall.

    Read the full bite: Compose Layouts: Build UI by Describing It

  21. Question 21 of 30

    For which purpose should you typically avoid using a Modifier in Jetpack Compose?

    Show the answer

    Answer: d · Defining the text content displayed by a Text composable.

    The card states, "Do not use Modifiers to pass essential data that defines a Composable's content. For instance, the string for a Text composable... are passed as direct parameters, not through a Modifier." The other options are all common and appropriate uses for Modifiers.

    Read the full bite: Jetpack Compose Modifiers: Styling Your UI

  22. Question 22 of 30

    What is the primary advantage of employing "state hoisting" in Jetpack Compose?

    Show the answer

    Answer: d · It makes composables more reusable and testable by centralizing state management in parent components.

    State hoisting makes composables stateless, reusable, and easier to test because their behavior is controlled externally by a parent. Option C describes the opposite, where a composable manages its own state, which makes it less reusable and harder to test.

    Read the full bite: State in Jetpack Compose: The UI's Memory

  23. Question 23 of 30

    Which statement best describes the primary function of Android's UI layer?

    Show the answer

    Answer: c · To display application data to the user and forward user interactions to underlying logic.

    The UI layer's primary role is to display data to the user and send user input to the ViewModel for processing by other layers. It does not handle data fetching, storage, or complex business logic itself, which are responsibilities of the data and domain layers.

    Read the full bite: Android's UI Layer: Displaying Data, Handling Events

  24. Question 24 of 30

    What is the fundamental purpose of a Room Entity in an Android application?

    Show the answer

    Answer: d · To define the schema for a local SQLite database table.

    The card states that a Room Entity is a blueprint for a database table, defining its structure and columns, which is equivalent to defining its schema. Options A and D describe scenarios where Room Entities should not be used, as they are for temporary state or simple key-value pairs, respectively. Option A is unrelated to Room's function of local data persistence.

    Read the full bite: Room Entity: Your Database Table as a Kotlin Class

  25. Question 25 of 30

    According to the card, which of the following operations is explicitly stated as not belonging within a Room Data Access Object (DAO)?

    Show the answer

    Answer: a · Implementing business logic that transforms data or combines it from multiple sources.

    The card explicitly states, "Do not place business logic, data transformations, or logic for combining data from multiple sources (like a network call and the database) inside a DAO." Options A and B describe core functions of a DAO. Option D is handled automatically by Room, not implemented by the developer within the DAO.

    Read the full bite: Room DAO: Your App's Type-Safe SQL Interface

  26. Question 26 of 30

    Which of the following best describes a key benefit of using Room for local data storage in Android?

    Show the answer

    Answer: a · It provides an abstraction layer that allows developers to work with Kotlin/Java objects instead of raw SQL, with compile-time query validation.

    Room's primary benefit is acting as an abstraction layer over SQLite, allowing developers to interact with data using Kotlin/Java objects instead of raw SQL, which also provides crucial compile-time validation for database operations. The card explicitly states Room is not for simple key-value pairs (B) or remote synchronization (C), and its benefit is to avoid raw SQL strings, not just enhance their runtime reporting (D).

    Read the full bite: Room Database: SQL Made Simple on Android

  27. Question 27 of 30

    Which of the following best describes a key advantage of Preferences DataStore compared to SharedPreferences?

    Show the answer

    Answer: a · It provides a reactive stream of data, ensuring UI updates automatically when settings change.

    Preferences DataStore exposes data as a Kotlin Flow, allowing applications to react to data changes automatically and asynchronously, which prevents UI freezes. SharedPreferences, in contrast, allowed synchronous I/O on the main thread, which often led to ANRs.

    Read the full bite: Preferences DataStore: The Safe SharedPreferences

  28. Question 28 of 30

    What is the fundamental role of REST in web API design?

    Show the answer

    Answer: c · To provide a standardized architectural style for client-server communication using HTTP.

    The card defines REST as an "architectural style" that standardizes communication using existing HTTP methods, not a new protocol. Options C and D describe functionalities better suited for WebSockets and GraphQL, respectively, which the card mentions as alternatives to REST for specific use cases.

    Read the full bite: REST: The Architectural Style for Web APIs

  29. Question 29 of 30

    What is the primary advantage Retrofit offers when integrating an HTTP API into an Android application?

    Show the answer

    Answer: b · It simplifies API interaction by eliminating boilerplate for request construction and response parsing.

    The card states Retrofit was created to automate tedious and error-prone tasks like URL encoding, request bodies, headers, and response parsing, which are all boilerplate. Option D is incorrect because the card explicitly warns about the 'footgun' of forgetting to run calls off the main thread, indicating Retrofit does not automatically manage threading.

    Read the full bite: Retrofit: Turn Your HTTP API into an Interface

  30. Question 30 of 30

    What is a key characteristic that distinguishes Kotlinx.serialization from reflection-based serialization libraries?

    Show the answer

    Answer: b · It generates type-safe serialization code during compilation, avoiding runtime reflection.

    Kotlinx.serialization uses a compiler plugin to generate conversion logic at compile time, making it type-safe and performant without relying on runtime reflection. The most tempting distractor suggests it uses reflection, which is precisely what it aims to avoid.

    Read the full bite: Kotlinx.serialization: Kotlin's Native Data Converter

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