Android Certified Application Developer (AND-X01) — Questions and Answers
Question 1: What is the purpose of Android App Bundles (.aab) compared to traditional APKs?
- They combine multiple apps into a single download
- They let Google Play deliver only the resources and code needed for a specific device (Correct answer)
- They allow apps to run without installation
- They enable apps to be distributed outside the Play Store
Correct answer: They let Google Play deliver only the resources and code needed for a specific device
App Bundles enable Dynamic Delivery, where Google Play generates and serves optimized APKs containing only the resources and code needed for each specific device configuration.
Question 2: 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 3: Which approach minimizes object allocation in performance-critical Android code to reduce garbage collection pauses?
- Always use ArrayList over arrays
- Increase the app's maximum heap size
- Use StringBuilder instead of String concatenation in tight loops (Correct answer)
- Disable hardware acceleration for frequently-redrawn views
Correct answer: Use StringBuilder instead of String concatenation in tight loops
String concatenation with + in a loop creates many intermediate String objects; StringBuilder reuses its internal buffer, reducing GC pressure in tight loops.
Question 4: 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 5: Which library is commonly used for type-safe HTTP client calls in Android?
- Retrofit (Correct answer)
- HttpURLConnection
- OkHttp
- Volley
Correct answer: Retrofit
Retrofit turns HTTP API calls into Kotlin/Java interfaces with annotations, providing type-safe REST client functionality.
Question 6: What is the purpose of the RecyclerView.RecycledViewPool in Android?
- To persist scroll position across configuration changes
- To cache network responses for list items
- To share recycled ViewHolders across multiple RecyclerViews (Correct answer)
- To limit the number of views that can be inflated
Correct answer: To share recycled ViewHolders across multiple RecyclerViews
RecycledViewPool allows multiple RecyclerViews to share a pool of recycled ViewHolders, reducing view inflation overhead when displaying similar list content.
Question 7: Which lifecycle callback is invoked when an Activity is partially obscured by a dialog-themed Activity but still visible?
- onDestroy()
- onStop()
- onSaveInstanceState() only
- onPause() (Correct answer)
Correct answer: onPause()
onPause() fires when the Activity loses focus but remains partially visible, while onStop() only fires when fully hidden.
Question 8: What does not have any UI components and runs in the background?
- Services (Correct answer)
- Intents
- Content Providers
- Applications
Correct answer: Services
A Service is an application component that can perform long-running operations in the background without providing a user interface. Services can continue to run even if the user switches to another application, making them suitable for tasks like playing music, performing network operations, or syncing data in the background.
Question 9: Which mode in Android can developers enable to detect accidental disk or network access on the main thread?
- Debug mode
- ART mode
- StrictMode (Correct answer)
- ProGuard mode
Correct answer: StrictMode
StrictMode detects and reports violations such as disk reads/writes and network calls on the main thread, helping developers catch performance mistakes early.
Question 10: Which Android API checks whether a runtime permission has been granted?
- ContextCompat.checkSelfPermission() (Correct answer)
- Permission.isGranted()
- ActivityCompat.requestPermissions()
- PackageManager.hasPermission()
Correct answer: ContextCompat.checkSelfPermission()
ContextCompat.checkSelfPermission() returns PERMISSION_GRANTED or PERMISSION_DENIED to indicate whether the app has a specific runtime permission.
Question 11: When using Room database, what should you avoid doing on the main thread to prevent ANR errors?
- Annotating entity classes
- Running database queries synchronously (Correct answer)
- Using LiveData return types
- 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 12: What is the purpose of the ContentProvider in Android?
- To share data between apps using a standard interface (Correct answer)
- To manage local SQLite databases
- To sync data with a server
- To provide UI content
Correct answer: To share data between apps using a standard interface
ContentProvider allows an app to expose its data to other apps through a standardized URI-based interface.
Question 13: What is a Flow in Kotlin coroutines?
- An asynchronous stream of values that can be collected over time (Correct answer)
- A type of coroutine dispatcher
- A network stream
- A database cursor
Correct answer: An asynchronous stream of values that can be collected over time
Kotlin Flow is a cold asynchronous stream that sequentially emits multiple values over time, built on top of coroutines.
Question 14: Which class is used to encrypt data using the Android Keystore in modern Android?
- KeyGenerator
- SecretKeyFactory
- Cipher (Correct answer)
- EncryptionManager
Correct answer: Cipher
The Cipher class from javax.crypto is initialized with keys from the Android Keystore to perform encryption and decryption operations.
Question 15: What does the suspend keyword do to a Kotlin function?
- Delays its execution
- Marks it as a suspending function that can be paused and resumed (Correct answer)
- Makes it run on a background thread
- Pauses the function permanently
Correct answer: Marks it as a suspending function that can be paused and resumed
The suspend keyword marks a function as a coroutine that can suspend its execution without blocking the calling thread.
Question 16: How do you perform a database migration in Room when the schema changes?
- By providing a Migration object with SQL migration scripts (Correct answer)
- By using @SchemaVersion annotation
- By deleting and recreating the database
- Room handles migrations automatically
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 17: Which testing framework is used for writing unit tests in Android projects?
- JUnit (Correct answer)
- Espresso
- Mockito
- Robolectric
Correct answer: JUnit
JUnit is the standard testing framework for writing and running unit tests in Android and Java/Kotlin projects.
Question 18: What annotation marks a class as a Room database entity?
- @Table
- @DatabaseObject
- @Model
- @Entity (Correct answer)
Correct answer: @Entity
The @Entity annotation marks a Kotlin or Java class as a Room database table, with each field mapping to a column.
Question 19: After being installed on a device, each Android program is stored in a _______ .
- Binder (Correct answer)
- None of the above
- Messenger
- AIDL
Correct answer: Binder
After installation, each Android application runs in its own process, and inter-process communication (IPC) between these processes is facilitated by the Binder mechanism. The Binder is a high-performance IPC system that allows components from different applications to communicate securely and efficiently. It enables services to be called across process boundaries.
Question 20: What is the main benefit of using ConstraintLayout over nested LinearLayouts or RelativeLayouts?
- It flattens the view hierarchy, reducing measure/layout passes (Correct answer)
- It removes the need for ViewHolders in RecyclerView
- It supports hardware acceleration by default
- It automatically caches view positions
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 21: In Android, which of the following are the screen sizes?
- Extralarge
- Large
- All of the above (Correct answer)
- Small
Correct answer: All of the above
Android supports a variety of screen sizes to accommodate the diverse range of devices available in the market. These categories include small, normal, large, and extra-large. Developers design their layouts to be flexible and responsive, ensuring a consistent and optimal user experience across all these different screen dimensions.
Question 22: What is SQL injection and how does Room protect against it?
- Room encrypts all queries
- Room validates input length
- Room uses parameterized queries with placeholders that prevent user input from being interpreted as SQL (Correct answer)
- Room uses stored procedures
Correct answer: Room uses parameterized queries with placeholders that prevent user input from being interpreted as SQL
Room's @Query annotation uses parameterized queries where user input is bound as data, not parsed as SQL, preventing injection attacks.
Question 23: What return type should a Room DAO method use to observe database changes reactively?
- Observable<T>
- LiveData<T>
- Flow<T>
- Both A and B (Correct answer)
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 24: In Kotlin, what does a 'sealed class' provide when modeling UI states like Loading, Success, and Error?
- Persistence of state across sessions
- Thread-safe state mutation
- Automatic JSON serialization of each state
- A restricted class hierarchy enabling exhaustive when-expression handling (Correct answer)
Correct answer: A restricted class hierarchy enabling exhaustive when-expression handling
Sealed classes limit subclasses to a known set, so a when expression can be checked for exhaustiveness at compile time.
Question 25: Which view group is recommended for building flat, complex UI hierarchies in Android?
- LinearLayout
- ConstraintLayout (Correct answer)
- TableLayout
- GridLayout
Correct answer: ConstraintLayout
ConstraintLayout allows you to create complex layouts with a flat view hierarchy, improving rendering performance.
Question 26: Which WorkManager work type is guaranteed to run even after a device reboot?
- Both A and B (Correct answer)
- Neither — WorkManager doesn't survive reboots
- PeriodicWorkRequest with persistence
- OneTimeWorkRequest
Correct answer: Both A and B
WorkManager persists both OneTimeWorkRequest and PeriodicWorkRequest to a database, ensuring they survive app restarts and device reboots.
Question 27: Which SQL clause is used in a Room @Query to filter results?
- WHERE (Correct answer)
- CONDITION
- HAVING
- FILTER
Correct answer: WHERE
The WHERE clause in Room SQL queries filters rows that meet a specified condition, just as in standard SQL.
Question 28: Which file access mode should be used to append data to a file in Android?
- MODE_PRIVATE
- MODE_APPEND (Correct answer)
- MODE_WRITE_ONLY
- MODE_WORLD_READABLE
Correct answer: MODE_APPEND
MODE_APPEND opens the file in append mode so new data is added to the end rather than overwriting existing content.
Question 29: Which Room annotation defines a foreign key relationship between two entities?
- @ForeignKey inside @Entity (Correct answer)
- @Relation
- @Join
- @Reference
Correct answer: @ForeignKey inside @Entity
The @ForeignKey annotation within @Entity defines referential integrity constraints between two Room database tables.
Question 30: What is a test double in Android unit testing?
- An object that substitutes a real dependency in a test (mock, stub, fake, spy) (Correct answer)
- A test that runs twice
- A duplicate test scenario
- A secondary test file
Correct answer: An object that substitutes a real dependency in a test (mock, stub, fake, spy)
A test double is any substitute object used in place of a real dependency during testing, including mocks, stubs, fakes, and spies.
Question 31: What method inflates a layout resource in Android?
- Both A and B (Correct answer)
- LayoutInflater.inflate()
- Context.inflate()
- 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 32: What is the role of the 'launch profiling' feature in Android Studio's CPU Profiler?
- It records CPU activity from the very beginning of app startup to diagnose slow launches (Correct answer)
- It profiles GPU shader compilation
- It tracks background service CPU usage
- It simulates low-end device CPU speeds
Correct answer: It records CPU activity from the very beginning of app startup to diagnose slow launches
Launch profiling captures CPU traces from process start, enabling developers to identify initialization bottlenecks that contribute to slow cold or warm start times.
Question 33: Which component should be used to expose an app's data to other applications in a secure, structured way?
- Fragment
- Service
- ContentProvider (Correct answer)
- BroadcastReceiver
Correct answer: ContentProvider
ContentProvider is the standard component for sharing structured data across app boundaries with permission control.
Question 34: Which DataStore type stores typed objects using Protocol Buffers?
- Proto DataStore (Correct answer)
- Preferences DataStore
- Object DataStore
- Typed 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 35: Which Android feature allows deferring the inflation of part of a layout until it is actually needed, improving initial load time?
- ConstraintLayout chains
- MotionLayout
- ViewStub (Correct answer)
- Data Binding
Correct answer: ViewStub
ViewStub is a lightweight, invisible View that is replaced by the inflated layout only when explicitly made visible or inflated, reducing startup inflation cost.
Question 36: Which Jetpack component is the recommended replacement for SharedPreferences?
- Room
- LiveData
- DataStore (Correct answer)
- WorkManager
Correct answer: DataStore
Jetpack DataStore is the recommended replacement for SharedPreferences, offering asynchronous, consistent, and transactional data storage.
Question 37: Which Android image format is preferred for app assets because it offers superior lossless and lossy compression compared to PNG and JPEG?
- BMP
- SVG
- TIFF
- WebP (Correct answer)
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 38: What does the dp unit represent in Android?
- Density-independent pixels (Correct answer)
- Default pixels
- Device pixels
- Drawable pixels
Correct answer: Density-independent pixels
dp (density-independent pixels) is a virtual unit that scales based on screen density to ensure consistent physical size across devices.
Question 39: What is the purpose of the Truth assertion library in Android testing?
- To validate JSON truthfulness
- To verify UI truth states
- To provide fluent, readable assertion methods as an alternative to JUnit assertions (Correct answer)
- To check permissions truthfully
Correct answer: To provide fluent, readable assertion methods as an alternative to JUnit assertions
Google's Truth library provides a fluent API for writing assertions that produce more readable failure messages than standard JUnit assertions.
Question 40: What is the purpose of SharedPreferences in Android?
- To manage user accounts
- To store large files
- To store small amounts of primitive key-value data persistently (Correct answer)
- To share data between apps
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 41: What is the purpose of BiometricPrompt in Android?
- To register new biometric templates
- To encrypt biometric data
- To authenticate users using fingerprint, face, or device credentials (Correct answer)
- To show a fingerprint scanner UI
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 42: What is the role of an Intent filter declared on an Activity?
- It caches intents for later delivery
- It advertises which implicit intents the Activity can handle (Correct answer)
- It blocks other apps from launching the Activity
- It converts explicit intents into implicit ones
Correct answer: It advertises which implicit intents the Activity can handle
Intent filters let the system match implicit intents, such as viewing a URL, to Activities that declare they can handle them.
Question 43: What does the FLAG_SECURE window flag do in Android?
- Prevents the screen content from appearing in screenshots and screen recordings (Correct answer)
- Encrypts window data
- Prevents screenshots from being saved
- Locks the screen
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 44: What is the purpose of declaring permissions in AndroidManifest.xml?
- To hide the app from unauthorized users
- To encrypt app data
- To declare what capabilities or data access the app requires (Correct answer)
- To restrict other apps from running
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 45: Which of the following businesses purchased Android?
- None of the above
- Nokia
- Google (Correct answer)
- Apple
Correct answer: Google
Android Inc. was originally founded in 2003 by Andy Rubin, Rich Miner, Nick Sears, and Chris White. Google acquired Android Inc. in 2005, recognizing the potential of its mobile operating system. This acquisition was a pivotal moment that led to Android's development and eventual release as a dominant mobile platform.
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