






















































































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
Tailored to modern Android development standards, this exam covers Kotlin-based development, Android 8+ APIs, adaptive icons, notification channels, background execution limits, Doze mode, biometric authentication, and modern themes/styles. Candidates also practice optimizing apps for performance, battery life, and security while leveraging contemporary Android architecture patterns.
Typology: Exams
1 / 94
This page cannot be seen from the preview
Don't miss anything!























































































Question 1. Which layer of the Android platform is responsible for providing hardware‑specific drivers to the higher‑level frameworks? A) Linux Kernel B) Hardware Abstraction Layer (HAL) C) Android Runtime (ART) D) Application Framework Answer: B Explanation: HAL defines standard interfaces that expose hardware capabilities to the Android framework, allowing the same higher‑level code to run on different hardware. Question 2. What is the primary purpose of AndroidX (Jetpack) libraries? A) To replace the Linux kernel with a newer version B) To provide backward‑compatible, modular components that reduce boilerplate code C) To enable native C/C++ development only D) To manage device drivers directly from apps Answer: B Explanation: AndroidX (formerly Support Library) offers backward‑compatible components that simplify development and work across multiple API levels. Question 3. Which command is used to list all connected Android devices or emulators via ADB? A) adb devices – list B) adb get‑devices C) adb devices D) adb show‑devices Answer: C
Explanation: adb devices prints a list of all devices and emulators currently connected to the development machine. Question 4. In Kotlin, which keyword is used to declare a class that cannot be subclassed? A) final B) sealed C) open D) abstract Answer: A Explanation: final (the default) prevents a class from being inherited. open allows inheritance, while sealed and abstract have different semantics. Question 5. Which AndroidManifest.xml element declares that an app requires internet access? A) <uses-feature android:name="android.hardware.wifi"/> B) <uses-permission android:name="android.permission.INTERNET"/> C) <application android:allowBackup="true"/> D) <activity android:name=".MainActivity"/> Answer: B Explanation: <uses-permission> tags request permissions; android.permission.INTERNET grants network access. Question 6. Which resource qualifier would you use to provide a layout for tablets with a screen width of at least 600dp? A) layout-sw600dp B) layout-large C) layout-xhdpi
A) LinearLayout B) RelativeLayout C) FrameLayout D) ConstraintLayout Answer: D Explanation: ConstraintLayout allows positioning of views relative to each other and the parent, reducing nesting and improving performance. Question 10. What is the role of a RecyclerView.Adapter? A) To define the visual theme of the RecyclerView B) To manage the binding of data to ViewHolder objects and create new ViewHolders as needed C) To store data permanently on disk D) To handle network requests for the list items Answer: B Explanation: The Adapter creates ViewHolders, binds data to them, and informs RecyclerView about item counts. Question 11. Which lifecycle method of a Fragment is called when the fragment’s UI becomes visible to the user? A) onCreateView() B) onStart() C) onResume() D) onViewCreated() Answer: C Explanation: onResume() is invoked after onStart() when the fragment is active and interacting with the user.
Question 12. To navigate from one Fragment to another using the Navigation Component, which class is typically used? A) Intent B) NavController C) FragmentTransaction D) ActivityResultLauncher Answer: B Explanation: NavController handles navigation actions defined in a navigation graph, simplifying fragment transactions. Question 13. Which listener interface should you implement to handle a long‑press on a Button view? A) View.OnClickListener B) View.OnTouchListener C) View.OnLongClickListener D) View.OnFocusChangeListener Answer: C Explanation: OnLongClickListener receives callbacks when the user presses and holds a view. Question 14. Which UI component provides a brief, unobtrusive message at the bottom of the screen that can also include an action button? A) Toast B) Snackbar C) AlertDialog D) Notification
Answer: A Explanation: android.intent.action.VIEW is used for viewing data such as URLs; the system matches it with appropriate data URIs. Question 18. How can an Activity return data to the Activity that started it using startActivityForResult()? A) By calling setResult() with an Intent containing extras, then finish() B) By calling startActivity() again with the data attached C) By broadcasting a custom Intent D) By writing data to SharedPreferences Answer: A Explanation: setResult(RESULT_OK, dataIntent) stores the result; finish() ends the Activity, delivering the data back. Question 19. Which type of broadcast is delivered to one receiver at a time, in a defined order, and can be aborted? A) Normal broadcast B) Sticky broadcast C) Ordered broadcast D) Local broadcast Answer: C Explanation: Ordered broadcasts are sent sequentially to receivers based on priority; a receiver can abort further propagation. Question 20. Which method registers a BroadcastReceiver dynamically at runtime?
A) registerReceiver() B) addBroadcastReceiver() C) bindService() D) registerComponentCallbacks() Answer: A Explanation: Context.registerReceiver() registers a receiver programmatically; it must be paired with unregisterReceiver(). Question 21. Which storage option is best suited for storing user preferences such as theme selection? A) SQLite database B) SharedPreferences C) External storage files D) ContentProvider Answer: B Explanation: SharedPreferences provides a simple key‑value store for primitive data, ideal for small configuration settings. Question 22. Where are files saved using openFileOutput() stored? A) In the app’s private internal storage directory B) In the device’s external SD card root C) In the public Downloads folder D) In the Android system partition Answer: A Explanation: openFileOutput() writes to the app’s internal storage, which is private to the app and removed upon uninstall.
Answer: B Explanation: @Entity tells Room to treat the class as a table, with each field representing a column. Question 26. To expose data from your app to other apps, you must implement which component? A) Service B) BroadcastReceiver C) ContentProvider D) Activity Answer: C Explanation: ContentProviders encapsulate data and provide a standardized interface (URI) for other apps to query, insert, update, or delete. Question 27. Which method of ContentResolver is used to query data from a ContentProvider? A) insert() B) update() C) query() D) delete() Answer: C Explanation: ContentResolver.query() returns a Cursor over the result set defined by the provider’s URI. Question 28. Which thread must never be blocked by long‑running operations to avoid an ANR error? A) Worker thread
B) Main (UI) thread C) AsyncTask thread pool D) HandlerThread Answer: B Explanation: The main thread handles UI events; blocking it for > 5 seconds triggers an Application Not Responding (ANR) dialog. Question 29. Which Kotlin construct provides a concise way to perform asynchronous work without callbacks? A) Thread() B) AsyncTask() C) Coroutine D) Handler.postDelayed() Answer: C Explanation: Coroutines allow writing asynchronous code sequentially using suspend functions and structured concurrency. Question 30. Which WorkManager class method is used to enqueue a one‑time background work request? A) WorkManager.enqueuePeriodicWorkRequest() B) WorkManager.enqueueUniqueWork() C) WorkManager.enqueue() D) WorkManager.beginWith() Answer: C Explanation: WorkManager.enqueue(workRequest) schedules a OneTimeWorkRequest (or any WorkRequest) for execution.
Explanation: ConnectivityManager.getActiveNetworkInfo() returns a NetworkInfo object; isConnected() indicates connectivity. Question 34. Which library is most commonly used for making type‑safe HTTP calls and parsing JSON responses in modern Android apps? A) HttpURLConnection B) Volley C) Retrofit D) OkHttp (without Retrofit) Answer: C Explanation: Retrofit builds on OkHttp and provides annotations to define API endpoints and automatic JSON (via converters) parsing. Question 35. Which permission group must be requested at runtime on Android 6.0+ for accessing the device’s camera? A) android.permission.CAMERA (normal) B) android.permission.CAMERA (dangerous) C) android.permission.READ_EXTERNAL_STORAGE D) android.permission.ACCESS_FINE_LOCATION Answer: B Explanation: CAMERA is classified as a dangerous permission, requiring explicit runtime request from the user. Question 36. Which Log method should be used for logging detailed debugging information that you want to hide in release builds? A) Log.e() B) Log.w()
C) Log.i() D) Log.d() Answer: D Explanation: Log.d() (debug) is typically filtered out in release builds, while Log.e() (error) is always logged. Question 37. Which Gradle task creates a signed APK ready for distribution? A) assembleDebug B) assembleRelease C) bundleRelease D) installRelease Answer: B Explanation: assembleRelease builds a release‑mode APK; signing configuration must be provided in the Gradle file. Question 38. In Android Studio, which tool helps you analyze memory leaks and object allocations at runtime? A) Layout Inspector B) Profiler → Memory C) Logcat D) Device File Explorer Answer: B Explanation: The Memory tab of Android Profiler visualizes heap usage and can capture heap dumps to detect leaks. Question 39. Which annotation is used to indicate that a method should be run on the UI thread when using AndroidX Test?
Question 42. Which XML attribute defines a string resource that can be localized? A) <string> tags store text that can be placed in language‑specific resource folders (e.g., values-fr) for localization. Question 43. What is the purpose of the android:exported attribute introduced in Android 12 (API 31)? A) To indicate whether a component can be launched by components of other apps B) To specify the minimum SDK version required C) To enable data binding for the component D) To define the component’s theme Answer: A Explanation: android:exported explicitly declares if an Activity, Service, or BroadcastReceiver is accessible to external apps, required for apps targeting API 31+. Question 44. Which of the following is NOT a valid scope for a ViewModel in Android Architecture Components? A) Activity scope B) Fragment scope C) Application scope D) Service scope
Answer: D Explanation: ViewModels are designed to survive configuration changes for UI controllers (Activity/Fragment) and can be shared via the Application, but not directly tied to Services. Question 45. Which method of the LiveData class is used to observe data changes from a LifecycleOwner? A) observeForever() B) observe(LifecycleOwner, Observer) C) setValue() D) postValue() Answer: B Explanation: observe(LifecycleOwner, Observer) registers an observer that respects the lifecycle of the given owner (e.g., Activity). Question 46. Which Gradle dependency is required to use Kotlin Coroutines on Android? A) implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.0" B) implementation "androidx.coroutines:coroutine-android:1.0.0" C) implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.0.0" D) implementation "org.jetbrains.kotlin:kotlin-stdlib:1.8.0" Answer: A Explanation: The kotlinx-coroutines-android artifact provides coroutine support with Android‑specific dispatchers. Question 47. Which attribute of a <service> element makes the service run in a separate process? A) android:process=":remote" B) android:enabled="true"
A) prepareAsync() B) setDataSource() C) prepare() D) reset() Answer: C Explanation: prepare() blocks until the media is ready; prepareAsync() does the same asynchronously. Question 51. Which attribute of a <activity> determines the default orientation of the UI? A) android:screenOrientation B) android:configChanges C) android:theme D) android:launchMode Answer: A Explanation: android:screenOrientation can be set to portrait, landscape, sensor, etc., fixing the orientation. Question 52. Which of the following is a correct way to declare a custom view class in XML layout? A) <com.example.MyView /> B) <view class="com.example.MyView" /> C) <MyView /> D) <android.view.MyView /> Answer: A Explanation: Fully qualified class name can be used as an XML tag to instantiate a custom view.
Question 53. Which Android component is responsible for executing background work that must survive device reboots? A) Service B) AlarmManager with BroadcastReceiver C) WorkManager with setRequiresDeviceIdle(true) D) JobScheduler with setRequiresDeviceIdle(true) Answer: D Explanation: JobScheduler can schedule jobs that persist across reboots when the appropriate flags are set. Question 54. Which method of FragmentTransaction adds the transaction to the back stack? A) addToBackStack(null) B) commit() C) replace() D) setReorderingAllowed(true) Answer: A Explanation: addToBackStack(name) records the transaction so the user can navigate back. Question 55. Which annotation is used to indicate that a field in a Room entity should not be persisted? A) @Ignore B) @Transient C) @Exclude D) @NonNull