













































































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
Reflects newer Android features such as Jetpack components, LiveData, Navigation Component, WorkManager, updated permission flows, Kotlin-first development, adaptive icons, app bundles, instant apps, modern UI practices, and performance optimization techniques introduced in the v8 ecosystem.
Typology: Exams
1 / 85
This page cannot be seen from the preview
Don't miss anything!














































































Question 1. Which component of the Android platform architecture directly interacts with the device hardware? A) Android Runtime (ART) B) Application Framework C) Hardware Abstraction Layer (HAL) D) Core Libraries Answer: C Explanation: HAL provides a standard interface for the Android system to communicate with hardware drivers, abstracting hardware specifics. Question 2. In Android Studio, which tool is used to view the layout hierarchy and diagnose UI performance issues? A) Logcat B) Layout Inspector C) AVD Manager D) Device File Explorer Answer: B Explanation: Layout Inspector visualizes the view hierarchy at runtime, helping identify overdraw and layout inefficiencies. Question 3. What is the primary difference between an explicit intent and an implicit intent? A) Explicit intents require a permission, implicit intents do not. B) Explicit intents specify the target component’s class name, implicit intents specify an action. C) Implicit intents can only start services, explicit intents can start activities. D) Implicit intents are only used for broadcasting. Answer: B Explanation: Explicit intents name the exact component (class) to start, while implicit intents declare a general action for any compatible component to handle.
Question 4. Which Android manifest attribute declares that an activity should be the entry point of the application? A) android:label B) android:icon C) android:name D) android:exported with intent-filter for ACTION_MAIN and CATEGORY_LAUNCHER Answer: D Explanation: The combination of ACTION_MAIN and CATEGORY_LAUNCHER in an intent-filter marks the launch activity. Question 5. When an activity is destroyed because the system needs memory, which lifecycle method is NOT guaranteed to be called? A) onPause() B) onStop() C) onDestroy() D) onSaveInstanceState() Answer: C Explanation: The system may kill the process without invoking onDestroy(); onSaveInstanceState() is called before the activity becomes background. Question 6. Which layout is most suitable for creating a responsive UI that adapts to multiple screen sizes without nesting multiple ViewGroups? A) LinearLayout B) RelativeLayout C) FrameLayout D) ConstraintLayout Answer: D Explanation: ConstraintLayout allows flat hierarchy and flexible constraints, reducing nesting and improving performance.
A) android.permission.CAMERA B) android.permission.READ_EXTERNAL_STORAGE C) android.permission.INTERNET D) android.permission.VIBRATE Answer: A Explanation: CAMERA is a dangerous permission; starting with Android 6.0, it must be requested at runtime. Question 11. What does the “android:exported” attribute in the manifest control? A) Whether the component can be launched from the home screen. B) Whether the component is visible to other applications. C) The minimum SDK version required. D) The default theme applied to the component. Answer: B Explanation: android:exported determines if other apps can invoke the component via intents. Question 12. Which Android Jetpack library provides a type-safe way to store key-value pairs? A) DataStore (Preferences) B) Room C) Navigation D) WorkManager Answer: A Explanation: DataStore (Preferences) replaces SharedPreferences with coroutine-based, type-safe APIs. Question 13. Which method of the BroadcastReceiver class is invoked when a broadcast is received? A) onReceive()
B) onStart() C) onBroadcast() D) onIntent() Answer: A Explanation: onReceive() handles the incoming Intent when the receiver is triggered. Question 14. What is the primary advantage of using a ContentProvider over direct file access? A) Faster I/O performance. B) Built-in encryption. C) Structured data sharing with permission enforcement across apps. D) Automatic UI generation. Answer: C Explanation: ContentProviders expose data via a defined contract, enforce permissions, and allow other apps to query data securely. Question 15. Which annotation is used with Room to designate a class as a database entity? A) @Dao B) @Database C) @Entity D) @PrimaryKey Answer: C Explanation: @Entity marks a Kotlin/Java class as a table in the Room database. Question 16. Which Gradle dependency is required to use AndroidX Navigation Component? A) implementation "androidx.navigation:navigation-fragment-ktx:2.5.0" B) implementation "androidx.recyclerview:recyclerview:1.2.1" C) implementation "androidx.room:room-runtime:2.4.0"
Answer: D Explanation: Fragments use the OnBackPressedDispatcher to intercept back presses. Question 20. Which Android component is responsible for executing deferrable, guaranteed background work even after app termination? A) Service B) AsyncTask C) WorkManager D) Loader Answer: C Explanation: WorkManager schedules tasks that survive process death and respect constraints like network availability. Question 21. What is the purpose of the “android:configChanges” attribute in the manifest? A) To specify which configuration changes the system should NOT restart the activity for. B) To declare supported screen densities. C) To request runtime permissions automatically. D) To set the default locale. Answer: A Explanation: Declaring configChanges tells the system to deliver the change via onConfigurationChanged() instead of recreating the activity. Question 22. Which method of SharedPreferences.Editor commits changes synchronously? A) apply() B) commit() C) putString() D) clear() Answer: B
Explanation: commit() writes to storage immediately and returns a boolean indicating success; apply() writes asynchronously. Question 23. Which of the following best describes “sticky broadcast”? A) A broadcast that remains in the system after being sent, so future receivers can retrieve the last broadcasted Intent. B) A broadcast that is delivered only to the app that sent it. C) A broadcast that is ordered by priority. D) A broadcast that cannot be aborted. Answer: A Explanation: Sticky broadcasts persist the Intent data for later receivers; they are deprecated for security reasons. Question 24. Which Android API level introduced the Notification Channels system? A) 21 (Lollipop) B) 23 (Marshmallow) C) 26 (Oreo) D) 29 (Android 10) Answer: C Explanation: Android 8.0 (API 26) requires Notification Channels for managing notification importance. Question 25. In Kotlin, which keyword makes a class member immutable after initialization? A) var B) val C) const D) final Answer: B Explanation: val declares a read-only property; its value cannot be reassigned after being set.
A) setOnClickListener() B) onClick() C) click() D) addOnClickListener() Answer: A Explanation: setOnClickListener() registers a callback invoked when the view is tapped. Question 30. Which of the following is NOT a valid scope for a Coroutine in Android? A) lifecycleScope B) viewModelScope C) activityScope D) GlobalScope Answer: C Explanation: activityScope is not a predefined coroutine scope; lifecycleScope and viewModelScope are provided by AndroidX. Question 31. When using Retrofit, which annotation specifies that a method performs a GET request? A) @POST B) @PUT C) @GET D) @DELETE Answer: C Explanation: @GET defines an HTTP GET request for the annotated interface method. Question 32. Which file defines the navigation graph for the Navigation Component? A) nav_graph.xml B) navigation.xml
C) activity_main.xml D) fragment_nav.xml Answer: A Explanation: nav_graph.xml, placed in res/navigation, contains destinations and actions for Navigation Component. Question 33. Which Android component should you use to play music in the background even when the UI is not visible? A) Activity B) Service (started) C) BroadcastReceiver D) ContentProvider Answer: B Explanation: A started Service can run in the background without UI, suitable for media playback. Question 34. Which method of the Activity class is called after onStart() and before the activity becomes visible to the user? A) onResume() B) onCreate() C) onPause() D) onRestart() Answer: A Explanation: onResume() is invoked after onStart() when the activity gains focus and becomes interactive. Question 35. Which XML attribute makes a view invisible but still takes up layout space? A) android:visibility="gone" B) android:visibility="invisible" C) android:visibility="visible" D) android:layout_hide="true"
Question 39. What is the default launch mode of an Activity if none is specified in the manifest? A) singleTop B) singleInstance C) standard D) singleTask Answer: C Explanation: The standard mode creates a new instance each time the activity is launched. Question 40. Which of the following is the correct way to start a foreground Service in Android 9 (API 28) or higher? A) startService(intent) B) bindService(intent, connection, BIND_AUTO_CREATE) C) startForegroundService(intent) D) ContextCompat.startForegroundService(context, intent) Answer: C Explanation: startForegroundService() starts a service that must call startForeground() within a few seconds. Question 41. Which method of the NotificationCompat.Builder sets the importance level for a notification channel? A) setPriority() B) setImportance() C) setChannelId() D) setVisibility() Answer: A Explanation: setPriority() defines the relative importance for pre-O devices; actual channel importance is set when creating the channel itself.
Question 42. Which Android API is used to check whether the device currently has an active internet connection? A) ConnectivityManager.getActiveNetworkInfo() (deprecated) B) NetworkCapabilities.hasCapability() via ConnectivityManager.getNetworkCapabilities() C) WifiManager.isConnected() D) TelephonyManager.isNetworkAvailable() Answer: B Explanation: The modern approach uses ConnectivityManager with NetworkCapabilities to assess connectivity. Question 43. Which of the following best describes the purpose of the “android:windowSoftInputMode” attribute? A) Controls how the soft keyboard interacts with the window when it appears. B) Sets the default theme for the activity. C) Determines whether the activity can be launched in split-screen mode. D) Enables hardware acceleration. Answer: A Explanation: windowSoftInputMode defines resizing or panning behavior when the soft keyboard is shown. Question 44. In the Android file system, which directory is private to the app and removed when the app is uninstalled? A) getExternalFilesDir() B) getExternalStorageDirectory() C) getFilesDir() D) Environment.getExternalStoragePublicDirectory() Answer: C Explanation: getFilesDir() returns the internal storage directory that is private to the app and cleared on uninstall.
B) It can be edited directly on the device without signing. C) It always contains native code in the form of .so files. D) It is generated only for debug builds. Answer: A Explanation: An APK is a ZIP-based package that includes DEX bytecode, resources, assets, and the manifest. Question 49. Which Android Studio feature helps you automatically generate boilerplate code for a new Activity? A. Layout Editor B. New > Activity wizard C. Refactor > Extract Method D. Build Variants pane Answer: B Explanation: The Activity wizard scaffolds the Java/Kotlin class, layout file, and manifest entry. Question 50. Which of the following is the correct way to declare a Kotlin coroutine that runs on the IO dispatcher? A) launch { withContext(Dispatchers.IO) { … } } B) async(Dispatchers.IO) { … } C) CoroutineScope(Dispatchers.IO).launch { … } D) runBlocking(Dispatchers.IO) { … } Answer: C Explanation: Creating a CoroutineScope with Dispatchers.IO and launching inside runs the coroutine on the IO dispatcher. Question 51. Which method of the MediaPlayer class prepares the player synchronously? A) prepareAsync() B) prepare()
C) start() D) reset() Answer: B Explanation: prepare() blocks until the media source is ready; prepareAsync() returns immediately. Question 52. Which attribute is used to specify a custom theme for a specific Activity? A) android:theme B) android:style C) android:layoutTheme D) android:background Answer: A Explanation: android:theme in the manifest or activity tag sets a theme for that activity. Question 53. Which Android API level introduced Scoped Storage, changing how apps access external storage? A) 23 (Marshmallow) B) 26 (Oreo) C) 29 (Android 10) D) 30 (Android 11) Answer: C Explanation: Android 10 (API 29) introduced Scoped Storage, limiting direct file path access. Question 54. Which of the following is the recommended way to store a user’s password securely on the device? A) SharedPreferences (plain text) B) SQLite database without encryption C) EncryptedSharedPreferences or Android Keystore D) Write to a file in internal storage
Question 58. In the context of Android Gradle builds, what does the “minSdkVersion” specify? A) The highest API level the app can run on. B) The API level required for compiling the app. C) The lowest Android version the app supports at runtime. D) The target device’s screen density. Answer: C Explanation: minSdkVersion defines the minimum OS version the app can be installed on. Question 59. Which method of the SensorEventListener interface receives sensor data updates? A) onSensorChanged() B) onAccuracyChanged() C) onSensorUpdate() D) onDataReceived() Answer: A Explanation: onSensorChanged() is called whenever new sensor data is available. Question 60. Which Android component is best suited for performing short-lived background work that does not require a UI and should survive configuration changes? A) Service B) AsyncTask C) Loader D) WorkManager Answer: C Explanation: Loaders (now deprecated) survive configuration changes and manage background queries; modern apps use ViewModel + coroutines.
Question 61. Which attribute in a menu XML file defines a shortcut key for a menu item? A) android:showAsAction B) android:icon C) android:shortcutAlphabeticChar D) android:title Answer: C Explanation: shortcutAlphabeticChar (and shortcutNumericChar) define hardware keyboard shortcuts. Question 62. Which of the following is the correct way to add a fragment to an activity using the support library? A) fragmentTransaction.add(R.id.container, MyFragment()) B) fragmentTransaction.replace(R.id.container, MyFragment()) C) supportFragmentManager.beginTransaction().add(R.id.container, MyFragment()).commit() D) getFragmentManager().beginTransaction().add(R.id.container, MyFragment()).commit() Answer: C Explanation: Using supportFragmentManager with a transaction and committing adds the fragment. Question 63. Which method of the SQLiteOpenHelper class is called when the database needs to be upgraded? A) onCreate() B) onUpgrade() C) onOpen() D) onDowngrade() Answer: B Explanation: onUpgrade() handles schema changes when the version number increases.