Android/Android Programming MCQ Set 3 Sample Test,Sample questions

Question:
Consider the code snippet below:

   MediaPlayer mp = new MediaPlayer();

   mp.setDataSource(PATH_TO_FILE);

   mp.start();

   Which of the following should be placed at ?

1.mp.prepare();

2.mp.loadMedia()

3.mp.loadSource(

4.mp.loadSource(); mp.prepare();


Question:
Consider the following snippet of code:

   @Override

protected void onStop

{

Super.onStop();

SharedPreferences setting = getSharedPreferences("MyPrefs", 0);

SharedPreferences.Editor editor = settings.edit();

editor.putBoolean("MyBool", true);

 

<some more code here>

}

   Which of the following should be used <some more code here>?

1.editor.save(); editor.close();

2.editor.save(); editor.finish();

3.editor.commit();

4.editor.save();


Question:
Consider the XML fragment below, which is taken from one of the files in an Android project:


        android:layout_width = "fill_parent"

        android:layout_height = "fill_parent"

        android:text = "Some Text">

Which of the following are true about the XML fragment above?

1.It is taken from an XML file used to define a view.

2.If this is not the outer most tag in the XML file then it need not contain the xmlns: attribute.

3.MyElement should be the name of a class derived, directly or indirectly, from the View class.✔

4.All of the above


Question:
Fill in the blank:

___________ makes appropriate list of application data for the other applications.

1.service provider

2.content provider

3.application provider

4.Resource


Question:
In the context of the Android OS, what is the GC?

1.A Global Constants file.

2.Google Cloud service.

3.Part of the Dalvik VM that is responsible for clearing and reallocating unused memory when it is no longer required or when higher priority services or applications require it.

4.None of the above


Question:
List the activities whose IntentFilters match with a particular Intent type.

1.Activity.onCreate

2.Activity.onCreateOptionsMenu

3.Constructor of the Activity class. Activity.onCreateMenu

4.Activity.onStart


Question:
Once an app is published, the ________ cannot be changed. It should be unique for each APK.


1.private key

2.package name

3.main activity

4.APK file name


Question:
The default action resultant when pressing the device back button is to pop the backstack. What is the backstack?

1.A stack data structure containing every activity in the order that they were opened. The pop action removes the most recently opened activity.

2.A queue data structure containing every activity in the order that they were programmatically instantiated. The pop action removes the earliest opened activity from the data structure.

3.An array containing the inheritance architecture of every View in the current Fragment.

4.A stack data structure


Question:
Using a content provider, which of the following operations are able to perform?

a) create

b) read

c) update

d) delete

1.a, b and c

2.b, c and d

3. all of these

4.none of these


Question:
What are the Android Support Libraries for?

1.They provide APIs that allow developers to provide in-app customer support features.

2.They provide APIs that allow developers to provide features aimed at users with additional accessibility requirements.

3.They allow features introduced in more recent versions of Android to be used on devices running older OS versions.

4.They allow devices running the latest version of Android to use deprecated features from older OS versions.


Question:
What does a strikethrough formatting indicate in Android Studio?

1.That the method or class in use has been deprecated in the current version of the build tools in use.

2.That the method or class in use is private.

3.That the method or class in use is public.

4.That the method or class in use has been newly introduced in the current version of the build tools in use.


Question:
What does ANR stand for?

1.Application Not Recognised

2.Application Not Responding

3.Android Network Resource

4.Asynchronous Network Response


Question:
What does the following code do?

 

SensorManager mgr = (SensorManager) getSystemService(SENSOR_SERVICE);

List<Sensor> sensors = mgr.getSensorList(Sensor.TYPE_ALL);

for (Sensor sensor : sensors) {

        System.out.println(""+sensor.getName());

}

1.prints names of all available sensors in device

2.prints names of all available sensor types in device

3.prints names of all sensors which are not available

4.none of above


Question:
What does the following code do?

 

try {

    String token = GoogleAuthUtil.getToken(this, email, "https://www.googleapis.com/auth/devstorage.read_only");

    System.out.println(token);

} catch (IOException e) {

    System.out.println("IOException");

} catch (UserRecoverableAuthException e) {

    System.out.println("UserRecoverableAuthException");

} catch (GoogleAuthException e) {

    System.out.println("GoogleAuthException");

}

