Android Programming MCQs

Android Programming MCQs

The following Android Programming MCQs have been compiled by our experts through research, in order to test your knowledge of the subject of Android Programming. We encourage you to answer these multiple-choice questions to assess your proficiency.
Please continue by scrolling down.

1: Which subclass of a Preference class displays a list of entries as a dialog?

A.   ListPreference

B.   MultiSelectListPreference

C.   None of these

D.   Both of these

2: What is an application component that can perform long-running operations in the background and does not provide a user interface?

A.   Broadcast receiver

B.   Content-provider

C.   Activity

D.   Service

3: What is the first method called in the Activity Lifecycle?

A.   onBegin()

B.   onResume()

C.   onInit()

D.   onCreate()

E.   onStart()

4: Which Virtual Machine (VM) does the android system use?

A.   Erlang

B.   VMLite

C.   Dalvik

D.   KVM

5: What is the brand name of Google's own line of Android smartphones?

A.   Galaxy

B.   Nexus

C.   Optimus

D.   Desire

E.   Xperia

6: Which of the following are a function of the manifest file?

A.   declare the level of user permissions required.

B.   declare the minimum API level required

C.   all of these

7: What kernel is Android based on?

A.   Mach Kernel

B.   XNA

C.   NT Kernel

D.   Linux Kernel

8: Your Android application components are defined in the...

A.   myApp.xml file.

B.   AndroidManifest.xml file.

C.   AndroidManifest.pkg file.

9: In order to specify layouts so that they adapt to any screen size, specify dimensions in:

A.   Density-independent pixels

B.   Pixels

10: Which of the following are versions of Android?

A.   Eclair

B.   Gingerbread

C.   All of these

D.   Froyo

11: Which statement correctly changes content of a TextView named textLabel to show "Your Text"?

A.   textLabel.setText("Your Text");

B.   textLabel = "Your Text";

C.   textLabel.text = "Your Text";

D.   textLabel.text("Your Text");

12: The Android Manifest file has what extension?

A.   .jar

B.   .apk

C.   .java

D.   .xml

13: Do you need to buy an android developer account to start developing and testing applications on Android ?

A.   No

B.   Yes

14: Which of the following are different types of Android application components?

A.   all of these

B.   services

C.   activities

D.   none of these

15: An android application can be converted into an IOS application using a desktop application called "And-to-IOS" easily and still get the same result on IOS.

A.   False

B.   True

16: Which of the following is used to detect when a user clicks or taps on a button?

A.   OnTapListener

B.   OnTouchListener

C.   OnClickDetecter

D.   OnClickListener

17: Which of these widgets is an input box for a user to enter text?

A.   Label

B.   TextBox

C.   EditText

D.   TextView

18: Who can submit applications to the Marketplace?

A.   Anyone and everyone

B.   Registered Android Market developers

C.   Only Google employees

D.   Only device manufacturers and their employees

A.   Android Studio

B.   IntelliJ IDEA

C.   Netbeans

D.   Eclipse ADT

20: If you wanted to store a name/value string pair for your Android application, which class would you use?

A.   android.content.Resources

B.   android.content.SharedPreferences

C.   android.content.Cookies

21: Which is NOT a default value used for a Toast length parameter?

A.   LENGTH_SMALL

B.   LENGTH_LONG

C.   LENGTH_SHORT

22: The Android SDK tools compile your application into an Android application (.apk file) which...

A.   contains all the information needed to install the application on an Android device.

B.   then has to be formatted for installation through the Android installer.

C.   contains information needed by the Universal Mobile Installer to create the install package for Android devices.

23: In activity A if you start Activity B with result you should override

A.   onActivityResult(int requestCode, int resultCode, Intent data) on Activity A

B.   onResultedActivity(int requestCode, int resultCode, Intent data) on Activity B onResultedActivity(int requestCode, int resultCode, Intent data) on Activity A none of the above

24: What is the main hardware platform of Android?

A.   None of these

B.   MIPS

C.   x86

D.   ARM architecture

25: True or False? It is possible to give the preferred install location, internal or external memory, in the manifest.xml

A.   true

B.   false

26: If your application uses the camera on an Android powered device, the following line should be in your manifest file:

A.   <uses-feature android:name="android.hardware.camera" />

B.   <uses-feature="android.hardware.camera" />

C.   <uses-feature name="camera" />

27: What is the proper order of life cycle methods called when an Activity is first run?

A.   onStart(), onResume, onCreate()

