AAD Sample Questions & Answers
Activity lifecycles, layouts, custom views, and accessibility carry the most weight, alongside Android's system architecture, messaging, and background work, Room database and LiveData, Android Studio's debugging features, and testing through unit and UI approaches.
Launch the full AAD simulator →Showing 10 of 20 free samples.
- Question 1Advanced
User Interface · Jetpack Compose Migration
Company Background:
FitLifeis a fitness tracking company modernizing its Android application. The current app was built five years ago using XML layouts and the traditional View system. The UI is inconsistent, slow to render complex screens, and difficult to maintain due to deeply nestedLinearLayoutsandRelativeLayoutsinside aScrollView.Current Situation:
The main dashboard screen is particularly problematic. It displays user stats, a list of recent workouts, and daily challenges. All this data comes from aDashboardViewModelwhich exposes severalLiveDataobjects. The XML for this screen is over 800 lines long.Requirements:
The CTO has mandated a full migration of the dashboard screen to Jetpack Compose to improve performance and maintainability. The new implementation must:- Be built entirely with declarative UI components.
- Observe the existing
LiveDataobjects from theDashboardViewModelin a lifecycle-aware manner. - Replace the
RecyclerViewfor recent workouts with a lazy-loading list in Compose. - Ensure the new UI is themable and supports Material 3 design principles.
Which of the following approaches is the most effective and idiomatic way to implement the new Jetpack Compose dashboard screen based on the requirements?
flowchart TD subgraph ViewModel A[LiveData ] B[LiveData >] C[LiveData ] end subgraph Compose UI D{DashboardScreen} E[StatsCard] F[WorkoutList] G[ChallengeBanner] end ViewModel --> D D --> E D --> F D --> GShow answer & explanation
Correct answer: A
This approach correctly addresses all requirements.
observeAsState()is the idiomatic, lifecycle-aware way to consumeLiveDatain Compose.LazyColumnis the direct replacement forRecyclerViewfor displaying lazy-loading lists. Wrapping the UI inMaterialThemeensures it adheres to the specified design system. This solution is efficient, maintainable, and follows modern Android best practices. - Question 2Beginner
Data Management · DataStore vs SharedPreferences
True or False: Jetpack DataStore is a direct, drop-in replacement for SharedPreferences and uses the same synchronous, file-based I/O API on the main thread.
Show answer & explanation
Correct answer: B
This statement is false. While Jetpack DataStore is the recommended replacement for SharedPreferences, it is fundamentally different. DataStore uses Kotlin Coroutines and Flow for a fully asynchronous API, which prevents blocking the main thread and avoids the risk of ANR (Application Not Responding) errors that can occur with SharedPreferences' synchronous API.
- Question 3Intermediate
Android Core · Foreground Services
On Android 14 (API 34), an app that needs to perform a long-running task like a data sync must declare a foreground service. What is the critical requirement that the app must fulfill when calling
startForeground()for a service related to data synchronization?Show answer & explanation
Correct answer: C
Starting with Android 10, and becoming more stringent in later versions like Android 14, you must declare a specific
foregroundServiceTypein yourAndroidManifest.xmlfor any service that will be started in the foreground. This helps the system understand the purpose of the service and manage resources appropriately. For data synchronization,dataSyncis the correct type. - Question 4Advanced
Testing · Espresso UI Testing
In an Espresso UI test, the app performs a network request that takes an unpredictable amount of time to complete before updating a
TextView. The test intermittently fails with anNoMatchingViewExceptionbecause the assertion runs before theTextViewis updated. What is the most robust and recommended way to make Espresso wait for this asynchronous operation to complete?Show answer & explanation
Correct answer: B
This is the correct and idiomatic Espresso solution. An
IdlingResourceis a mechanism that allows your test code to signal to Espresso when the app is busy with a long-running operation. Espresso will pause the test and wait until the resource becomes idle before proceeding with the next action or assertion, making the test deterministic and reliable. - Question 5Beginner
User Interface · Jetpack Compose Lists
In Jetpack Compose, a developer needs to display a potentially very long, vertically scrolling list of items. To ensure good performance, only the items visible on screen should be composed and rendered. Which composable should be used?
Show answer & explanation
Correct answer: C
LazyColumnis the correct composable for this purpose. It is the Compose equivalent ofRecyclerView. It only composes and lays out the items that are currently visible in the viewport, providing excellent performance for long or infinite lists. - Question 6Advanced
Data Management · Offline-First Architecture
Company Background:
FieldAgentProis an enterprise application used by technicians for on-site job management. A core requirement is robust offline capability, as technicians often work in areas with poor or no internet connectivity. All job data, including customer details, work orders, and inventory parts, must be available offline.Current Situation:
The development team is designing the data layer for the app. They have decided to use Room for local persistence and Retrofit for network communication with the backend API. The architecture must follow the 'single source of truth' principle, where the UI only observes data from the local Room database.Requirements:
- The app must fetch data from the network and store it in the Room database when online.
- When offline, the app must seamlessly serve data from the Room database.
- The UI should be updated automatically whenever the local data changes (either from a network sync or local modification).
- The data layer must abstract the origin of the data (network vs. local) from the ViewModel and UI.
- The design should be efficient, avoiding unnecessary network calls if the local data is fresh.
Which of the following data layer designs best satisfies all requirements for this offline-first application?
erDiagram VIEW_MODEL ||--|{ REPOSITORY : uses REPOSITORY ||--|{ API_SERVICE : fetches_from REPOSITORY ||--|{ ROOM_DAO : accesses API_SERVICE { string type "(Retrofit)" } ROOM_DAO { string type "(Room)" }Show answer & explanation
Correct answer: A
This is the classic and most effective implementation of the Repository pattern for an offline-first app. By having the UI observe a Flow directly from Room, it becomes the single source of truth. The Repository's logic handles the fetching and caching transparently. This design is robust, meets all requirements, and separates concerns cleanly.
- Question 7Advanced
User Interface · Navigation Component Deep Links
To handle a deep link URI such as
https://example.com/products/123, which element must be correctly configured inside thetag in theAndroidManifest.xmlwhen using the Navigation Component?Show answer & explanation
Correct answer: B
This is the correct configuration. To enable implicit deep linking, you need two things: 1) An
with the appropriateaction,category, andtags to capture the URI. 2) Aelement inside thetag that points to your navigation graph. This tells the Activity to delegate deep link handling to the Navigation Component. - Question 8IntermediateSelect 2
User Interface · Jetpack Compose Accessibility
When making a custom Jetpack Compose component accessible, which of the following
semanticsproperties are most important for screen readers like TalkBack to properly describe the component's purpose and state? (Select TWO)Show answer & explanation
Correct answers: A, B
This provides a localized string that describes the element. For non-textual elements like an
IconorImage, this is crucial for TalkBack to announce what the element represents.This provides a description of the component's current state. For example, for a toggleable switch, the
stateDescriptioncould be "On" or "Off", which TalkBack would announce to the user. - Question 9Intermediate
Debugging · Layout Inspector for Compose
A developer is using the Layout Inspector in Android Studio to debug a Jetpack Compose UI. They want to understand why a specific composable is recomposing frequently. Which feature of the Layout Inspector is specifically designed for this purpose?
Show answer & explanation
Correct answer: D
The Layout Inspector has a specific feature to track and display recomposition counts for each composable in real-time. By enabling this, a developer can interact with the app and see exactly which composables are recomposing and which are being skipped, making it the primary tool for diagnosing performance issues related to unnecessary recompositions.
- Question 10Beginner
Testing · JUnit Annotations
To define a test method in a local unit test using JUnit 4, which annotation must be placed directly before the function declaration?
Show answer & explanation
Correct answer: A
The
@Testannotation from theorg.junit.Testpackage is used to mark a public function as a test case that the JUnit test runner should execute.
Ready for the real thing?
The full AAD simulator has every exam-style question, timed mode, and instant scoring.