Based Android Question With Answer
Based Android Question With Answer
1.
2.
1. A. XML
2. B. Java
3. C. C++
4. D. Python
5. Correct Answer: A
3.
4.
1. A. Readability
2. B. Ease of use
3. C. Handling user input
4. D. Complexity
5. Correct Answer: C
5.
6.
1. A. RelativeLayout
2. B. TableLayout
3. C. LinearLayout
4. D. GridView
5. Correct Answer: C
7.
8.
10.
1. A. AbsoluteLayout
2. B. FrameLayout
3. C. LinearLayout
4. D. RelativeLayout
5. Correct Answer: A
11.
12.
1. A. SimpleCursorAdapter
2. B. ArrayAdapter
3. C. BaseAdapter
4. D. RecyclerView.Adapter
5. Correct Answer: B
13.
What is the attribute to define the height of dividers between list items in
a ListView?
14.
1. A. android
2. B. android
3. C. android
4. D. android
5. Correct Answer: B
15.
16.
1. A. android
2. B. android
3. C. android
4. D. android
5. Correct Answer: B
17.
18.
1. A. EditText
2. B. TextView
3. C. Button
4. D. ImageButton
5. Correct Answer: B
19.
20.
1. A. AutoCompleteTextView
2. B. Spinner
3. C. ListView
4. D. RadioButton
5. Correct Answer: A
1.
2.
1. A. Options menu
2. B. Context menu
3. C. Popup menu
4. D. Submenu
5. Correct Answer: A
3.
4.
1. A. Options menu
2. B. Context menu
3. C. Popup menu
4. D. Submenu
5. Correct Answer: B
5.
Where should menu items that have a global impact on the app be
placed?
6.
1. A. Context menu
2. B. Options menu
3. C. Popup menu
4. D. Submenu
5. Correct Answer: B
7.
8.
1. A. res/layout/
2. B. res/menu/
3. C. res/values/
4. D. res/xml/
5. Correct Answer: B
9.
What attribute in a menu item specifies when and how the item should
appear as an action item?
10.
1. A. android
2. B. android
3. C. android
4. D. android
5. Correct Answer: D
11.
12.
1. A. <group>
2. B. <item>
3. C. <menu>
4. D. <action>
5. Correct Answer: C
13.
14.
1. A. Using LayoutInflater.inflate()
2. B. Using MenuInflater.inflate()
3. C. Using Activity.inflate()
4. D. Using Context.inflate()
5. Correct Answer: B
15.
16.
1. A. Options menu
2. B. Context menu
3. C. Popup menu
4. D. Submenu
5. Correct Answer: C
17.
18.
1. A. <group>
2. B. <menu>
3. C. <item>
4. D. <action>
5. Correct Answer: A
19.
1. A. <group>
2. B. <menu>
3. C. <item>
4. D. <action>
5. Correct Answer: C
1.
2.
3.
4.
1. A. Notification drawer
2. B. Notification bar
3. C. Notification area
4. D. Home screen
5. Correct Answer: C
5.
6.
1. A. NotificationManager
2. B. NotificationBuilder
3. C. Notification
4. D. NotificationService
5. Correct Answer: C
7.
What method is used to set a small icon for a notification?
8.
1. A. setSmallIcon()
2. B. setIcon()
3. C. setImage()
4. D. setNotificationIcon()
5. Correct Answer: A
9.
10.
1. A. Normal view
2. B. Compact view
3. C. Big view
4. D. Detailed view
5. Correct Answer: C
11.
12.
1. A. NotificationManager
2. B. NotificationBuilder
3. C. Notification.Builder
4. D. NotificationService
5. Correct Answer: C
13.
14.
1. A. Content title
2. B. Large icon
3. C. Content text
4. D. Time
5. Correct Answer: D
15.
Which big view style displays a bitmap up to 256 dp tall?
16.
17.
18.
1. A. A type of notification
2. B. A brief message displayed on the screen
3. C. An alert dialog
4. D. A type of menu
5. Correct Answer: B
19.
20.
1. A. At the bottom
2. B. In the center
3. C. At the top
4. D. On the left side
5. Correct Answer: A
21.
22.
1. A. Toast.show()
2. B. Toast.display()
3. C. Toast.makeText()
4. D. Toast.toast()
5. Correct Answer: A
23.
What is the default duration for a Toast message?
24.
1. A. SHORT
2. B. LONG
3. C. MEDIUM
4. D. INFINITE
5. Correct Answer: A
25.
26.
1. A. Toast.show()
2. B. Toast.display()
3. C. Toast.makeText()
4. D. Toast.create()
5. Correct Answer: C
27.
28.
1. A. Context
2. B. Message
3. C. Duration
4. D. Position
5. Correct Answer: D
29.
30.
1. A. setSmallIcon()
2. B. setContentTitle()
3. C. setContentText()
4. D. setContentInfo()
5. Correct Answer: C
31.
What is the primary purpose of the NotificationManager class?
32.
1. A. To create notifications
2. B. To manage and issue notifications
3. C. To display notifications
4. D. To remove notifications
5. Correct Answer: B
33.
34.
35.
36.
1. A. NotificationManager.cancel()
2. B. Notification.cancel()
3. C. Notification.remove()
4. D. NotificationManager.remove()
5. Correct Answer: A
37.
38.
1. A. RemoteViews
2. B. CustomViews
3. C. ViewGroup
4. D. ViewBuilder
5. Correct Answer: A
39.
Which class is used to define a custom view for a Toast?
40.
1. A. Toast.CustomView
2. B. Toast.CustomToast
3. C. Toast
4. D. Toast.setView()
5. Correct Answer: D
1.
2.
3.
4.
1. A. startActivity()
2. B. startService()
3. C. sendBroadcast()
4. D. startNewActivity()
5. Correct Answer: A
5.
What type of intent is used to start an activity within the same app?
6.
1. A. Explicit Intent
2. B. Implicit Intent
3. C. Internal Intent
4. D. Local Intent
5. Correct Answer: A
7.
8.
1. A. bindActivity()
2. B. bindService()
3. C. startService()
4. D. startBind()
5. Correct Answer: B
9.
10.
1. A. Explicit Intent
2. B. Implicit Intent
3. C. Action Intent
4. D. Service Intent
5. Correct Answer: B
11.
12.
1. A. sendActivity()
2. B. sendService()
3. C. sendBroadcast()
4. D. sendIntent()
5. Correct Answer: C
13.
14.
1. A. Action
2. B. Data
3. C. Type
4. D. Layout
5. Correct Answer: D
15.
16.
17.
18.
1. A. setAction()
2. B. setIntentAction()
3. C. setActivityAction()
4. D. setServiceAction()
5. Correct Answer: A
19.
20.
1. A. To create a new task and launch an activity as the root of the new task
2. B. To launch a new activity in the same task
3. C. To clear the existing task and start a new activity
4. D. To reuse an existing task for the new activity
5. Correct Answer: A
21.
22.
1. A. BroadcastManager
2. B. LocalBroadcastManager
3. C. IntentManager
4. D. NotificationManager
5. Correct Answer: B
23.
24.
1. A. addCategory()
2. B. setCategory()
3. C. putCategory()
4. D. attachCategory()
5. Correct Answer: A
25.
26.
27.
28.
29.
30.
1. A. onActivityResult()
2. B. getActivityResult()
3. C. retrieveActivityResult()
4. D. fetchActivityResult()
5. Correct Answer: A
31.
32.
1. A. startActivity()
2. B. startService()
3. C. sendService()
4. D. startIntentService()
5. Correct Answer: B
33.
Which flag ensures that the target activity is not in the activity stack?
34.
1. A. FLAG_ACTIVITY_CLEAR_TOP
2. B. FLAG_ACTIVITY_NO_HISTORY
3. C. FLAG_ACTIVITY_CLEAR_TASK
4. D. FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
5. Correct Answer: B
35.
36.
37.
38.
1. A. resolveActivity()
2. B. checkActivity()
3. C. findActivity()
4. D. lookupActivity()
5. Correct Answer: A
39.
How do you define an intent filter for an activity in the Android manifest?
40.
Chapter 4
· What is the primary purpose of persistence in data storage for Android apps?
· A) Shared Files
B) Resource Files
C) Public Files
D) System Files
Correct Answer: B
· A) Size
B) Color
C) Location
D) Accessibility
Correct Answer: B
· Which storage option is used for storing private primitive data in key-value
pairs?
· A) Internal Storage
B) External Storage
C) Shared Preferences
D) SQLite Databases
Correct Answer: C
· A) Complex objects
B) Primitive data types
C) Multimedia files
D) SQL tables
Correct Answer: B
· In the provided example, what is the name of the SharedPreferences file used?
· A) MyPrefs
B) UserPrefs
C) DataPrefs
D) ConfigPrefs
Correct Answer: A
· A) putData()
B) saveData()
C) commit()
D) apply()
Correct Answer: C
· A) SQLiteDatabase
B) SQLiteOpenHelper
C) SQLiteManager
D) SQLiteContentProvider
Correct Answer: B
· Which method is called only when creating an SQLite database for the first
time?
· A) onStart()
B) onCreate()
C) onInit()
D) onFirstRun()
Correct Answer: B
· A) onUpdate()
B) onUpgrade()
C) onChange()
D) onModify()
Correct Answer: B
· A) Define Fields
B) Override the Constructor
C) Create a Class that extends SQLiteOpenHelper
D) Perform CRUD operations
Correct Answer: C
· A) ContentProvider
B) ContentValues
C) ValueInserter
D) DatabaseWriter
Correct Answer: B
· A) removeRow()
B) delete()
C) dropRow()
D) erase()
Correct Answer: B
· A) As JSON objects
B) As XML files
C) As key-value pairs
D) As binary data
Correct Answer: C
1.
2.
1. A) LocationProvider
2. B) LocationManager
3. C) LocationService
4. D) Geocoder
5. Correct Answer: B) LocationManager
3.
What is the main purpose of the Geocoder class in Android?
4.
5.
6.
1. A) NETWORK_PROVIDER
2. B) PASSIVE_PROVIDER
3. C) GPS_PROVIDER
4. D) WIFI_PROVIDER
5. Correct Answer: C) GPS_PROVIDER
7.
8.
1. A) getLastKnownPosition()
2. B) getLastKnownLocation()
3. C) getCurrentLocation()
4. D) getLocation()
5. Correct Answer: B) getLastKnownLocation()
9.
10.
1. A) ACCESS_COARSE_LOCATION
2. B) ACCESS_FINE_LOCATION
3. C) ACCESS_NETWORK_STATE
4. D) ACCESS_WIFI_STATE
5. Correct Answer: B) ACCESS_FINE_LOCATION
11.
12.
1. A) GPS
2. B) Wi-Fi
3. C) Bluetooth
4. D) Cellular Network
5. Correct Answer: C) Bluetooth
13.
14.
15.
In which file should the API key for Google Maps be included in an
Android project?
16.
1. A) strings.xml
2. B) build.gradle
3. C) AndroidManifest.xml
4. D) MainActivity.java
5. Correct Answer: C) AndroidManifest.xml
17.
18.
19.
20.
1. A) LocationRequest
2. B) LocationManager
3. C) LocationProvider
4. D) Geocoder
5. Correct Answer: B) LocationManager
21.
22.
1. A) getFromLocation()
2. B) getFromLocationName()
3. C) getAddress()
4. D) getCoordinates()
5. Correct Answer: A) getFromLocation()
23.
What is the main use of the Criteria class in the context of location-based
services?
24.
25.
26.
1. A) requestLocationUpdates()
2. B) getLastKnownLocation()
3. C) getLocation()
4. D) updateLocation()
5. Correct Answer: A) requestLocationUpdates()
27.
28.
29.
30.
1. A) GPS_PROVIDER
2. B) NETWORK_PROVIDER
3. C) PASSIVE_PROVIDER
4. D) WIFI_PROVIDER
5. Correct Answer: D) WIFI_PROVIDER
31.
32.
1. A) List of coordinates
2. B) List of addresses
3. C) Single address
4. D) Single coordinate
5. Correct Answer: B) List of addresses
33.
34.
1. A) LocationProvider
2. B) LocationService
3. C) LocationManager
4. D) Geocoder
5. Correct Answer: C) LocationManager
35.
36.
37.
38.
39.
40.
1. A) ACCESS_FINE_LOCATION
2. B) ACCESS_COARSE_LOCATION
3. C) INTERNET
4. D) ACCESS_NETWORK_STATE
5. Correct Answer: B) ACCESS_COARSE_LOCATION
41.
1. A) An empty list
2. B) null
3. C) A default address
4. D) An exception
5. Correct Answer: B) null
43.
44.
1. A) LocationManager
2. B) GoogleMap
3. C) MapView
4. D) Geocoder
5. Correct Answer: C) MapView
45.
46.
1. A) enableLocation()
2. B) requestLocationUpdates()
3. C) startLocationService()
4. D) beginLocationTracking()
5. Correct Answer: B) requestLocationUpdates()
47.
48.
1. A) setAccuracyLevel()
2. B) setAccuracy()
3. C) setPrecision()
4. D) setLevel()
5. Correct Answer: B) setAccuracy()
49.
What should be included in the manifest to use the Google Maps library
in an Android app?
50.
1. A) <uses-library android:name="com.google.android.maps"/>
2. B) <uses-permission android:name="android.permission.MAPS"/>
3. C) <meta-data android:name="com.google.android.maps"/>
4. D) <application android:name="com.google.android.maps"/>
5. Correct Answer: A) <uses-library android:name="com.google.android.maps"/>
51.
52.
1. A) getProvider()
2. B) getBestProvider()
3. C) getCriteriaProvider()
4. D) getOptimalProvider()
5. Correct Answer: B) getBestProvider()
53.
54.
1. A) NETWORK_PROVIDER
2. B) LocationManager
3. C) Geocoder
4. D) MapView
5. Correct Answer: C) Geocoder
55.
56.
1. A) getFromLocation()
2. B) getFromLocationName()
3. C) getAddress()
4. D) getCoordinates()
5. Correct Answer: B) getFromLocationName()
57.
58.
1. A) To handle geocoding
2. B) To manage location providers and location updates
3. C) To display maps
4. D) To manage API keys
5. Correct Answer: B) To manage location providers and location updates
59.
60.
1. A) ACCESS_FINE_LOCATION
2. B) ACCESS_COARSE_LOCATION
3. C) ACCESS_NETWORK_STATE
4. D) ACCESS_WIFI_STATE
5. Correct Answer: A) ACCESS_FINE_LOCATION
61.
62.
1. A) requestLocationUpdates()
2. B) getLastKnownLocation()
3. C) getFromLocationName()
4. D) getBestProvider()
5. Correct Answer: C) getFromLocationName()
63.
64.
1. A) <uses-library android:name="com.google.android.maps"/>
2. B) <uses-permission android:name="android.permission.MAPS"/>
3. C) <meta-data android:name="com.google.android.maps"/>
4. D) <application android:name="com.google.android.maps"/>
5. Correct Answer: A) <uses-library android:name="com.google.android.maps"/>
65.
What is the default method to get the current location in Android if the
device has multiple providers?
66.
1. A) getBestProvider()
2. B) requestLocationUpdates()
3. C) getLastKnownLocation()
4. D) getProvider()
5. Correct Answer: A) getBestProvider()
67.
68.
69.
70.
71.
72.
1. A) LocationManager
2. B) MapView
3. C) Geocoder
4. D) GoogleMap
5. Correct Answer: C) Geocoder
73.
74.
75.
76.
77.
78.
79.
80.
1. A) <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>
2. B) <uses-permission android:name="android.permission.MAPS"/>
3. C) <uses-library android:name="com.google.android.maps"/>
4. D) <application android:name="com.google.android.maps"/>
5. Correct Answer: A) <uses-permission
android:name="android.permission.ACCESS_FINE_LOCATION"/>