B.   onCreate(), onRestart(), onResume()

C.   onCreate(), onResume(), onStart()

D.   onCreate(), onStart(), onResume()

E.   onStart(), onCreate(), onResume()

28: In which resource folder do we create an animation file ?

A.   drawable

B.   raw

C.   anim

D.   animation

E.   values

29: In order to be notified of a device switching from landscape to portrait view, you should:

A.   Both of these

B.   Override the onConfigurationChanged event

C.   Request changes via the android:configChanges="orientation" attribute for activities in your manifest file

30: True or False: The Android operating system is a multi-user Linux system in which each application is a different user.

A.   False

B.   True

31: How do you disable the scrollbars for a webview?

A.   all of these

B.   <WebView android:layout_height="wrap_content" />

C.   <WebView android:scrollbars="none" />

D.   <WebView android:layout_width="wrap_content" />

32: Is it possible to include code written in C?

A.   Yes

B.   No

33: What permission does your application need to use the network?

A.   android.permission.INTERNET

B.   android.permission.NETWORK

C.   android.security.NETWORK

D.   The network features do not require a permission

E.   android.security.INTERNET

34: What is the name of the main thread in Android

A.   Working Thread

B.   Main Thread

C.   UI thread

35: Which tag is used to add "Star Rating" in XML layout file?

A.   Stars

B.   RatingWidget

C.   RatingBar

D.   Rating

36: Which layout is deprecated since version 2.3?

A.   Frame Layout

B.   Absolute Layout

C.   Table Layout

D.   Relative Layout

37: Every Android application runs in its own process...

A.   within a shared system wide instance of the Dalvik Virtual Machine.

B.   with its own instance of the Dalvik Virtual Machine.

C.   with its own instance of the Java Virtual Machine.

38: What causes an Activity's onDestroy() method to be called.

A.   The Activity called finish().

B.   The Activity is paused or stopped and it's resources were needed by the operating system.

C.   All of these reasons.

D.   The Activity that launched this Activity called finishActivity()

39: What is the name of the new design guidelines given by Google ?

A.   Holo

B.   Classic

C.   Flat Design

D.   Material Design

40: Relative layout has two types of orientations: vertical and horizontal.

A.   True

B.   False

41: What are some examples of direct descendants of the android.view object?

A.   ProgressBar

B.   ViewGroup

C.   Neither of these

D.   Both of these

42: What AIDL is?

A.   Android InterProcess Definition Language

B.   Android Interface Definition Language

C.   Android InterProcess Dynamic Language

D.   Android Interface Dynamic Language

43: Who is known as the 'Father' of Android?

A.   Hugo Barra

B.   Sandar Pichai

C.   Sergey Brin

D.   Andy Rubin

E.   Larry Page

44: Which of these is NOT a Layout derived from the ViewGroup class?

A.   RelativeLayout

B.   AbsoluteLayout

C.   LinearLayout

D.   ListViewLayout

45: How do you get an intent data inside a fragment basically?

A.   Bundle args = getExtras().getActivity();

B.   Bundle args = new Bundle(getActivity().getIntent().getExtras());

C.   Bundle args = getActivity().getIntent().getExtras();

D.   Bundle args = getIntent().getActivity.getExtras();

E.   Bundle args = getActivity().getExtras().getIntent();

46: How can you assign a custom (NOT BUILT IN ANDROID) font typeface to a TextView?

A.   In code: mTextViem.setTypeface(Typeface myfont);

B.   In styles xml: <item name="android:typeface|>"myfont"</item>

C.   In layout xml: android:typeface="myfont"

47: Which of these ListAdapter subclasses is not a direct subclass of BaseAdapter?

A.   SimpleAdapter

B.   CursorAdapter

C.   ArrayAdapter

D.   HeaderViewListAdapter

48: True or false? Fragments are independent from Activities.

A.   True

B.   False

49: Android applications can "borrow" functionality from other applications by using...

A.   intent objects

B.   content Provider system

C.   application lifecyle methods

50: If the UI begins to behave sluggishly or crash while making network calls this is likely due to ....

A.   Hardware malfunction

B.   Activity Manager contains too much

C.   Virus on the server

D.   Network Latency

51: Which of the following allows you to instantinate a LocationManager class?

A.   LocationManager lm = (LocationManager)Runtime.getSystemServiceInstance(Context.LOCATION_SERVICE);

B.   LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

C.   LocationManager lm = new LocationManager(Context.LOCATION_SERVICE);