1.prints token

2.prints IOException

3.prints UserRecoverableAuthException

4.prints GoogleAuthException


Question:
What does the following code do?

   public boolean isOnline() {

   ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

   NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();

   return (networkInfo != null && networkInfo.isConnected());

}

1.checking Network connection.

2.checking only WIFI network connectivity.

3.checking only Bluetooth data connection.

4.checking only Ethernet data connection


Question:
What does the following statement define?

 It provides query(), insert(), update(), and delete() methods for accessing data from a content provider and invokes identically-named methods on an instance of a concrete content provider.

1.CursorLoader

2.ContentResolver

3.ContentProvide

4.ContentProvide


Question:
What feature of the Google Play Store allows developers to release pre-production builds to testers?

1.Google Cloud Messaging upstream communication.

2.Crashlytics beta deployment.

3.Google Play Alpha and Beta deployment channels.

4.TestFlight


Question:
What is "Android-Positron"?

1.A command line tool to create Android project files.

2.A framework to create unit tests for Android projects.

3.A resource editor to create user interface for Android applications.

4.An emulator to execute and debug Android projects.


Question:
What is a Master Detail pattern?

1.A layout pattern consisting of a Master layout (containing a collection of data) and Detail (containing detailed information about an item from the collection).

2.A term used in parallel processing where there are multiple Detail threads controlled by a hypervising Master thread manager.

3.A layout pattern consisting of a Detail layout (containing a collection of data) and Master (containing detailed information about an item from the collection).

4.A layout pattern consisting of a user-interactive Master layout, and a passive non-touch-enabled Detail layout.


Question:
What is a RemoteView for?

1.It defines a view hierarchy that can be displayed in another process, such as a rich notification layout or home screen widget.

2.It defines an inputstream that can display a remote device such as a hardware camera.

3.It allows apps to interact with the Google Cast API.

4.It is a base class that allows your app to send a limited set of control commands and serve as an Android TV remote control.


Question:
What is Android?

1.A new programming language that can be used to develop applications for mobile devices.

2.A new IDE that can be used to develop applications for mobile devices.

3.A software stack for mobile devices that includes an operating system, middleware and key applications.

4.A new mobile device developed by Google.


Question:
What is correct regarding GCM - Google Cloud Messaging service?

1.It does server to device communication.

2.It does device to server communication.

3.It does device to server communication and vice versa.

4.It does device to device communication.


Question:
What is Retrofit?

1.A collection of libraries that allows older versions on Android to support the latest APIs and libraries released with newer versions of the platform.

2.A type-safe client for consuming RESTful APIs in Android and Java in general.

3.A competing operating system from Apple.

4.The name given to Google's integrated fitness and activity tracking API available in recent version of Android.


Question:
What is the advantage of using AsyncTaskLoader instead of AsyncTask?

1.a bit easier to work with

2.the possibility easily update progress bar

3.no comparison, because it implements completely different functionality

4.less work with the configuration of application


Question:
What is the best way of opening camera as sub-activity?

1.Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivity(takePictureIntent);

2.Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, 1); }

3.Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(takePictureIntent, 1);

4.Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, -1); }


Question:
What is the correct way to fix if checking the status of the GPS_PROVIDER throws SecurityException?

1.request permission for ACCESS_COARSE_LOCATION

2.request permission for ACCESS_FINE_LOCATION

3.request permission for INSTALL_LOCATION_PROVIDER

4.None of the above


Question:
What is the correct way to restrict app visibility on Google Play to devices that have a camera?

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

2.<uses-feature android:name="android.hardware.camera" android:required="true" />

3.<uses-feature android:name="android.hardware.camera.front" android:required="true" />

4.<uses-permission android:name="android.permission.CAMERA"/>


Question:
What is the interface Spannable used for?

1.Manipulate text that can span across multiple pages.

2.Manipulate text that can span across multiple TextView windows.

3.This is the interface for text to which markup objects can be attached and detached.

4.String parsing


Question:
What is the largest size of a texture that can be loaded within an Android application?

