0% found this document useful (0 votes)
20 views

Mobile Programming MCQs

The document contains a series of multiple-choice questions (MCQs) related to mobile programming, specifically focusing on Android development concepts and components. It covers various topics including application architecture, data persistence, UI components, and lifecycle methods. Each question is followed by the correct answer, providing a comprehensive overview of essential Android programming knowledge.

Uploaded by

Madan Kafley
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

Mobile Programming MCQs

The document contains a series of multiple-choice questions (MCQs) related to mobile programming, specifically focusing on Android development concepts and components. It covers various topics including application architecture, data persistence, UI components, and lifecycle methods. Each question is followed by the correct answer, providing a comprehensive overview of essential Android programming knowledge.

Uploaded by

Madan Kafley
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

MCQ Mobile Programming

### **Mobile Programming MCQs**

1. **Which component is NOT part of Android's application architecture?**

- A. Activities

- B. Services

- C. Web Server

- D. Content Providers

- **Answer:** C. Web Server

2. **Which of the following is used to persist data in an Android application?**

- A. Intent

- B. SharedPreferences

- C. Broadcast Receiver

- D. Service

- **Answer:** B. SharedPreferences

3. **Which file is the entry point for an Android application?**

- A. activity_main.xml

- B. MainActivity.java

- C. AndroidManifest.xml

- D. strings.xml

- **Answer:** C. AndroidManifest.xml

4. **Which of these is NOT a valid Android component?**

- A. Activity

- B. BroadcastReceiver

- C. Service

- D. Adapter

- **Answer:** D. Adapter

Madan Kafley
MCQ Mobile Programming

5. **Which method is used to launch a new activity in Android?**

- A. startActivity()

- B. startNewActivity()

- C. launchActivity()

- D. beginActivity()

- **Answer:** A. startActivity()

6. **What is the purpose of `RecyclerView` in Android?**

- A. To manage a set of radio buttons

- B. To manage and display large datasets

- C. To handle background services

- D. To manage a layout's lifecycle

- **Answer:** B. To manage and display large datasets

7. **What is the main purpose of `Intent` in Android?**

- A. To provide a UI for the user

- B. To handle background services

- C. To communicate between components

- D. To manage database operations

- **Answer:** C. To communicate between components

8. **Which database is natively supported in Android?**

- A. MySQL

- B. SQLite

- C. PostgreSQL

- D. Oracle

- **Answer:** B. SQLite

9. **What is the purpose of the `ContentProvider` in Android?**

- A. To store UI layouts

- B. To provide access to a central data repository

Madan Kafley
MCQ Mobile Programming

- C. To manage notifications

- D. To handle app permissions

- **Answer:** B. To provide access to a central data repository

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

12. **What does the `R` class in Android represent?**

- A. Resources of the application

- B. RecyclerView

- C. Runnable interfaces

- D. Runtime permissions

- **Answer:** A. Resources of the application

13. **Which method must be implemented by all fragments?**

- A. onCreateView()

- B. onResume()

- C. onPause()

- D. onStart()

- **Answer:** A. onCreateView()

Madan Kafley
MCQ Mobile Programming

14. **Which attribute is used to define the ID of an Android view?**

- 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

16. **Which method is used to show a Toast message in Android?**

- A. Toast.makeText()

- B. Toast.showMessage()

- C. Toast.display()

- D. Toast.pop()

- **Answer:** A. Toast.makeText()

17. **What is the main use of the `ViewHolder` pattern in Android?**

- A. To handle touch events

- B. To reduce the number of `findViewById` calls

- C. To manage app permissions

- D. To control activity lifecycles

- **Answer:** B. To reduce the number of `findViewById` calls

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

- **Answer:** B. Density-independent Pixel

20. **Which method is used to request runtime permissions in Android?**

- A. checkSelfPermission()

- B. requestPermission()

- C. requestPermissions()

- D. askPermission()

- **Answer:** C. requestPermissions()

21. **Which of these is an example of an implicit intent in Android?**

- A. Starting an activity

- B. Opening a web page in a browser

- C. Binding a service

- D. Starting a background task

- **Answer:** B. Opening a web page in a browser

22. **Which component in Android is responsible for handling UI-related tasks?**

- A. Service

- B. ContentProvider

- C. BroadcastReceiver

- D. Activity

Madan Kafley
MCQ Mobile Programming

- **Answer:** D. Activity