D.   LocationManager lm = (LocationManager)SystemServiceFactory.createSystemService(Context.LOCATION_SERVICE);

E.   LocationManager lm = (LocationManager)getSystem().getService(Context.LOCATION_SERVICE);

52: Is it possible to reverse engineer an android application using the apk file alone without external app resources?

A.   No

B.   Yes,at any point in time

C.   Yes but not always

53: In order to get paired Bluetooth device list you need to :

A.   not possible

B.   add <user-feature android:name="android.permission.BLUETOOTH" /> feature to the manifest.xml

C.   none of the above

D.   add <user-permission android:name="android.permission.BLUETOOTH_ADMIN" /> permission to the manifest.xml

54: What should you extend in case you need to apply a portion of code to your entire application?

A.   Application(import both android.app.Activity and anroid.app.Application)

B.   Activity(import android.app.Activity)

C.   ApplicationInfo(import android.app.*)

D.   Class(import android.app.Activity and android.app.Application)

55: if you want to access list of paired Bluetooth devices on Android, what should you do ?

A.   add to the manifest.xml

B.   add permission to the manifest.xml. you can not access paired bluetooth devices list

56: Which of the following is NOT a subclass of TextView?

A.   Button

B.   Radio Button

C.   EditText

D.   Image Button

57: How to enable overlay mode On API level 11 or higher, to create a custom theme for your activity.

A.   <item name="ActionBar:Overlay">true</item>

B.   <item name="ActionBarOverlay">true</item>

C.   <item name="android:ActionBarOverlay">true</item>

D.   <item name="android:windowActionBarOverlay">true</item>

58: Which of the following is a public constructor for canvas?

A.   canvas(int color)

B.   canvas(Context context)

C.   canvas(Bitmap bitmap)

D.   canvas(AttributeSet set)

59: How do you enable hardware acceleration in android?

A.   permission:hardwareAccelerated="true"

B.   android:hardwareAccelerated="true"

C.   android:permission:hardwareAccelerated="true"

D.   use:permission:hardwareAccelerated="true"

E.   use:hardwareAccelerated="true"

60: Which service is used to perform IPC, when bind application to a service?

A.   bindService()

B.   activity.bindService()

C.   application.bindService()

D.   service.application.bindService()

61: Hardcoding string values in xml speeds up android execution.

A.   False

B.   True

62: Android has more users than IOS as at 20th February 2007

A.   True

B.   False

63: What permission is required for your application to use the device's vibrate hardware?

A.   android.hardware.permission.VIBRATE

B.   android.permission.hardware.VIBRATE

C.   android.hardware.VIBRATE

D.   android.permission.VIBRATE

E.   android.security.VIBRATE

64: You can control process usage in your Android application by...

A.   moving your components up in the process lifecycle hierarchy.

B.   both of these

C.   using the android:process attribute on the specific component defined in the manifest.

D.   neither of these

65: How do you display the Action Bar back button on all Android versions?

A.   getSupportActionBar().setDisplayBackButton(true);

B.   getActionBar().setDisplayHomeAsUpEnabled(true);

C.   all of the above

D.   getSupportActionBar().setDisplayHomeAsUpEnabled(true);

E.   none of the above

66: AppWidgetProvider is a subclass of

A.   Intent

B.   Service

C.   Activity

D.   BroadcastReceiver

E.   AppWidgetHost

67: Which class MediaPlayer extends in android?

A.   MediaPlayerToolKit

B.   AndroidMediaPlayer

C.   Object

D.   Activity

E.   MediaPlayerStream

68: Which of the following is an Android class for the playback of sound?

A.   MediaPool

B.   Music

C.   SoundPlayer

D.   SoundPool

69: how can you check if your activity is first on stack ?

A.   activity.isTaskRoot()

B.   (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE).isTaskRoot() both

70: What is the correct argument passed in the Array.sort() function

A.   CASE_INSENSITIVE

B.   INSENSITIVE_CASE_ORDER

C.   CASE_ORDER

D.   CASE_INSENSITIVE_ORDER

71: Which method can be called to destroy an activity?

A.   finish()

B.   finishActivity()

C.   onDestroy()

D.   close()

72: Which of these run in a separate thread?

A.   IntentService

B.   None of them

C.   Both of them

D.   Service

73: What does this layout show?

A.   a textview aligned to the right in the layout and the text is centered

B.   a textview center in the layout and the text aligned to the right in his own container

C.   a textview aligned to the right in the layout

D.   a textview center in the layout