1.512x512 in all cases.

2.2048x2048 in all cases.

3.The value is hardware-dependent, so should be referenced by calling this.getLayoutParams() post Gingerbread, and MATCH_PARENT directly in previous releases.

4.The value is hardware-dependent, so should be referenced by calling Canvas.getMaximumBitmapWidth()/Canvas.getMaximumBitmapHeight() post ICS, and GL_MAX_TEXTURE_SIZE directly in previous releases.


Question:
What is the ListActivity class used for?

1.Create a view to display a list of items from a data source.

2.List all the activities currently running on the Android device.

3.List all the activites that are installed on the Android device.

4.List the activities whose IntentFilters match with a particular Intent type.


Question:
What is the maximum supported file size for a single APK file (excluding expansion packages) in the Google Play Store?

1.50MB

2. 2GB

3.30MB

4.unlimited


Question:
What is the maximum supported size for a single expansion file in the Google Play Store?

1.50MB

2.2GB

3.30MB

4.unlimited


Question:
What is the purpose of the AppCompat library?

1.It allows the ActionBar UI pattern to be used on older versions of Android.

2.It allows the app to share content with other apps via the share intent.

3.It allows for the developer to internationalize their app.

4.It allows the SnackBar UI to be used on newer versions of Android.


Question:
What must be done after a TypedArray is no longer needed?

1.The invalidate() method must be called in order to refresh the contents of the object.

2.The recycle() method must be manually called in order to notify the system that the object is no longer using the memory allocated to it.

3.The onDestroy() method must be manually called in order to notify the system that the object is no longer using the memory allocated to it.

4.The keepalive() method must be called in order to notify the system that the object is still being used and to prevent GC from clearing it.


Question:
What was Project Butter?

1.An internal Google Android team initiative intended to increase security of apps on the platform by removing commonly made mistakes or ÒplanksÓ from encryption libraries.

2.An AOSP initiative aimed at reducing the influence that Google has on the open-source platform.

3.An internal Google Android team initiative intended to reduce visual stuttering or ÒjankÓ, and increase UI performance across the platform.

4.An AOSP initiative aimed at making APIs easier to understand by new developers, on order to reduce the instability found in some poorly designed apps.


Question:
When defining a View within an XML layout, which two attributes are always required?

1.Width and Height

2.LayoutSum and LayoutWeight

3.Style and LayoutWeight

4.Height and Orientation


Question:
When does ANR occur?

1.When a network thread pauses for more than a minute.

2.When there has been no response to a system event within 5 seconds.

3.When there has been no response to user input event within 5 seconds.

4.When the app is selected from within the app launcher, but is not installed.


Question:
Where should layouts be defined wherever possible?

1.In XML

2. In Java

3.In HTML

4. In JSON


Question:
Which is the correct file in which you should request permissions that an app will use?

1.In build.gradle for the module.

2.In build.gradle for the project.

3.In AndroidManifest.xml.

4.In settings.gradle.


Question:
Which of the following 4 classes does not relate to others?

   ApplicationInfo, SyncInfo, ActivityInfo, PackageInfo

1.ApplicationInfo

2.SyncInfo

3.ActivityInfo

4.PackageInfo


Question:
Which of the following are Android build modes?

1.Release mode✔

2.Production mode

3.Development mode

4.None of these


Question:
Which of the following are true about enabling/disabling menu items from an Activity class?

1.onCreateOptionsMenu can be used to enable/disable some menu items in an Android application.

2.onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application.

3.onShowOptionsMenu can be used to enable/disable some menu items in an Android application.

4.The menu items in an Android application cannot be disabled.


Question:
Which of the following are true about PhoneStateIntentReceiver.notifyPhoneCallState?

1.notifyPhoneCallState has to be called if your application wishes to receive a notification about an incoming phone call.

2.notifyPhoneCallState is a call back function that is called when the call state changes.

3.notifyPhoneCallState is called to initiate a call from the device.

4.notifyPhoneCallState is used to send notifications about call states.


Question:
Which of the following are UI elements that you can use in a window in an Android application?

1.TextBox

2.TextView

3.TextField

4.TextElement


