R4RIN
Articles
Java 8
MCQS
Android MCQ Quiz Hub
Android Programming MCQ Set 2
Choose a topic to test your knowledge and improve your Android skills
1. What is the codename of the latest Android platform?
Ice Cream Sandwich
Lollipop
Honeycomb
KitKat
2. invalidateOptionsMenu() method of ActionBarActivity calls:
onPrepareOptionsMenu()
onCreateOptionsMenu()
both (a) and (b)
None of these
3. Is it possible to update this textView as follows ? new Thread(new Runnable() { @Override public void run() { textView.setText("Hello World"); } }).start();
Yes, it is possible and it's recommended to use its own thread to update views
No, because system throws a Fatal Exception: "Only the original thread that created a view hierarchy can touch its views"
both (a) and (b)
None of the above
4. Which method can get the context tied to the lifecycle of the entire application ?
View.getContext()
Activity.this
Activity.getApplicationContext()
ContextWrapper.getBaseContext()
5. AsyncTask methods can run on the UI thread, but one of them doesn't run on this UI thread, which one?
onPreExecute()
publishProgress()
doInBackground()
onPostExecute()
6. What is the latest layout proposed by the android sdk?
GridLayout
RelativeLayout
LinearLayout
DrawerLayout
7. Which type of file are Android layouts read from?
Time's Up!
res
xaml
txt
8. Which of the following system services does Android rely on for the Linux kernel?
Neither security nor network stack
Security
Network stack
Both security and network stack
9. Can the ActionBarCompat library propose ActionBar features for old phones?
No
Yes, it can support devices from level api 2.1
both (a) and (b)
None of the above
10. Which of the following is Android's main programming language ?
Java
JavaScripts
VB-Script
C++
11. Which of the following defines your Android application components?
myApp.xml file
AndroidManifest.pkg file
AndroidManifest.xml file
None of these
12. What should dimensions be specified in so that layouts adapt to any screen size?
Pixels
Density-independent pixels
both (a) and (b)
None of the above
13. What version(s) will you NOT be able to run the app if you set min sdk version to be 8 for an app
7
10
14
12
14. Which database is available for developers in Android?
SQL Server
NoSQL
SQLite
Oracle
15. Which folder should the App Icon be kept under?
src
anim
res
None of These
16. Which extension does the Android Manifest file have?
jar
xml
apk
java
17. Which of the following is the correct way to get pass string in an Intent, where key and value are both string variables?
intent.putString(key,value);
intent.putKey(key,value);; i
intent.putExtra(key,value)
ntent.putValue(key,value);
18. Which is the name of component used to display web pages in the application?
WebView
WebBrowser
BrowserView
Browser
19. Which of these Activity lifecycle events is when the activity is about to become visible to the user from a hidden state?
Start()
onCreate()
Resume()
onStart()
20. Which API should you use to bring the data over to the device asynchronously if you have a fragment which displays a ListViewContaining query results?
android.app.LoaderManager
android.app.ListActivity
android.app.LocalActivityManager
None of the above
21. What is likely to cause the UI to behave sluggishly or crash while making network calls?
Network Latency
Virus on the server
Hardware malfunction
Activity Manager contains too much
22. How can Android applications "borrow" functionality from other applications?
Application lifecyle methods
Intent objects
Content Provider system
None of the above
23. Which event listener is used when an Android device has changed orientation?
OrientationEventListener
https://quizack.com/android-programming/mcq/which-event-listener-is-used-when-an-android-device-has-changed-orientation#:~:text=PositioningEventListener
DeviceOrientationEventListener
LayoutEventListener
24. Which externalizing resources are needed for application development?
Different language versions of the application
None of these
Different devices
All of these
25. Why is a Parcelable used?
To show a message dialog
To store data in SQLite database
To transmit structured objects between activities or fragments
To parse a json file
26. What class does Android use to communicate a request for an action to be performed?
Request
Service
Activity
Intent
27. Which AsyncTask method does not run on the UI thread?
publishProgress()
onPostExecute()
onPreExecute()
doInBackground()
28. Which method is called to notify a Fragment is visible when they are inside a ViewPager?
setUserVisibleHint(boolean isVisibleToUser)
onVisible(boolean isVisible)
onAttach(Activity activity)
isAdded()
29. Which method should be used to refresh the ActionBar if you use ActionBarCompat library?
invalidateOptionsMenu()
invalidateActionBar()
invalidate()
invalidateMenuItems()
30. Which theme's attribute changes the color of the status bar in Lollipop?
android:colorPrimaryDark
android:colorPrimary
android:colorAccent
None of these
31. What is the default behavior of an Activity when you manually rotate the device screen?
The activity is destroyed and reloaded entirely
The activity is remained unchanged
onPause() and onResume() activity callback are called only
onStop() and onStart() activity callback are called only
32. What should you do if you want access list of paired Bluetooth devices on Android?
add <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> to the manifest.xml
add <uses-permission android:name="android.permission.BLUETOOTH" /> permission to the manifest.xml. you can not access paired bluetooth devices list
both (a) and (b)
None of the above
33. Which is a benefit of deodexing?
Custom themes
Remove files
Install custom apps
Speed boost
34. When an asynchronous task is executed, the task goes through several steps. Which option is not a step of an asynchronous task?
onPostExecute()
onPreExecute()
onProgressUpdate()
onBackground()
35. How do you request permission for your application?
<request-permission> in the Android Manifest
<uses-permission> in the Android Manifest
You do not need to request permissions for any application
<requires-permission> in the Android Manifest
36. Which is the build system recommended by Google?
ant
gradle
maven
None of These
37. Which tool of Android sdk allows installing applications, viewing logs and pooling files from Android device?
ddms
Android manager
logcat
adb
38. Which package encompasses the interactive UI components of Android such as buttons and text fields?
android.widget
android.view
android.view.ViewGroup
None of these
39. Which class should you extend when using/creating a database?
SQLiteOpenHelper
SQLiteHelper
SQLiteDatabase
SQLiteDatabasehelper
40. What should you do in order to get paired Bluetooth device list?
Add <user-permission android:name="android.permission.BLUETOOTH_ADMIN" /> permission to the manifest.xml
None of the above
Not possible
Add <user-feature android:name="android.permission.BLUETOOTH" /> feature to the manifest.xml
41. Android naming has followed an alphabetical order from Android 1.0 to Lollipop.
Fully True if you consider first letters of every version release up till Lollipop(5.0)
Partially True if you consider first letters of every version release up till Lollipop(5.0)
False
None of the above
42. Which is the descriptive file that presents essential information about your app to the Android system?
AndroidManifest.xml
local.properties
build.gradle
build.xml
43. What is the message content for Discount: %1$d € String message = context.getString(R.string.discount, 10); ?
Discount: 10% €
Discount: 10 €
Discount: 10%
None of These
44. In which resource folder should we create an animation file?
animation
raw
values
anim
45. Which of the following is not a valid stage in an Activity's lifecycle?
onStop
onPause
onStart
onFinish
46. What is the maximum size of an Android app?
40 mb
4 gb
1.3 gb
100 mb
47. Which callbacks in AsyncTask get executed on main thread?
onProgressUpdate
doInBackground
onPostExecute
both onPostExecute and onProgressUpdate
48. What is the key used for a bundle extra parameter on a PendingIntent holding a location?
public static final String KEY_LOCATION_CHANGED
https://quizack.com/android-programming/mcq/what-is-the-key-used-for-a-bundle-extra-parameter-on-a-pendingintent-holding-a-location#:~:text=public%20static%20final%20String%20KEY_STATUS_CHANGED
public static final String KEY_PROXIMITY_ENTERING
public static final String KEY_PROVIDER_ENABLED
49. Which of the following is a layout that organizes its children into a horizontal or vertical stack?
RelativeLayout
TableLayout
LinearLayout
FrameLayout
50. What is the attribute of EditText called that displays a text that goes away once you write something?
emptyText
hint
description
text
51. Which function is used to send value from one activity to another?
intent.send()
send()
intent.transfer()
intent.putextra()
52. Where should you specify which activity should launch first in your app?
Manifest file
Main Class file
All of the above
Properties file
53. Which method from Activity is used to update the UI ?
runOnUIThread()
invalidateAll()
invalidate()
repaint()
54. C2DM was deprecated and replaced by:
Polling. . .
GCS
GCM
APS.
55. Which manifest uses-configuration should you use if your application requires a finger activated touch screen on the device?
<uses-configuration android:reqNavigation="finger" /> must be in your manifest
<uses-configuration android:reqTouchScreen /> must be in your manifest
<uses-configuration android:reqTouchScreen="finger" /> must be in your manifest
None of the above
56. Which method is called first when an Activity is started?
onCreate();
onStart();
Both a and b
onResume();
57. Which of the following are valid features that you can request using requestWindowFeature?
FEATURE_NO_TITLE
FEATURE_NO_ICON
FEATURE_RIGHT_ICON
FEATURE_NO_MENU
58. Which of the following can be used to bind data from an SQL database to a ListView in an Android application?
SimpleCursor
SimpleCursorAdapter
SimpleAdapter
SQLiteCursor
59. Which of the following would you have to include in your project to use the SimpleAdapter class?
import android.content;
import android.widget;
import android.database;
import android.database.sqlite;
60. What is the purpose of the ContentProvider class?
To play rich media content files.
To create and publish rich media files.
To share data between Android applications.
To access the global information about an application environment.
61. Which of the following is the parent class for the main application class in an Android application that has a user interface?
MIDLet
AndroidApp
Activity
AppLet
62. Which of the following can be accomplished by using the TelephoneNumberUtil class?
Save a phone number to the contacts in the phone device.
Retrieve a phone number from the contacts in the phone device.
Delete a phone number from the contacts in the phone device.
Format an international telephone number.
63. Which of the following is the immediate base class for Activity and Service classes?
Application
ApplicationContext
Contex
Component
64. Which of the following would you have to include in your project to use the APIs and classes required to access the camera on the mobile device?
import android.drivers;
import android.hardware.camera;
import android.camera;
import android.hardware;
65. Which of the following are classes that can be used to handle the Bluetooth functionality on a device?
Adapter
Manager
Matcher
BluetoothAdapter
66. Which of the following are life-cycle methods of an Activity that can be implemented to perform various operations during the lifetime of an Activity?
onCreate
onInit
onPause
All of the above
67. Which of the following should be used to save the unsaved data and release resources being used by an Android application?
Activity.onStop()
Activity.onPause()
Activity.onDestroy()
Activity.onShutdown()
68. Which of the following fields of the Message class should be used to store custom message codes about the Message?
tag
what
arg1
arg2
69. Consider the code snippet below: public class MyReceiver extends PhoneStateIntentReceiver { @Override public void onReceiveIntent(Context context, Intent intent) { if (intent.action == Intent.CALL_ACTION) { } } } Assuming that notifyPhoneCallState has been called to enable MyReceiver to receive notifications about the phone call states, in which of the following cases will the code in get executed?
When the device receives an incoming phone call.
When an outgoing phone call is initiated on the device.
When an incoming phone call is terminated.
The code in will never get executed.
70. Which of the following are true about Intent.CALL_ACTION and Intent.DIAL_ACTION?
Intent.action == Intent.CALL_ACTION is true when a phone call is received on the device.
Intent.action = Intent.CALL_ACTION is used when a phone number is to be dialled without showing a UI on the device.
Intent.action = Intent.DIAL_ACTION is used when a phone number is to be dialled without showing a UI on the device.
Intent.action = Intent.CALL_ACTION is used when a phone number is to be dialled without the user having to explicitly initiate the call.
71. Which of the following can you use to display an HTML web page in an Android application?
WebBrowser
BrowserView
WebView
Browser
72. Which of the following can be used to navigate between screens of different Android applications?
Binder
Flow
Navigate
Intent
73. What is "Android-activityCreator"?
A command line tool to create Android project files.
A framework to create unit tests for Android projects.
A resource editor to create user interface for Android applications.
An emulator to execute and debug Android projects.
74. What is "Android-dx"?
A command line tool to create Android project files.
A framework to create unit tests for Android projects.
A resource editor to create user interface for Android applications.
A tool to generate Android byte code from .class files.
75. Suppose MyView is a class derived from View and mView is a variable of type MyView. Which of the following should be used to display mView when the Android application is started?
Call setCurrentView(mView) in the startApp() of the main application class.
Call setContentView(mView) in the startApp() of the main application class.
Call setContentView(mView) in the startApp() of the main application class.
Call setContentView(mView) in the onCreate() of the main application class.
Submit