23. **Which keyword is used to declare a constant in Kotlin?**

- 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

- **Answer:** C. Android Studio

25. **What is the purpose of the `ProGuard` tool in Android?**

- A. To monitor network traffic

- B. To obfuscate and shrink the app's code

- C. To track memory usage

- D. To optimize app performance

- **Answer:** B. To obfuscate and shrink the app's code

26. **Which of the following is NOT a lifecycle method in Android?**

- A. onStart()

- B. onPause()

- C. onResume()

- D. onBegin()

- **Answer:** D. onBegin()

27. **What is the purpose of the `@Override` annotation in Android?**

Madan Kafley
MCQ Mobile Programming

- A. To define a method as deprecated

- B. To indicate that a method is overriding a method in a superclass

- C. To define a new method

- D. To specify a return type for a method

- **Answer:** B. To indicate that a method is overriding a method in a superclass

28. **Which version of Android introduced Material Design?**

- A. Lollipop (5.0)

- B. KitKat (4.4)

- C. Jelly Bean (4.1)

- D. Marshmallow (6.0)

- **Answer:** A. Lollipop (5.0)

29. **What is the function of `Logcat` in Android development?**

- A. To edit XML files

- B. To monitor log messages

- C. To compile the app

- D. To deploy the app on a device

- **Answer:** B. To monitor log messages

30. **Which method in Android is used to destroy an activity?**

- A. onDestroy()

- B. finish()

- C. close()

- D. stop()

- **Answer:** B. finish()

31. **Which of the following is a lightweight, efficient database in Android?**

- 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

33. **Which of the following is a base class for layouts in Android?**

- A. ViewGroup

- B. View

- C. Context

- D. Fragment

- **Answer:** A. ViewGroup

34. **What is the primary use of the `Parcelable` interface in Android?**

- A. To serialize objects

- B. To enable data to be passed between activities

- C. To compress data

- D. To define custom views

- **Answer:** B. To enable data to be passed between activities

35. **Which Android version introduced runtime permissions?**

- A. Marshmallow (6.0)

- B. Lollipop (5.0)

- C. KitKat (4.4)

Madan Kafley
MCQ Mobile Programming

- D. Jelly Bean (4.1)

- **Answer:** A. Marshmallow (6.0)

36. **Which class in Android is used to create and manage threads?**

- A. Thread

- B. AsyncTask

- C. Handler

- D. Looper

- **Answer:** A. Thread

37. **What is the purpose of `ANR` in Android?**

- A. App Not Running

- B. Application Not Responding

- C. Android Network Recovery

- D. Async Network Request

- **Answer:** B. Application Not Responding

38. **Which of the following statements is true about `Kotlin`?**

- A. Kotlin can only be used for Android development.

- B. Kotlin is interoperable with Java.

- C. Kotlin is not supported by Android Studio.

- D. Kotlin is a functional programming language only.

- **Answer:** B. Kotlin is interoperable with Java

39. **Which tool is used to monitor the performance of an Android application?**

- A. Lint

- B. Logcat

- C. Android Profiler

- D. ProGuard

- **Answer:** C. Android Profiler

Madan Kafley
MCQ Mobile Programming

40. **Which of the following is an advantage of using `Data Binding` in Android?**

- A. Faster UI rendering

- B. Easier debugging

- C. Improved code readability

- D. Reduced boilerplate code

- **Answer:** D. Reduced boilerplate code

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

42. **In Android development, what is `LiveData` primarily used for?**

- A. To handle background tasks

- B. To observe and update UI based on data changes

- C. To manage memory leaks

- D. To parse JSON data

- **Answer:** B. To observe and update UI based on data changes

43. **Which of the following is a key feature of Android Jetpack?**

- A. Modular components

- B. Enhanced graphics rendering

- C. Improved networking capabilities

- D. Real-time data analytics

- **Answer:** 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

46. **What is the purpose of the `Navigation Component` in Android?**

- A. To manage app settings

- B. To handle background tasks

- C. To facilitate in-app navigation

- D. To manage network requests

- **Answer:** C. To facilitate in-app navigation

47. **Which of these is NOT a lifecycle state in Android?**

- A. Started

- B. Running

- C. Paused

- D. Resumed

- **Answer:** B. Running

48. **Which of the following statements is true about `ViewModel` in Android?**

- A. It is used to manage the lifecycle of an activity.

- B. It is designed to store and manage UI-related data in a lifecycle-conscious way.

