Android Certified Application Developer (AND-X01) — Questions and Answers
Question 1: What is the difference between async and launch coroutine builders?
- launch runs on the main thread; async runs in background
- async returns a Deferred with a result; launch returns a Job with no result (Correct answer)
- async is faster than launch
- There is no difference
Correct answer: async returns a Deferred with a result; launch returns a Job with no result
async returns a Deferred<T> that holds a future result accessible via await(), while launch returns a Job with no result.
Question 2: What is the purpose of Espresso in Android testing?
- To unit test ViewModels
- To test database operations
- To write UI instrumentation tests that interact with the app UI (Correct answer)
- To mock network requests
Correct answer: To write UI instrumentation tests that interact with the app UI
Espresso is Google's UI testing framework that allows you to write automated UI tests that interact with and assert the state of your app's UI.
Question 3: Which tool in Android Studio provides a real-time graph of CPU, memory, network, and battery usage for a running app?
- Android Profiler (Correct answer)
- Logcat
- Layout Inspector
- Lint
Correct answer: Android Profiler
Android Profiler provides real-time monitoring of CPU, memory, network, and energy usage directly within Android Studio.
Question 4: Which method is called when the size of a view changes?
- onMeasure
- onSizeChanged (Correct answer)
- onLayout
- onDraw
Correct answer: onSizeChanged
onSizeChanged is called when the size of a view changes, providing the new width, height, and old values.
Question 5: What permission is required for an Android app to access the internet?
- android.permission.ONLINE
- android.permission.NETWORK
- android.permission.ACCESS_NETWORK
- android.permission.INTERNET (Correct answer)
Correct answer: android.permission.INTERNET
The android.permission.INTERNET permission must be declared in AndroidManifest.xml for an app to make network requests.
Question 6: What does the FLAG_SECURE window flag do in Android?
- Encrypts window data
- Locks the screen
- Prevents the screen content from appearing in screenshots and screen recordings (Correct answer)
- Prevents screenshots from being saved
Correct answer: Prevents the screen content from appearing in screenshots and screen recordings
FLAG_SECURE marks an Activity's window as secure, preventing its content from appearing in screenshots, recent apps thumbnails, and screen recordings.
Question 7: What method inflates a layout resource in Android?
- Context.inflate()
- LayoutInflater.inflate()
- Both A and B (Correct answer)
- View.inflate()
Correct answer: Both A and B
Both LayoutInflater.inflate() and View.inflate() can be used to instantiate a layout XML file into its corresponding View objects.
Question 8: Which SQL clause is used in a Room @Query to filter results?
- FILTER
- HAVING
- WHERE (Correct answer)
- CONDITION
Correct answer: WHERE
The WHERE clause in Room SQL queries filters rows that meet a specified condition, just as in standard SQL.
Question 9: Which of the following are indirectDirect Service subclasses?
- RemoteViews Service
- SpellChecker Service
- Recognition Service
- InputMethod Service (Correct answer)
Correct answer: InputMethod Service
The `InputMethodService` is a direct subclass of `Service` in Android, providing the base class for implementing an input method, such as a soft keyboard. While other options like `RemoteViewsService`, `RecognitionService`, and `SpellCheckerService` are also specialized services, `InputMethodService` directly extends `AbstractInputMethodService`, which in turn extends `Service`.
Question 10: What is the purpose of the @RunWith annotation in Android tests?
- To set the test execution order
- To run tests in parallel
- To specify the test runner class used to execute the tests (Correct answer)
- To define test suite membership
Correct answer: To specify the test runner class used to execute the tests
@RunWith specifies the test runner (e.g., AndroidJUnit4) that JUnit should use to run the test class.
Question 11: Where are Android unit tests located in a project structure?
- src/main/test
- src/androidTest/java
- test/unit/java
- src/test/java (Correct answer)
Correct answer: src/test/java
Unit tests are placed in the src/test/java directory and run locally on the JVM without Android framework dependencies.
Question 12: Which DataStore type stores typed objects using Protocol Buffers?
- Object DataStore
- Proto DataStore (Correct answer)
- Typed DataStore
- Preferences DataStore
Correct answer: Proto DataStore
Proto DataStore stores data as typed Protocol Buffer objects, providing type safety and avoiding string keys used in Preferences DataStore.
Question 13: What is the principle of least privilege in Android development?
- Giving users the least access to app features
- Using the lowest API level possible
- Requesting only the permissions absolutely necessary for the app to function (Correct answer)
- Running the app with minimal system resources
Correct answer: Requesting only the permissions absolutely necessary for the app to function
The principle of least privilege means declaring only the minimum required permissions to reduce the attack surface and potential harm if the app is compromised.
Question 14: What return type should a Room DAO method use to observe database changes reactively?
- Flow<T>
- Observable<T>
- Both A and B (Correct answer)
- LiveData<T>
Correct answer: Both A and B
Room supports both Flow<T> and LiveData<T> as return types for DAO queries, enabling reactive observation of database changes.
Question 15: When using Room database, what should you avoid doing on the main thread to prevent ANR errors?
- Annotating entity classes
- Using LiveData return types
- Running database queries synchronously (Correct answer)
- Defining DAO interfaces
Correct answer: Running database queries synchronously
Room by default throws an exception if database queries are run on the main thread; they should be executed on a background thread (e.g., using coroutines or LiveData) to prevent blocking the UI.
Question 16: Which storage option is most appropriate for saving a small set of key-value user settings, such as a dark-mode flag?
- ContentProvider
- DataStore (or SharedPreferences) (Correct answer)
- External storage text file
- Room database with a settings table
Correct answer: DataStore (or SharedPreferences)
DataStore, the modern replacement for SharedPreferences, is designed for small key-value or typed settings data.
Question 17: Which Room annotation is used to define data access methods?
- @Repository
- @Query
- @Dao (Correct answer)
- @Database
Correct answer: @Dao
@Dao marks an interface or abstract class as a Data Access Object, which contains methods for interacting with the database.
Question 18: In Jetpack Compose, what does the 'remember' function do?
- Saves state during configuration changes only
- Stores a value in SharedPreferences
- Caches a value across recompositions of the same composable (Correct answer)
- Persists a value across process death
Correct answer: Caches a value across recompositions of the same composable
remember keeps a value in the composition so it is not recalculated on every recomposition, though it is lost on configuration change unless rememberSaveable is used.
Question 19: Which protection level requires the user to explicitly grant a permission at runtime?
- normal
- signature
- privileged
- dangerous (Correct answer)
Correct answer: dangerous
Permissions with protection level 'dangerous' require explicit user approval at runtime because they access sensitive data or device features.
Question 20: Which Jetpack library provides built-in support for pagination, loading large data sets from a data source in chunks to improve performance?
- WorkManager
- DataStore
- Navigation
- Paging 3 (Correct answer)
Correct answer: Paging 3
The Paging 3 library handles loading data in pages from network or database sources, integrating with RecyclerView and LiveData/Flow to display large datasets efficiently.
Question 21: What is the main benefit of using ConstraintLayout over nested LinearLayouts or RelativeLayouts?
- It removes the need for ViewHolders in RecyclerView
- It automatically caches view positions
- It supports hardware acceleration by default
- It flattens the view hierarchy, reducing measure/layout passes (Correct answer)
Correct answer: It flattens the view hierarchy, reducing measure/layout passes
ConstraintLayout expresses complex layouts in a single flat hierarchy, avoiding nested layouts that require multiple measure/layout passes and hurt rendering performance.
Question 22: What does the LiveData class guarantee that a plain observable does not?
- Updates are delivered on a background thread
- Lifecycle-aware delivery, so observers only receive updates while active (Correct answer)
- Values are persisted across reboots
- Observers are notified even after onDestroy()
Correct answer: Lifecycle-aware delivery, so observers only receive updates while active
LiveData respects the observer's lifecycle, delivering data only to started or resumed components and auto-removing destroyed ones.
Question 23: Which Android image format is preferred for app assets because it offers superior lossless and lossy compression compared to PNG and JPEG?
- BMP
- WebP (Correct answer)
- SVG
- TIFF
Correct answer: WebP
WebP provides significantly better compression than PNG (lossless) and JPEG (lossy) at comparable quality, reducing APK size and runtime memory usage.
Question 24: Which of the following components an Intent doesn't activate?
- Broadcast Receiver
- Content Provider (Correct answer)
- Activity
- Services
Correct answer: Content Provider
Intents are messaging objects used to request an action from other application components, such as starting an Activity, a Service, or delivering a Broadcast. Content Providers, however, are activated and accessed differently; they are queried, inserted, updated, or deleted using a `ContentResolver` object, which interacts with the provider via URIs.
Question 25: Which Android feature prevents apps from running unsigned or tampered code?
- APK Signature Verification (Correct answer)
- Android Verified Boot
- SafetyNet
- ProGuard
Correct answer: APK Signature Verification
APK Signature Verification ensures that apps are signed with a trusted key and have not been tampered with since signing.
Question 26: What is the purpose of declaring permissions in AndroidManifest.xml?
- To encrypt app data
- To declare what capabilities or data access the app requires (Correct answer)
- To restrict other apps from running
- To hide the app from unauthorized users
Correct answer: To declare what capabilities or data access the app requires
Declaring permissions in the manifest tells the Android system and users what sensitive resources or data the app needs access to.
Question 27: What happens to data in getCacheDir() when the device runs low on storage?
- Nothing happens
- The app crashes
- The system may delete cache files automatically (Correct answer)
- The data is moved to external storage
Correct answer: The system may delete cache files automatically
Files in the cache directory may be deleted by the system when storage is low, so apps should not rely on them for critical data.
Question 28: What is a coroutine in Kotlin?
- A type of Android Service
- A background thread
- A lightweight concurrency primitive that can suspend and resume execution (Correct answer)
- A database transaction
Correct answer: A lightweight concurrency primitive that can suspend and resume execution
Kotlin coroutines are lightweight concurrency primitives that allow you to write asynchronous, non-blocking code in a sequential style.
Question 29: What is the purpose of SharedPreferences in Android?
- To store large files
- To share data between apps
- To store small amounts of primitive key-value data persistently (Correct answer)
- To manage user accounts
Correct answer: To store small amounts of primitive key-value data persistently
SharedPreferences provides a mechanism for storing and retrieving small amounts of primitive data as key-value pairs that persist across app sessions.
Question 30: Which Room annotation defines a foreign key relationship between two entities?
- @Join
- @Reference
- @ForeignKey inside @Entity (Correct answer)
- @Relation
Correct answer: @ForeignKey inside @Entity
The @ForeignKey annotation within @Entity defines referential integrity constraints between two Room database tables.
Question 31: What is the purpose of the EncryptedSharedPreferences in Android?
- To encrypt both keys and values stored in SharedPreferences (Correct answer)
- To store encrypted database credentials
- To share encrypted files between apps
- To encrypt network traffic
Correct answer: To encrypt both keys and values stored in SharedPreferences
EncryptedSharedPreferences from Jetpack Security encrypts both the keys and values using AES-256, protecting sensitive preference data at rest.
Question 32: How do you perform a database migration in Room when the schema changes?
- By deleting and recreating the database
- Room handles migrations automatically
- By using @SchemaVersion annotation
- By providing a Migration object with SQL migration scripts (Correct answer)
Correct answer: By providing a Migration object with SQL migration scripts
Room requires you to provide a Migration object containing the SQL statements needed to transform the old schema to the new one.
Question 33: What is the purpose of the android:exported attribute in AndroidManifest.xml?
- To share resources with other apps
- To export app data to external storage
- To enable debug mode
- To control whether other apps can access the component (Correct answer)
Correct answer: To control whether other apps can access the component
android:exported=false prevents other apps from starting or interacting with your Activity, Service, or BroadcastReceiver.
Question 34: Which method is used to get or create an instance of a Room database?
- Room.databaseBuilder() (Correct answer)
- Room.getInstance()
- RoomDatabase.build()
- RoomDatabase.create()
Correct answer: Room.databaseBuilder()
Room.databaseBuilder() creates or opens a Room database with the specified context, class, and database name.
Question 35: What does OkHttp's connection pooling feature do?
- Pools database connections
- Manages thread pools for async calls
- Caches DNS lookups
- Reuses existing HTTP connections to reduce latency (Correct answer)
Correct answer: Reuses existing HTTP connections to reduce latency
OkHttp's connection pool keeps HTTP connections alive and reuses them for subsequent requests, reducing the overhead of establishing new connections.
Question 36: What does the term 'memory leak' mean in Android development?
- An object is kept in memory longer than its intended lifecycle (Correct answer)
- The GPU runs out of texture memory
- The app writes too much data to disk
- The app uses too much network bandwidth
Correct answer: An object is kept in memory longer than its intended lifecycle
A memory leak occurs when references prevent the garbage collector from reclaiming objects whose lifecycle has ended, such as an Activity referenced by a static field.
Question 37: What is the recommended way to load large bitmaps efficiently to avoid OutOfMemoryError in Android?
- Load the full bitmap and then scale it in an ImageView
- Convert all images to PNG format
- Increase the app's heap size in the manifest
- Use BitmapFactory.Options to subsample the bitmap before decoding (Correct answer)
Correct answer: Use BitmapFactory.Options to subsample the bitmap before decoding
Setting BitmapFactory.Options.inSampleSize decodes a subsampled version of the bitmap, reducing memory usage significantly before the bitmap is loaded into memory.
Question 38: Which library is used for mocking dependencies in Android unit tests?
- JUnit
- Espresso
- Robolectric
- Mockito (Correct answer)
Correct answer: Mockito
Mockito is a popular mocking framework that creates fake implementations of dependencies, allowing you to isolate the code under test.
Question 39: Which of the following kernels is used by Android?
- Hybrid kernel
- MAC kernel
- Linux kernel (Correct answer)
- Windows kernel
Correct answer: Linux kernel
Android is built upon the robust foundation of the Linux kernel. The Linux kernel provides essential low-level system services such as memory management, process management, networking, and hardware device drivers. This choice leverages Linux's stability, security, and open-source nature, forming the core of the Android operating system.
Question 40: What is the primary cause of 'jank' (dropped frames) in Android applications?
- Excessive network calls
- UI thread work taking longer than 16ms per frame (Correct answer)
- Large APK size
- Too many background threads
Correct answer: UI thread work taking longer than 16ms per frame
Android targets 60fps, giving each frame 16ms; if the UI thread takes longer than that for a frame, the frame is dropped, causing jank.
Question 41: Why does ViewModel survive configuration changes such as screen rotation?
- It runs in a separate process
- The system prevents rotation while a ViewModel exists
- It is serialized to disk automatically
- It is retained in a ViewModelStore that outlives the Activity recreation (Correct answer)
Correct answer: It is retained in a ViewModelStore that outlives the Activity recreation
The ViewModelStore is kept across configuration changes, so the same ViewModel instance is handed to the recreated Activity.
Question 42: Which Jetpack component is the recommended replacement for SharedPreferences?
- WorkManager
- Room
- LiveData
- DataStore (Correct answer)
Correct answer: DataStore
Jetpack DataStore is the recommended replacement for SharedPreferences, offering asynchronous, consistent, and transactional data storage.
Question 43: What is the purpose of BiometricPrompt in Android?
- To authenticate users using fingerprint, face, or device credentials (Correct answer)
- To show a fingerprint scanner UI
- To register new biometric templates
- To encrypt biometric data
Correct answer: To authenticate users using fingerprint, face, or device credentials
BiometricPrompt provides a standardized API for authenticating users with biometrics or device credentials like PIN/password.
Question 44: What HTTP status code indicates a successful response?
- 404
- 301
- 200 (Correct answer)
- 500
Correct answer: 200
HTTP status code 200 (OK) indicates the request was successful and the server returned the expected response.
Question 45: What is 'baseline profiles' in Android, and what is their primary benefit?
- GPU shader caches bundled with the APK
- A set of user permissions required at install time
- Memory allocation profiles stored per-user
- Pre-compiled bytecode rules that speed up app startup and frame rendering (Correct answer)
Correct answer: Pre-compiled bytecode rules that speed up app startup and frame rendering
Baseline Profiles provide pre-compilation hints that let ART ahead-of-time compile critical code paths, significantly improving startup time and reducing jank during early app use.
Android Certified Application Developer (AND-X01)
The AndroidATC AND-X01 certification validates skills in Android application development including core Android APIs, UI design, data storage, security, performance optimization, background processing, and testing.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds