
















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This certification exam preparation guide focuses on Android application development fundamentals. Topics include app architecture, UI design, activity lifecycle, data persistence, APIs, testing, and performance optimization. The guide emphasizes hands-on coding practices and adherence to Android development standards.
Typology: Exams
1 / 88
This page cannot be seen from the preview
Don't miss anything!

















































































Question 1. Which lifecycle callback is always called after an Activity becomes visible to the user? A) onCreate() B) onStart() C) onResume() D) onPause() Answer: C Explanation: onResume() is invoked after onStart() and indicates the Activity is in the foreground and ready for user interaction. Question 2. When an Activity is destroyed due to a configuration change, which component can retain UI data without reloading from scratch? A) Service B) ViewModel C) BroadcastReceiver D) ContentProvider Answer: B Explanation: ViewModel objects survive configuration changes, allowing UI data to be retained across Activity recreation. Question 3. Which Intent flag should be used to clear the back stack when launching a new Activity? A) FLAG_ACTIVITY_NEW_TASK B) FLAG_ACTIVITY_SINGLE_TOP C) FLAG_ACTIVITY_CLEAR_TOP D) FLAG_ACTIVITY_REORDER_TO_FRONT Answer: C
Explanation: FLAG_ACTIVITY_CLEAR_TOP removes all Activities above the targeted one in the back stack, effectively clearing it. Question 4. To provide a string resource in French, which folder name should be used? A) values-fr B) strings-fr C) res-fr D) locale-fr Answer: A Explanation: Resource qualifiers for language are placed in a folder named values-, e.g., values-fr. Question 5. Which of the following is the recommended API for deferrable, guaranteed background work? A) Thread B) Service C) JobScheduler D) WorkManager Answer: D Explanation: WorkManager abstracts the underlying scheduler and guarantees execution even after app restarts or device reboots. Question 6. Which coroutine builder runs code on the main (UI) thread? A) launch(Dispatchers.IO) B) async(Dispatchers.Default) C) launch(Dispatchers.Main)
B) Bind UI components directly to data sources in XML C) Replace all ViewModels D) Remove the need for layout files Answer: B Explanation: Data Binding lets you declare bindings between layout XML and data objects, reducing boilerplate. Question 10. Which Navigation Component class defines the navigation graph? A) NavController B) NavHostFragment C) NavGraph D) NavigationUI Answer: C Explanation: NavGraph is an XML resource that lists destinations and actions for navigation. Question 11. Which UI element is most appropriate for top-level navigation among three primary sections? A) Navigation Drawer B) Bottom Navigation Bar C) TabLayout D) Spinner Answer: B Explanation: Bottom Navigation is recommended for three to five top-level destinations, providing direct access. Question 12. To make a custom view accessible for TalkBack, you should:
A) Override onDraw() only B) Set contentDescription programmatically or in XML C) Use only VectorDrawable D) Disable focusability Answer: B Explanation: contentDescription provides a textual label that TalkBack reads for accessibility. Question 13. Which attribute defines a style for all Button widgets in a theme? A) @style/MyButton B) @style/MyButton C) @style/MyButton D) @style/MyButton Answer: A Explanation: The attribute android:buttonStyle in a theme applies the specified style to all Button instances. Question 14. In Room, which annotation marks a class as a database entity? A) @Dao B) @Database C) @Entity D) @ColumnInfo Answer: C Explanation: @Entity tells Room to treat the class as a table in the database.
Explanation: DataStore (Preferences) provides asynchronous, type-safe key-value storage, superseding SharedPreferences. Question 18. When parsing a JSON file stored in the assets folder, which class should you use to open the file? A) openFileInput() B) resources.openRawResource() C) assets.open() D) ContentResolver.openInputStream() Answer: C Explanation: assets.open() returns an InputStream for a file located in the assets directory. Question 19. The Paging 3 library primarily helps with: A) Animating view transitions B) Loading large data sets in small, manageable chunks C) Managing network security D) Storing encrypted files Answer: B Explanation: Paging 3 loads data page-by-page, reducing memory usage and improving UI responsiveness. Question 20. Which Logcat filter level shows only error messages? A) VERBOSE B) DEBUG C) INFO D) ERROR
Answer: D Explanation: Setting the filter to ERROR displays only log messages with priority ERROR or higher. Question 21. To set a breakpoint on a line of Kotlin code in Android Studio, you should: A) Press Ctrl+Shift+F B) Click the gutter next to the line number C) Use the Run > Debug menu only D) Add a println() statement Answer: B Explanation: Clicking the gutter adds a breakpoint that pauses execution when reached. Question 22. When a NullPointerException occurs, the stack trace will typically show the: A) Class where the exception was thrown B) AndroidManifest file C) Layout XML file D) Gradle build script Answer: A Explanation: The stack trace lists the call hierarchy, starting with the class and method where the exception originated. Question 23. If a button click does not trigger its onClick listener, a likely cause is: A) Missing INTERNET permission B) The button is not focusable
A) Mockito-Kotlin B) Retrofit C) Dagger D) Glide Answer: A Explanation: Mockito-Kotlin provides Kotlin-friendly syntax for creating mocks in unit tests. Question 27. Espresso’s onView(withId(R.id.myView)).perform(click()) checks for: A) Network connectivity B) UI interaction on the view with the given ID C) Database insertion D) Background thread execution Answer: B Explanation: onView locates a view by matcher; perform(click()) simulates a user click on that view. Question 28. Which Espresso matcher verifies that a TextView displays the text “Hello”? A) withContentDescription("Hello") B) withText("Hello") C) hasDescendant(withText("Hello")) D) isDisplayed() Answer: B Explanation: withText matches the exact text content of a view.
Question 29. To test a Fragment in isolation, which AndroidX testing library should you use? A) ActivityScenario B) FragmentScenario C) ServiceTestRule D) WorkManagerTestRule Answer: B Explanation: FragmentScenario launches a Fragment in a container, enabling isolated UI tests. Question 30. Which Gradle plugin is required to enable Data Binding in a module? A) kotlin-android-extensions B) android.application C) android.library D) kotlin-kapt Answer: D Explanation: kotlin-kapt enables annotation processing for Data Binding and other libraries. Question 31. Which attribute in AndroidManifest.xml declares that an Activity supports portrait and landscape orientations? A) android:screenOrientation="unspecified" B) android:configChanges="orientation|screenSize" C) android:orientation="both" D) android:screenOrientation="sensor" Answer: D
D) grantPermissions() Answer: C Explanation: First check if permission is already granted; if not, call requestPermissions(). Question 35. Which XML attribute defines a color resource reference for a view’s background? A) android:src B) android:textColor C) android:background D) android:foreground Answer: C Explanation: android:background can reference a color or drawable resource. Question 36. In Jetpack Compose, which function replaces the traditional setContentView()? A) composeView() B) setComposeContent() C) setContent {} D) renderCompose() Answer: C Explanation: setContent { … } inflates a composable hierarchy in an Activity. Question 37. Which Compose modifier adds padding of 16dp around a component? A) Modifier.margin(16.dp) B) Modifier.padding(16.dp)
C) Modifier.offset(16.dp) D) Modifier.space(16.dp) Answer: B Explanation: Modifier.padding adds internal spacing. Question 38. When using LiveData with a Fragment, which lifecycle owner should you pass to observe()? A) getApplicationContext() B) viewLifecycleOwner C) requireActivity() D) this (Fragment) Answer: B Explanation: viewLifecycleOwner respects the Fragment’s view lifecycle, avoiding leaks when the view is destroyed. Question 39. Which of the following is the correct way to start a WorkManager one-time request? A) WorkManager.enqueue(OneTimeWorkRequestBuilder().build()) B) WorkManager.getInstance(context).enqueueOneTimeWorkRequest(...) C) WorkManager.getInstance(context).enqueue(workRequest) D) WorkManager.startWork(workRequest) Answer: C Explanation: enqueue() accepts a WorkRequest (one-time or periodic) and schedules it. Question 40. In the Android file system, which directory is private to the app and removed when the app is uninstalled?
Question 43. Which attribute enables a view to be focusable for accessibility services? A) android:clickable="true" B) android:focusable="true" C) android:enabled="true" D) android:visible="true" Answer: B Explanation: focusable makes the view reachable via keyboard or accessibility navigation. Question 44. To apply a dark theme only on devices running Android 10 (API 29) and above, which resource qualifier should you use? A) values-night-v B) values-v C) values-night D) values-dark-v Answer: A Explanation: The night qualifier combined with API level (v29) targets dark mode on Android 10+. Question 45. Which annotation marks a method that should run on the main thread when using coroutines? A) @MainThread B) @UiThread C) @WorkerThread D) @BackgroundThread Answer: B
Explanation: @UiThread (or @MainThread) indicates the method must be called on the UI thread. Question 46. In a Room DAO, which return type allows queries to be observed as LiveData? A) List B) Flow C) LiveData> D) Cursor Answer: C Explanation: LiveData> updates observers when the underlying data changes. Question 47. Which AndroidX class provides a simple way to store small amounts of data without using SharedPreferences? A) PreferenceDataStore B) DataStore (Preferences) C) EncryptedSharedPreferences D) AppDataStore Answer: B Explanation: DataStore (Preferences) is the modern replacement for SharedPreferences. Question 48. When using the Paging 3 library with Room, which return type should a DAO method have? A) List B) LiveData> C) Flow>
B) androidx.navigation:navigation-ui-ktx C) androidx.navigation:navigation-safe-args-gradle-plugin D) androidx.navigation:navigation-dynamic-features-fragment Answer: C Explanation: The safe-args Gradle plugin generates type-safe argument classes. Question 52. In Kotlin, which keyword makes a class property observable for UI binding? A) lateinit B) var by mutableStateOf() C) val by lazy {} D) var delegate() Answer: B Explanation: mutableStateOf creates a state holder that Compose can observe for recomposition. Question 53. Which manifest element is required to declare a ContentProvider? A) B) C) D) Answer: C Explanation: registers a ContentProvider with the system. Question 54. When using Retrofit with Kotlin coroutines, which return type should an API interface method have?
A) Call B) Deferred C) suspend fun ... : Response D) Observable Answer: C Explanation: suspend functions combined with Retrofit’s coroutine support return Response directly. Question 55. Which AndroidX library provides the ability to observe lifecycle changes without subclassing Activity? A) LifecycleObserver (now LifecycleEventObserver) B) ViewModelProvider C) LiveData D) Navigation Answer: A Explanation: Implementing LifecycleEventObserver lets objects react to lifecycle events. Question 56. In a RecyclerView, which LayoutManager arranges items in a vertical list? A) GridLayoutManager B) LinearLayoutManager C) StaggeredGridLayoutManager D) FlexboxLayoutManager Answer: B Explanation: LinearLayoutManager with vertical orientation displays a simple list.