Question:
Which of the following are valid ways to deploy an Android application to a device?

1.Using the "adb install /path/to/apk" command from the command prompt/terminal, when USB Debugging Mode is enabled in the device.

2.Exporting and signing the package, then browsing it to install.

3.Launching the application from an IDE, when USB Debugging Mode is enabled in the device.

4.All of the above


Question:
Which of the following attributes in the manifest file defines version information of an application for the Google Play Store (as opposed to defining version information for display to users)?

1.android:versionCode

2.android:versionName

3.android:targetSdkVersion

4.android:maxSdkVersion


Question:
Which of the following can be used to handle commands from menu items in an Android application?

1.commandAction

2.onMenuItem

3.onMenuItemClicked

4.onOptionsItemSelected


Question:
Which of the following classes does not relate to other? SQLiteOpenHelper, SQLiteDatabase, Cursor, ContentProvider

1.SQLiteOpenHelper

2.SQLiteDatabase

3.Cursor

4.ContentProvider


Question:
Which of the following classes is not used in working with database?

1.SQLiteOpenHelper

2.SQLiteDatabase

3.ContentProvider

4.DatabaseHelper


Question:
Which of the following formats is not supported in Android?

1.MP4

2.MPEG

3.AVI

4.None of the above


Question:
Which of the following function calls can be used to start a Service from your Android application?

1.bindService

2.startService

3.broadcastIntent

4.All of the above


Question:
Which of the following functions will return all available Content Providers?

1.List<ProviderInfo> returnList = new ArrayList<ProvderInfo>(); for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS)) { ProviderInfo[] providers = pack.providers; if (providers != null) { returnList.addA

2.return getContext().getPackageManager().queryContentProviders("com.google", Process.myUid(), 0);

3.List<ActivityInfo> returnList = new ArrayList<ActivityInfo>(); for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_RECEIVERS)) { ActivityInfo[] providers =

4.None of These


Question:
Which of the following is considered best practice according to Google’s Android Development documentation?

1.Use Activities wherever possible, Fragments should only be used when supporting older devices.

2.Use Fragments whenever possible, Activities should only be used where a FragmentManager and Fragments cannot do the job required.

3.Use Activities when developing graphically-intensive apps, use Fragments primarily for text-based content.

4.Use Activities for devices with a smaller form factor, use Fragments for tablet and phablet devices.


Question:
Which of the following is correct to use for data transfer regularly and efficiently, but not instantaneously?

1.AsyncTask

2.IntentService

3.Sync adapters

4.All of these


Question:
Which of the following is NOT a life-cycle methods of an Activity that can be implemented to perform various operations during the lifetime of an Activity?

1.onCreate

2.onInit

3.onCompleteThaw

4.onRestart


Question:
Which of the following is not Content Provider?



✔

1.Contacts

2.Contacts

3.Shared Preferences

4.MediaStore


Question:
Which of the following is not Content Provider?

1.Contacts

2.Contacts

3.Shared Preferences

4.MediaStore


Question:
Which of the following is the best way to request user permission if an Android application receives location updates from both NETWORK_PROVIDER and GPS_PROVIDER?

1.Adding this line to the Android manifest file: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

2.Adding these two lines to the Android manifest file: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permissio

3.Adding this line to the Android manifest file: <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

4.Adding this line to the Android manifest file: <uses-permission android:name="android.permission.CONTROL_LOCATION_UPDATES" />


Question:
Which of the following is/are appropriate for saving the state of an Android application?

1.Activity.onFreeze()

2.Activity.onPause()

3.Activity.onStop()

4.Activity.onDestroy()


Question:
Which of the following packages provide the classes required to manage the Bluetooth functionality on an Android device?

1.android.hardware

2.android.bluetooth

3.android.bluez

4.org.bluez


Question:
Which of the following permissions and configurations must be added in manifest file for implementing GCM Client?

   A) com.google.android.c2dm.permission.RECEIVE

B) android.permission.INTERNET

C) android.permission.GET_ACCOUNTS

D) android.permission.WAKE_LOCK

E) applicationPackage + ".permission.C2D_MESSAGE"