- C. It is primarily used for database operations.

- D. It handles network operations for the application.

Madan Kafley
MCQ Mobile Programming

- **Answer:** B. It is designed to store and manage UI-related data in a lifecycle-conscious


way.

49. **Which method is called when an Android activity is first created?**

- 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

- **Answer:** 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

52. **Which method in Android is called to create a fragment's UI?**

- 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

54. **Which method is used to check if a network connection is available in Android?**

- 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

56. **What is the purpose of the `Dex` compiler in Android development?**

- A. To compile XML files

- B. To convert Java bytecode into Dalvik bytecode

- C. To compile C++ code

- D. To manage app permissions

- **Answer:** B. To convert Java bytecode into Dalvik bytecode

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?**

- A. Kotlin has more libraries.

- B. Kotlin offers null safety and concise syntax.

- C. Kotlin is faster than Java.

- D. Kotlin is supported by more platforms.

- **Answer:** B. Kotlin offers null safety and concise syntax.

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

62. **In Android, what is the purpose of the `Looper` class?**

- A. To loop through a collection

- B. To manage background tasks

- C. To run messages in a queue on a thread

- D. To handle UI rendering

- **Answer:** C. To run messages in a queue on a thread

63. **What is the main use of the `ViewStub` class in Android?**

- A. To dynamically load UI components at runtime

- B. To improve performance by deferring the inflation of UI elements

- C. To handle network requests

- D. To display a temporary message

- **Answer:** B. To improve performance by deferring the inflation of UI elements

64. **Which method in Android is used to bind data to a `RecyclerView`?**

- A. onCreateViewHolder()

- B. onBindViewHolder()

- C. onCreate()

- D. onStart()

- **Answer:** B. onBindViewHolder()

65. **Which of the following is used to make an HTTP request in Android?**

- 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

67. **What is the purpose of the `@Nullable` annotation in Android?**

- A. To indicate that a method can return null

- B. To prevent a method from returning null

- C. To enforce null checks at compile time

- D. To create a new instance of a class

- **Answer:** A. To indicate that a method can return null

68. **Which of the following is a key benefit of using `Data Binding` in Android?**

- A. Improved networking

- B. Faster app startup

- C. Binding UI components directly to data sources

- D. Improved memory management

- **Answer:** C. Binding UI components directly to data sources

69. **Which Android class is used to work with SQLite databases?**

- A. ContentProvider

- B. SQLiteDatabase

- C. SQLiteHelper

- D. DatabaseHelper

- **Answer:** B. SQLiteDatabase

70. **Which of the following is an advantage of using `LiveData` in Android?**

- A. Handles data persistence automatically

- B. Is lifecycle-aware and updates the UI only when the UI is active

Madan Kafley
MCQ Mobile Programming

- C. Simplifies background threading

- D. Improves network requests

- **Answer:** B. Is lifecycle-aware and updates the UI only when the UI is active

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

72. **What is the purpose of `WorkManager` in Android?**

- A. To manage background tasks that need guaranteed execution

- B. To handle user interface updates

- C. To manage app permissions

- D. To improve network performance

- **Answer:** A. To manage background tasks that need guaranteed execution

73. **Which Android component is responsible for managing a group of `Fragments`?**

- A. Activity

- B. ViewPager

- C. FragmentManager

- D. AppCompatActivity

- **Answer:** C. FragmentManager

74. **What is the function of `SharedPreferences` in Android?**

- A. To store large amounts of data

- B. To manage app permissions

- C. To store key-value pairs of primitive data types

- D. To share data between applications

Madan Kafley
MCQ Mobile Programming

- **Answer:** C. To store key-value pairs of primitive data types

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

- **Answer:** B. Layout Inspector

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()

78. **Which Android component is used to broadcast system-wide events?**

- 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

80. **Which of the following is an Android architecture component?**

- A. RecyclerView

- B. Retrofit

- C. ViewModel

- D. Picasso

- **Answer:** C. ViewModel

81. **Which of these is an Android library for making network requests?**

- A. Gson

- B. Retrofit

- C. Glide

- D. Realm

- **Answer:** B. Retrofit

82. **Which Android layout is best for creating a UI

with overlapping elements?**

- A. LinearLayout

- B. RelativeLayout

- C. FrameLayout

- D. ConstraintLayout

- **Answer:** D. ConstraintLayout

83. **Which Android method is used to start a new activity?**

