Mobile Programming MCQs
Mobile Programming MCQs
- A. Activities
- B. Services
- C. Web Server
- D. Content Providers
- A. Intent
- B. SharedPreferences
- C. Broadcast Receiver
- D. Service
- **Answer:** B. SharedPreferences
- A. activity_main.xml
- B. MainActivity.java
- C. AndroidManifest.xml
- D. strings.xml
- **Answer:** C. AndroidManifest.xml
- A. Activity
- B. BroadcastReceiver
- C. Service
- D. Adapter
- **Answer:** D. Adapter
Madan Kafley
MCQ Mobile Programming
- A. startActivity()
- B. startNewActivity()
- C. launchActivity()
- D. beginActivity()
- **Answer:** A. startActivity()
- A. MySQL
- B. SQLite
- C. PostgreSQL
- D. Oracle
- **Answer:** B. SQLite
- A. To store UI layouts
Madan Kafley
MCQ Mobile Programming
- C. To manage notifications
10. **Which of the following is the base class for all activities in Android?**
- A. AppCompatActivity
- B. FragmentActivity
- C. Activity
- D. Context
- **Answer:** C. Activity
11. **Which Android component can you use to display data in a scrollable list?**
- A. ScrollView
- B. RecyclerView
- C. ListView
- D. GridView
- **Answer:** B. RecyclerView
- B. RecyclerView
- C. Runnable interfaces
- D. Runtime permissions
- A. onCreateView()
- B. onResume()
- C. onPause()
- D. onStart()
- **Answer:** A. onCreateView()
Madan Kafley
MCQ Mobile Programming
- A. android:label
- B. android:text
- C. android:id
- D. android:src
- **Answer:** C. android:id
15. **Which layout allows for positioning of elements relative to each other in Android?**
- A. LinearLayout
- B. FrameLayout
- C. RelativeLayout
- D. GridLayout
- **Answer:** C. RelativeLayout
- A. Toast.makeText()
- B. Toast.showMessage()
- C. Toast.display()
- D. Toast.pop()
- **Answer:** A. Toast.makeText()
18. **Which XML attribute sets the layout width to fill the screen width in Android?**
- A. android:layout_height
Madan Kafley
MCQ Mobile Programming
- B. android:layout_gravity
- C. android:layout_width
- D. android:fill_parent
- **Answer:** C. android:layout_width
19. **What does the `dp` unit stand for in Android layouts?**
- A. Device Pixel
- B. Density-independent Pixel
- C. Dynamic Pixel
- D. Default Pixel
- A. checkSelfPermission()
- B. requestPermission()
- C. requestPermissions()
- D. askPermission()
- **Answer:** C. requestPermissions()
- A. Starting an activity
- C. Binding a service
- A. Service
- B. ContentProvider
- C. BroadcastReceiver
- D. Activity
Madan Kafley
MCQ Mobile Programming
- **Answer:** D. Activity
- A. constant
- B. val
- C. var
- D. final
- **Answer:** B. val
24. **Which of the following is the official IDE for Android development?**
- A. Eclipse
- B. NetBeans
- C. Android Studio
- D. IntelliJ IDEA
- A. onStart()
- B. onPause()
- C. onResume()
- D. onBegin()
- **Answer:** D. onBegin()
Madan Kafley
MCQ Mobile Programming
- A. Lollipop (5.0)
- B. KitKat (4.4)
- D. Marshmallow (6.0)
- A. onDestroy()
- B. finish()
- C. close()
- D. stop()
- **Answer:** B. finish()
- A. MongoDB
- B. Firebase
- C. SQLite
Madan Kafley
MCQ Mobile Programming
- D. Redis
- **Answer:** C. SQLite
32. **In Android, what is the term for a collection of components that can be used to build the
user interface?**
- A. ViewGroup
- B. Layout
- C. Widget
- D. Fragment
- **Answer:** B. Layout
- A. ViewGroup
- B. View
- C. Context
- D. Fragment
- **Answer:** A. ViewGroup
- A. To serialize objects
- C. To compress data
- A. Marshmallow (6.0)
- B. Lollipop (5.0)
- C. KitKat (4.4)
Madan Kafley
MCQ Mobile Programming
- A. Thread
- B. AsyncTask
- C. Handler
- D. Looper
- **Answer:** A. Thread
- A. Lint
- B. Logcat
- C. Android Profiler
- D. ProGuard
Madan Kafley
MCQ Mobile Programming
- A. Faster UI rendering
- B. Easier debugging
41. **Which of these is a threading construct in Android that can be used to perform operations
on the UI thread?**
- A. Thread
- B. Handler
- C. AsyncTask
- D. Service
- **Answer:** B. Handler
- A. Modular components
44. **Which XML attribute in Android defines the default orientation of a `LinearLayout`?**
- A. android:layout_width
Madan Kafley
MCQ Mobile Programming
- B. android:layout_height
- C. android:orientation
- D. android:gravity
- **Answer:** C. android:orientation
45. **Which Android class is used to show a temporary popup message to the user?**
- A. Snackbar
- B. Toast
- C. AlertDialog
- D. DialogFragment
- **Answer:** B. Toast
- A. Started
- B. Running
- C. Paused
- D. Resumed
- **Answer:** B. Running
Madan Kafley
MCQ Mobile Programming
- A. onStart()
- B. onCreate()
- C. onResume()
- D. onPause()
- **Answer:** B. onCreate()
50. **Which feature of Android allows apps to work offline by caching data?**
- A. ContentProvider
- B. BroadcastReceiver
- C. Data Binding
- D. Room Database
51. **Which Android class is used to implement a background task that continues to run even if
the application is closed?**
- A. Thread
- B. Service
- C. AsyncTask
- D. IntentService
- **Answer:** B. Service
- A. onCreate()
- B. onCreateView()
- C. onAttach()
- D. onStart()
- **Answer:** B. onCreateView()
Madan Kafley
MCQ Mobile Programming
53. **Which attribute in the AndroidManifest.xml file is used to define the minimum Android API
level required by an application?**
- A. android:minApi
- B. android:targetSdkVersion
- C. android:minSdkVersion
- D. android:versionCode
- **Answer:** C. android:minSdkVersion
- A. isNetworkAvailable()
- B. checkConnection()
- C. getActiveNetworkInfo()
- D. isConnected()
- **Answer:** C. getActiveNetworkInfo()
55. **Which of the following Android features allows apps to share data with other apps?**
- A. ContentResolver
- B. BroadcastReceiver
- C. ContentProvider
- D. Service
- **Answer:** C. ContentProvider
57. **Which class in Android is used to schedule tasks to be executed in the future?**
- A. Handler
Madan Kafley
MCQ Mobile Programming
- B. AsyncTask
- C. ScheduledExecutorService
- D. AlarmManager
- **Answer:** D. AlarmManager
58. **What is the main advantage of using `Kotlin` over `Java` for Android development?**
59. **Which of the following is a constraint-based layout in Android that helps in building
complex user interfaces?**
- A. LinearLayout
- B. RelativeLayout
- C. ConstraintLayout
- D. FrameLayout
- **Answer:** C. ConstraintLayout
60. **Which method is used to save the state of an activity when it is about to be destroyed?**
- A. onSaveInstanceState()
- B. onPause()
- C. onStop()
- D. onDestroy()
- **Answer:** A. onSaveInstanceState()
61. **Which Android component is responsible for managing the app's global state?**
- A. Application
- B. Activity
- C. Service
Madan Kafley
MCQ Mobile Programming
- D. ContentProvider
- **Answer:** A. Application
- D. To handle UI rendering
- A. onCreateViewHolder()
- B. onBindViewHolder()
- C. onCreate()
- D. onStart()
- **Answer:** B. onBindViewHolder()
- A. Socket
- B. HttpURLConnection
- C. ContentProvider
- D. Intent
- **Answer:** B. HttpURLConnection
Madan Kafley
MCQ Mobile Programming
66. **Which attribute in Android is used to specify the layout direction of a `View`?**
- A. android:gravity
- B. android:layoutDirection
- C. android:orientation
- D. android:layout_gravity
- **Answer:** B. android:layoutDirection
68. **Which of the following is a key benefit of using `Data Binding` in Android?**
- A. Improved networking
- A. ContentProvider
- B. SQLiteDatabase
- C. SQLiteHelper
- D. DatabaseHelper
- **Answer:** B. SQLiteDatabase
Madan Kafley
MCQ Mobile Programming
71. **Which of these components is used for building flexible UI layouts that adapt to different
screen sizes in Android?**
- A. ConstraintLayout
- B. LinearLayout
- C. RelativeLayout
- D. FrameLayout
- **Answer:** A. ConstraintLayout
- A. Activity
- B. ViewPager
- C. FragmentManager
- D. AppCompatActivity
- **Answer:** C. FragmentManager
Madan Kafley
MCQ Mobile Programming
75. **Which of these Android components can be used to create a user input form?**
- A. TextView
- B. EditText
- C. Button
- D. ListView
- **Answer:** B. EditText
76. **Which tool is used to inspect the layout hierarchy of an Android app at runtime?**
- A. Android Profiler
- B. Layout Inspector
- C. Logcat
- D. Lint
77. **Which method is called when the `Fragment` is no longer in use and is being removed?**
- A. onPause()
- B. onDestroyView()
- C. onDetach()
- D. onStop()
- **Answer:** B. onDestroyView()
- A. IntentService
- B. ContentProvider
- C. BroadcastReceiver
- D. Activity
- **Answer:** C. BroadcastReceiver
79. **Which Android class is used to handle UI-related events on the main thread?**
Madan Kafley
MCQ Mobile Programming
- A. Thread
- B. Handler
- C. AsyncTask
- D. Service
- **Answer:** B. Handler
- A. RecyclerView
- B. Retrofit
- C. ViewModel
- D. Picasso
- **Answer:** C. ViewModel
- A. Gson
- B. Retrofit
- C. Glide
- D. Realm
- **Answer:** B. Retrofit
- A. LinearLayout
- B. RelativeLayout
- C. FrameLayout
- D. ConstraintLayout
- **Answer:** D. ConstraintLayout
- A. startActivity()
Madan Kafley
MCQ Mobile Programming
- B. onStart()
- C. onCreate()
- D. startService()
- **Answer:** A. startActivity()
- A. RecyclerView
- B. CardView
- C. GridView
- D. ScrollView
- **Answer:** A. RecyclerView
- A. onCreate()
- B. onResume()
- C. onRestart()
- D. onPause()
- **Answer:** A. onCreate()
87. **Which of the following is a library used for image loading in Android?**
- A. OkHttp
- B. Picasso
- C. Retrofit
- D. ButterKnife
Madan Kafley
MCQ Mobile Programming
- **Answer:** B. Picasso
88. **Which tool in Android Studio is used to analyze the memory usage of an app?**
- A. Logcat
- B. Memory Profiler
- C. Lint
- D. Layout Inspector
- A. onCreateOptionsMenu()
- B. onCreate()
- C. onStart()
- D. onResume()
- **Answer:** A. onCreateOptionsMenu()
- A. BroadcastReceiver
- B. ContentProvider
- C. ViewModel
- D. AsyncTask
- **Answer:** C. ViewModel
91. **Which of these is a lightweight solution for managing background tasks in Android?**
- A. IntentService
- B. AsyncTask
- C. JobScheduler
- D. Handler
- **Answer:** B. AsyncTask
Madan Kafley
MCQ Mobile Programming
92. **Which of the following is an advantage of using `Room` for database management in
Android?**
93. **Which of these Android classes is used to manage multiple back stacks for
`Fragments`?**
- A. FragmentManager
- B. ViewPager
- C. NavController
- D. TabLayout
- **Answer:** C. NavController
- A. stopService()
- B. stopSelf()
- C. onStop()
- D. finish()
- **Answer:** B. stopSelf()
95. **Which of the following Android components helps in building adaptive UIs that can be
adjusted for various screen sizes and orientations?**
- A. ConstraintLayout
- B. LinearLayout
- C. RelativeLayout
- D. TableLayout
- **Answer:** A. ConstraintLayout
Madan Kafley
MCQ Mobile Programming
96. **Which component in Android is used to handle broadcasts and react to system-wide
events?**
- A. Service
- B. Activity
- C. BroadcastReceiver
- D. ContentProvider
- **Answer:** C. BroadcastReceiver
97. **Which of the following classes is used for JSON parsing in Android?**
- A. JSONArray
- B. JsonParser
- C. JSONObject
- D. JsonReader
- **Answer:** C. JSONObject
- A. Retrofit
- B. Dagger
- C. Glide
- D. Picasso
- **Answer:** B. Dagger
- A. onCreate()
- B. onStart()
- C. onStartCommand()
- D. onBind()
- **Answer:** A. onCreate()
100. **Which Android class is used to access and modify preferences data?**
- A. SharedPreferences
Madan Kafley
MCQ Mobile Programming
- B. SQLiteDatabase
- C. ContentProvider
- D. PreferenceManager
- **Answer:** A. SharedPreferences
101. **Which Android tool can be used to simulate different device configurations for testing?**
- A. Android Emulator
- B. Layout Inspector
- C. Logcat
- D. ADB
103. **Which method is called when an Android Activity is about to become visible?**
- A. onCreate()
- B. onStart()
- C. onResume()
- D. onPause()
- **Answer:** B. onStart()
104. **Which component is used in Android to manage local databases with an object-
relational mapping (ORM) approach?**
- A. SQLite
- B. Room
Madan Kafley
MCQ Mobile Programming
- D. Realm
- **Answer:** B. Room
105. **Which layout in Android allows the stacking of views in a linear order, either horizontally
or vertically?**
- A. LinearLayout
- B. FrameLayout
- C. ConstraintLayout
- D. RelativeLayout
- **Answer:** A. LinearLayout
106. **Which Android class is responsible for handling the display of a list of items with a fixed
number of views that can be recycled?**
- A. ListView
- B. RecyclerView.Adapter
- C. GridView
- D. ViewPager
- **Answer:** B. RecyclerView.Adapter
107. **What is the main advantage of using `ConstraintLayout` over other layouts in
Android?**
- A. Easier to use
- B. Better performance
108. **Which Android framework is used to schedule tasks that should be run in the
background at a later time?**
- A. JobScheduler
- B. AlarmManager
- C. WorkManager
Madan Kafley
MCQ Mobile Programming
- D. IntentService
- **Answer:** C. WorkManager
109. **Which is the best practice to save large files such as images and videos locally in an
Android app?**
- A. SharedPreferences
- B. Internal Storage
- C. External Storage
- D. SQLite Database
- A. IntentService
- B. BroadcastReceiver
- C. PendingIntent
- D. LocalBroadcastManager
- **Answer:** D. LocalBroadcastManager
112. **Which Android component is best suited for showing a quick message to the user that
will disappear after a few seconds?**
- A. AlertDialog
- B. Snackbar
- C. Toast
- D. Notification
- **Answer:** C. Toast
Madan Kafley
MCQ Mobile Programming
113. **Which Android component should be used to execute code that needs to run
periodically?**
- A. Thread
- B. AsyncTask
- C. Handler
- D. AlarmManager
- **Answer:** D. AlarmManager
114. **Which Android component is responsible for receiving and processing SMS messages?**
- A. Activity
- B. Service
- C. BroadcastReceiver
- D. ContentProvider
- **Answer:** C. BroadcastReceiver
115. **Which Android class is used to interact with the system clipboard?**
- A. ClipboardManager
- B. InputMethodManager
- C. WindowManager
- D. NotificationManager
- **Answer:** A. ClipboardManager
116. **Which method is used to check if a device has internet connectivity in an Android app?**
- A. getActiveNetworkInfo()
- B. isConnected()
- C. checkConnectivity()
- D. getNetworkStatus()
- **Answer:** A. getActiveNetworkInfo()
Madan Kafley
MCQ Mobile Programming
- A. `<string name="app_name">MyApp</string>`
- B. `<text name="app_name">MyApp</text>`
- C. `<value name="app_name">MyApp</value>`
- D. `<resource name="app_name">MyApp</resource>`
- A. loadUrl()
- B. loadWebPage()
- C. navigateToUrl()
- D. showUrl()
- **Answer:** A. loadUrl()
119. **Which component in Android is used to perform long-running operations that don’t
require UI interaction?**
- A. AsyncTask
- B. Service
- C. HandlerThread
- D. IntentService
- **Answer:** B. Service
- A. unregisterReceiver()
- B. stopReceiver()
- C. destroyReceiver()
- D. cancelReceiver()
- **Answer:** A. unregisterReceiver()
- A. make()
- B. show()
Madan Kafley
MCQ Mobile Programming
- C. display()
- D. present()
- **Answer:** B. show()
122. **Which Android component is typically used to build custom views that are not part of the
standard Android SDK?**
- A. Fragment
- B. Activity
- C. ViewGroup
- D. View
- **Answer:** D. View
123. **Which Android method is called when an Activity is no longer visible to the user?**
- A. onPause()
- B. onStop()
- C. onDestroy()
- D. onFinish()
- **Answer:** B. onStop()
124. **Which XML attribute is used to set the gravity of a view in Android?**
- A. android:layout_gravity
- B. android:gravity
- C. android:layout_weight
- D. android:layout_align
- **Answer:** B. android:gravity
125. **Which Android class is used to launch another activity and expect a result in return?**
- A. Intent
- B. ActivityResultLauncher
- C. PendingIntent
- D. ActivityManager
Madan Kafley
MCQ Mobile Programming
- **Answer:** B. ActivityResultLauncher
126. **Which Android file is used to define the version code and version name of an app?**
- A. build.gradle
- B. AndroidManifest.xml
- C. strings.xml
- D. res/layout/activity_main.xml
- **Answer:** A. build.gradle
127. **Which layout manager should be used with RecyclerView for creating a grid of items?**
- A. LinearLayoutManager
- B. GridLayoutManager
- C. StaggeredGridLayoutManager
- D. FlexboxLayoutManager
- **Answer:** B. GridLayoutManager
- A. RecyclerView
- B. ExpandableListView
- C. GridView
- D. ListView
- **Answer:** B. ExpandableListView
129. **Which Android method is used to check if a particular permission has been granted?**
- A. checkPermission()
- B. requestPermissions()
- C. isPermissionGranted()
- D. ContextCompat.checkSelfPermission()
- **Answer:** D. ContextCompat.checkSelfPermission()
Madan Kafley
MCQ Mobile Programming
- A. FragmentManager
- B. FragmentTransaction
- C. FragmentPagerAdapter
- D. FragmentStatePagerAdapter
- **Answer:** A. FragmentManager
- A. SharedPreferences
- B. Internal Storage
- C. External Storage
- D. SQLite
- **Answer:** A. SharedPreferences
132. **Which Android component is used to capture photos or videos directly within an app?**
- A. Camera
- B. MediaRecorder
- C. CameraX
- D. MediaPlayer
- **Answer:** C. CameraX
133. **Which Android lifecycle method is called first when an activity is launched?**
- A. onStart()
- B. onCreate()
- C. onResume()
- D. onRestart()
- **Answer:** B. onCreate()
134. **Which class is used to create a media player in Android that can play audio and video
files?**
- A. MediaPlayer
- B. AudioManager
Madan Kafley
MCQ Mobile Programming
- C. VideoView
- D. MediaSession
- **Answer:** A. MediaPlayer
- A. ProgressDialog.show()
- B. ProgressBar.start()
- C. Dialog.show()
- D. ProgressDialog.start()
- **Answer:** A. ProgressDialog.show()
137. **Which Android feature allows apps to use system resources such as CPU, network, and
memory more efficiently by splitting into multiple processes?**
- A. Multiprocessing
- B. IntentService
- C. WorkManager
- D. Multithreading
- **Answer:** D. Multithreading
138. **Which Android UI component is used to display web pages inside an app?**
- A. WebView
- B. ViewPager
- C. TextView
- D. Fragment
Madan Kafley
MCQ Mobile Programming
- **Answer:** A. WebView
139. **Which protocol is commonly used in Android for inter-process communication (IPC)?**
- A. JSON
- B. HTTP
- D. REST
- **Answer:** C. AIDL
- A. startService()
- B. bindService()
- C. launchService()
- D. runService()
- **Answer:** A. startService()
141. **Which Android class is used for handling network operations in a background thread?**
- A. HttpClient
- B. AsyncTask
- C. Socket
- D. HttpURLConnection
- **Answer:** B. AsyncTask
142. **Which Android tool helps in optimizing the layout by removing unnecessary
components?**
- A. Lint
- B. ProGuard
- C. Layout Inspector
- D. ADB
- **Answer:** A. Lint
Madan Kafley
MCQ Mobile Programming
143. **Which Android API is used to store and retrieve small sets of key-value pairs?**
- A. DataStore
- B. SharedPreferences
- C. Room
- D. SQLite
- **Answer:** B. SharedPreferences
144. **Which Android component allows running multiple activities in a single window?**
- A. Fragment
- B. ActivityGroup
- C. TabActivity
- D. SplitActivity
- **Answer:** A. Fragment
145. **Which Android architecture component is responsible for managing UI-related data in a
lifecycle-conscious way?**
- A. ViewModel
- B. LiveData
- C. Room
- D. DataBinding
- **Answer:** A. ViewModel
146. **Which method is used to retrieve the orientation of the screen in Android?**
- A. getOrientation()
- B. getScreenRotation()
- C. getRotation()
- D. getDisplayOrientation()
- **Answer:** C. getRotation()
Madan Kafley
MCQ Mobile Programming
- D. Background Service
148. **Which Android feature allows apps to share data with other apps securely?**
- A. ContentProvider
- B. BroadcastReceiver
- C. IntentService
- D. SharedPreferences
- **Answer:** A. ContentProvider
- A. Exception
- B. RuntimeException
- C. CustomException
- D. Throwable
- **Answer:** B. RuntimeException
150. **Which Android tool is used to view the logs generated by the app during execution?**
- A. Logcat
- B. Debugger
- C. Profiler
- D. TraceView
- **Answer:** A. Logcat
---
Madan Kafley