F) A receiver for com.google.android.c2dm.intent.RECEIVE, with the category set as applicationPackage. The receiver should require the com.google.android.c2dm.SEND permission

1.A, B, C and D

2.C, D, E and F

3.A, B, E and F

4.all of these


Question:
Which of the following permissons is needed to perform the network operations through internet?

a) INTERNET

b) ACCESS_NETWORK_STATE

1.a

2.b

3.both

4.none


Question:
Which of the following procedures will get the package name of an APK file?

1.Looking for the package attribute's value of the <manifest> element in the manifest file.

2.Executing the command, "pm list packages -f", in the ADB shell.

3.Programmatically, using PackageManager in an installed Android app.

4.Using the AAPT platform tool, "aapt dump badging apkName.apk".


Question:
Which of the following programming languages can be used to develop software applications for the Android platform?

1.Java

2.C# with .NET Compact Framework for mobile devices.

3.C programming language.

4.Android programming language.


Question:
Which of the following protocols are provided by Google for GCM Connection Servers?

A) HTTP

B) XMPP

C) SOAP

D) RMI

1.A and B

2.C, D

3.A, B, C

4.All of the above


Question:
Which of the following sensors is only hardware-based?

1.linear acceleration sensor

2.gravity sensor

3. rotation vector sensor

4. accelerometer sensor


Question:
Which of the following statement is correct regarding StrictMode?

1.StrictMode detects improper layouts

2.StrictMode detects operation which blocks UI

3.StrictMode detects the speed of the connection

4.All of the above


Question:
Which of the following statements are correct with regards to calling place GoogleAuthUtil.getToken()?

A) call getToken() on the UI thread

B) call getToken() on AsyncTask

1.Statement A is true, while Statement B is false.

2.Statement B is true, while Statement A is false.

3.Both statements are true.

4.Both statements are false.


Question:
Which of the following statements are correct with regards to Content Providers?

   A) A content provider allows applications to access data.

B) A content provider must be declared in the AndroidManifest.xml file.

1.Statement A is true, while Statement B is false.

2. Statement B is true, while Statement A is false.

3.Both statements are true.

4.Both statements are false.


Question:
Which of the following statements are correct with regards to publishing updates of apps on Google Play?

1.The android:versionCode attribute in the manifest file must be incremented and the APK file must be signed with the same private key.

2.The android:versionCode attribute in the manifest file must be same and the APK file must be signed with the same private key.

3.The android:versionCode attribute in the manifest file must be incremented and the APK file must be signed with the new private key.

4.The android:versionCode attribute in the manifest file must be same and the APK file must be signed with the new private key.


Question:
Which of the following statements are correct with regards to running of the Sync Adapter?

   A) Running sync adapter in response to a user request.

B) Running sync adapter periodically by setting a period of time to wait between runs, or by running it at certain times of the day, or both.

1.Statement A is true, while Statement B is false.

2.Statement B is true, while Statement A is false.

3.Both statements are true.

4.Both statements are false.


Question:
Which of the following statements are correct with regards to signing applications?a) All applications must be signed.

b) No certificate authority is needed.

c) When releasing application special debug key that is created by the Android SDK build tools can be used.

1.a) and b) are true

2.a) and c) are true

3. b) and c) are true

4.all statements are true


Question:
Which of the following statements is not correct with regards to using Content Providers?

1.offering complex data or files to other applications.

2.allowing users to copy complex data from one app into other apps.

3.using an SQLite database if the use is entirely within on application.

4.providing custom search suggestions using the search framework


Question:
Which of the following tools can be used to reduce apk package size?

1.lint

2.ProGuard

3.zipalign

4.etc1tool


Question:
Which of the following widgets helps to embed images in activities?

1.ImageView

2.ImageButton

3.both of above

4.none of these


More MCQS

  1. Android Mcq Question
  2. ANDROID Multiple Choice Question
  3. Android MCQ Questions and Answers
  4. Android Programming MCQ Set 1
  5. Android Programming MCQ Set 2
  6. Android Programming MCQ Set 3
  7. Android Programming MCQ Set 4
  8. Android Programming MCQ Set 5
Search
Olete Team
Online Exam TestTop Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on Online Exam Testwebsite is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!