- A. startActivity()

Madan Kafley
MCQ Mobile Programming

- B. onStart()

- C. onCreate()

- D. startService()

- **Answer:** A. startActivity()

84. **What is the primary use of the `Intent` class in Android?**

- A. To handle user interactions

- B. To navigate between activities and pass data

- C. To manage database connections

- D. To start background services

- **Answer:** B. To navigate between activities and pass data

85. **Which Android class is used to display a list of items?**

- A. RecyclerView

- B. CardView

- C. GridView

- D. ScrollView

- **Answer:** A. RecyclerView

86. **Which of these is a lifecycle method of an Android `Service`?**

- 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

- **Answer:** B. Memory Profiler

89. **Which method is used to inflate a menu resource in an Android Activity?**

- A. onCreateOptionsMenu()

- B. onCreate()

- C. onStart()

- D. onResume()

- **Answer:** A. onCreateOptionsMenu()

90. **Which of these Android components is lifecycle-aware?**

- 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?**

- A. No need for SQL queries

- B. Provides compile-time verification of SQLite queries

- C. Faster than SQLite

- D. Better memory management

- **Answer:** B. Provides compile-time verification of SQLite queries

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

94. **Which method is used to stop an Android Service?**

- 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

98. **Which Android library is used for dependency injection?**

- A. Retrofit

- B. Dagger

- C. Glide

- D. Picasso

- **Answer:** B. Dagger

99. **Which method is called when an Android `Service` is first created?**

- 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

- **Answer:** A. Android Emulator

102. **What is the primary purpose of the Android `Manifest` file?**

- A. To define the UI layout

- B. To declare app components and permissions

- C. To store user preferences

- D. To manage app resources

- **Answer:** B. To declare app components and permissions

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

- C. Firebase Realtime Database

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

- C. More flexible for complex layouts

- D. Built-in data binding

- **Answer:** C. More flexible for complex layouts

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

- **Answer:** C. External Storage

110. **Which Android class can be used to broadcast a custom intent?**

- A. IntentService

- B. BroadcastReceiver

- C. PendingIntent

- D. LocalBroadcastManager

- **Answer:** D. LocalBroadcastManager

111. **What is the purpose of the `ProGuard` tool in Android development?**

- A. To increase app performance

- B. To shrink and obfuscate code

- C. To debug the application

- D. To manage app resources

- **Answer:** B. To shrink and obfuscate code

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()

117. **Which is a correct way to define a string resource in Android?**

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>`

- **Answer:** A. `<string name="app_name">MyApp</string>`

118. **Which method is used to load a URL in a WebView component in Android?**

- 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

120. **Which Android method is used to unregister a BroadcastReceiver?**

- A. unregisterReceiver()

- B. stopReceiver()

- C. destroyReceiver()

- D. cancelReceiver()

- **Answer:** A. unregisterReceiver()

121. **Which method is used to display a `Snackbar` in Android?**

- 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

128. **Which Android component is used to create an expandable list of items?**

- 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()

130. **Which Android component is used to manage a set of fragments in an activity?**

Madan Kafley
MCQ Mobile Programming

- A. FragmentManager

- B. FragmentTransaction

- C. FragmentPagerAdapter

- D. FragmentStatePagerAdapter

- **Answer:** A. FragmentManager

131. **Which method is used in Android to persist data in key-value pairs?**

- 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

135. **What is the purpose of the `Looper` class in Android?**

- A. To manage threading in Android apps

- B. To manage message queues in threads

- C. To execute network operations

- D. To loop through UI components

- **Answer:** B. To manage message queues in threads

136. **Which method is used to display a progress dialog in Android?**

- 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

- C. AIDL (Android Interface Definition Language)

- D. REST

- **Answer:** C. AIDL

140. **Which method is used to start an Android Service?**

- 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()

147. **Which Android service is used to handle push notifications?**

- A. Google Cloud Messaging (GCM)

Madan Kafley
MCQ Mobile Programming

- B. Firebase Cloud Messaging (FCM)

- C. Android Notification Manager

- D. Background Service

- **Answer:** B. Firebase Cloud Messaging (FCM)

148. **Which Android feature allows apps to share data with other apps securely?**

- A. ContentProvider

- B. BroadcastReceiver

- C. IntentService

- D. SharedPreferences

- **Answer:** A. ContentProvider

149. **Which class is used to create custom exceptions in Android?**

- 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

You might also like