74: What is an Intent ?

A.   a function

B.   a message

C.   a process

D.   an action

75: What will be the result of this intent? Intent intent = new Intent(A.this, B.class); startActivityForResult(intent , -1);

A.   do nothing

B.   call startActivity() from Activity A

C.   call onActivityResult() from Activity A

D.   call onActivityResult() from Activity B

76: Where is navigation drawer support available?

A.   Android Support Library v14

B.   Android Support Library v21

C.   Android Support Library v4

D.   Android Support Library v7

77: According to the Activity's lifecycle, how is named the first method callback of an Activity?

A.   protected void onCreate();

B.   protected void onCreate(Parcelable parcelable);

C.   protected void onCreate(Intent intent);

D.   protected void onCreate(Bundle savedInstanceState);

78: Which component does not exist in the android sdk ?

A.   ImageButton

B.   CheckBoxButton

C.   EditText

D.   TextView

E.   ImageView

79: What is the codename of the latest Android platform?

A.   Ice Cream Sandwich

B.   Lollipop

C.   Honeycomb

D.   KitKat

E.   Jelly Bean

80: invalidateOptionsMenu() method of ActionBarActivity calls:

A.   onPrepareOptionsMenu()

B.   onCreateOptionsMenu()

81: Is it possible to update this textView as follows ? new Thread(new Runnable() { @Override public void run() { textView.setText("Hello World"); } }).start();

A.   Yes, it is possible and it's recommended to use its own thread to update views

B.   No, because system throws a Fatal Exception: "Only the original thread that created a view hierarchy can touch its views"

82: Which method can get the context tied to the lifecycle of the entire application ?

A.   View.getContext()

B.   Activity.this

C.   Activity.getApplicationContext()

D.   ContextWrapper.getBaseContext()

83: AsyncTask methods can run on the UI thread, but one of them doesn't run on this UI thread, which one?

A.   onPreExecute()

B.   publishProgress()

C.   doInBackground()

D.   onPostExecute()

84: What is the latest layout proposed by the android sdk?

A.   GridLayout

B.   RelativeLayout

C.   LinearLayout

D.   DrawerLayout

E.   FrameLayout

85: Which type of file are Android layouts read from?

A.   Time's Up!

B.   res

C.   xml

D.   xaml

E.   txt

86: Which of the following system services does Android rely on for the Linux kernel?

A.   Neither security nor network stack

B.   Security

C.   Network stack

D.   Both security and network stack

87: Can the ActionBarCompat library propose ActionBar features for old phones?

A.   No

B.   Yes, it can support devices from level api 2.1

88: Which of the following is Android's main programming language ?

A.   Java

B.   JavaScripts

C.   VB-Script

D.   C++

89: Which of the following defines your Android application components?

A.   myApp.xml file

B.   AndroidManifest.pkg file

C.   AndroidManifest.xml file

90: What should dimensions be specified in so that layouts adapt to any screen size?

A.   Pixels

B.   Density-independent pixels

91: What version(s) will you NOT be able to run the app if you set min sdk version to be 8 for an app?

A.   7

B.   10

C.   14

D.   12

E.   8

92: Which database is available for developers in Android?

A.   SQL Server

B.   NoSQL

C.   SQLite

D.   Oracle

E.   There is no available database

93: Which folder should the App Icon be kept under?

A.   src

B.   anim

C.   res

94: Which extension does the Android Manifest file have?

A.   .jar

B.   .xml

C.   .apk

D.   .java

95: Which of the following is the correct way to get pass string in an Intent, where key and value are both string variables?

A.   intent.putString(key,value);

B.   intent.putKey(key,value);

C.   intent.putExtra(key,value);

D.   intent.putValue(key,value);

96: Which is the name of component used to display web pages in the application?

A.   WebView

B.   WebBrowser

C.   BrowserView

D.   Browser

97: Which of these Activity lifecycle events is when the activity is about to become visible to the user from a hidden state?

A.   Start()

B.   onCreate()

C.   Resume()

D.   onStart()

E.   onResume()

98: 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?

A.   android.app.LoaderManager

B.   android.app.ListActivity

C.   android.app.LocalActivityManager

99: What is likely to cause the UI to behave sluggishly or crash while making network calls?

A.   Network Latency

B.   Virus on the server

C.   Hardware malfunction

D.   Activity Manager contains too much

100: How can Android applications "borrow" functionality from other applications?

A.   Application lifecyle methods

B.   Intent objects

C.   Content Provider system