google.com, pub-8658045329707802, DIRECT, f08c47fec0942fa0
Upwork Test Answers: Get all the correct answers of most recent and possible Upwork Tests A to Z (Updated on Jan, 2016)
Cover Letter Templates: These cover letter samples are not only for Upwork job, but also you will have some idea about your real life job
 
Freelance Profile Overviews: Different Profile samples and overviews of experts, advanced and intermediate level freelancers
For Newbie of Upwork: Upwork Help - How to apply for a job in Upwork with 10 most important articles about Upwork

A to Z View - All Upwork Test Answers

Android Programming Test Answer 2019


1. What is the correct way to fix if checking the status of the GPS_PROVIDER throws SecurityException?
Answers:
• request permission for ACCESS_COARSE_LOCATION
• request permission for ACCESS_FINE_LOCATION
• request permission for INSTALL_LOCATION_PROVIDER
• None of the above

2. Consider the code snippet below:
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(PATH_TO_FILE);
<Some code here>
mp.start();
Which of the following should be placed at <Some code here>?
Answers:
• mp.prepare();
• mp.prepareAsync();
• mp.loadMedia();
• mp.loadSource();
• mp.loadSource(); mp.prepare();
• No code is required at <Some code here> to start playback.

3. 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?
Answers:
• import android.drivers;
• import android.hardware.camera;
• import android.camera;
• import android.util;
• import android.hardware;

 4. Which of the following can be accomplished by using the TelephoneNumberUtil class?
Answers:
• 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.
• Setting and retrieving the call forwarding phone number on the phone device.

5. Which of the following are UI elements that you can use in a window in an Android application?
Answers:
• TextBox
• TextView
• TextField
• TextElement
• EditText
• RichText

6. Which of the following is not Content Provider?
Answers:
• Contacts
• Contacts
• Shared Preferences
• MediaStore
• Bookmarks
• Settings

7. 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());
}
Answers:
• prints names of all available sensors in device
• prints names of all available sensor types in device
• prints names of all sensors which are not available
• none of above

8. Which of the following is correct to use for data transfer regularly and efficiently, but not instantaneously?
Answers:
• AsyncTask
• IntentService
• Sync adapters
• All of these

9. What is the ListActivity class used for?
Answers:
• Create a view to display a list of items from a data source.
• List all the activities currently running on the Android device.
• List all the activites that are installed on the Android device.
• List the activities whose IntentFilters match with a particular Intent type.

10. Which of the following would you have to include in your project to use the SimpleAdapter class?
Answers:
• import android.content;
• import android.widget;
• import android.database;
• import android.database.sqlite;
• import android.util;

11. 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?
Answers:
• Adding this line to the Android manifest file: <uses-permission android:name=»android.permission.ACCESS_FINE_LOCATION» />
• Adding these two lines to the Android manifest file: <uses-permission android:name=»android.permission.ACCESS_FINE_LOCATION» /> <uses-permission android:name=»android.permission.ACCESS_COARSE_LOCATION» />
• Adding this line to the Android manifest file: <uses-permission android:name=»android.permission.ACCESS_FINE_LOCATION» />
• Adding this line to the Android manifest file: <uses-permission android:name=»android.permission.CONTROL_LOCATION_UPDATES» />

12. Which of the following can you use to display an HTML web page in an Android application?
Answers:
• WebBrowser
• BrowserView
• WebView
• Browser
• HtmlView

13. 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.
Answers:
• a) and b) are true
• a) and c) are true
• b) and c) are true
• all statements are true

14. Which of the following is the immediate base class for Activity and Service classes?
Answers:
• Application
• ApplicationContext
• Context
• Component
• Object

15. Which of the following statement is correct regarding StrictMode?
Answers:
• StrictMode detects improper layouts
• StrictMode detects operation which blocks UI
• StrictMode detects the speed of the connection
• All of the above

16. Which of the following is/are appropriate for saving the state of an Android application?
Answers:
• Activity.onFreeze()
• Activity.onPause()
• Activity.onStop()
• Activity.onDestroy()


17. Which of the following are true about enabling/disabling menu items from an Activity class?
Answers:
• onCreateOptionsMenu can be used to enable/disable some menu items in an Android application.
• onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application.
• onShowOptionsMenu can be used to enable/disable some menu items in an Android application.
• The menu items in an Android application cannot be disabled.

18. Using a content provider, which of the following operations are able to perform?
a) create
b) read
c) update
d) delete
Answers:
• a, b and c
• b, c and d
• all of these
• none of these

19. 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»);
}
Answers:
• prints token
• prints IOException
• prints UserRecoverableAuthException
• prints GoogleAuthException

20. Which of the following should be used to save the unsaved data and release resources being used by an Android application?
Answers:
• Activity.onStop()
• Activity.onPause()
• Activity.onDestroy()
• Activity.onShutdown()
• Activity.onFreeze()

21. Which of the following are true?
Answers:
• startActivity and startActivityForResult can both be used to start a new activity from your activity class.
• Only startActivityForResult can be used to launch a new activity from your activity class.
• startActivity(myIntent); and startActivityForResult(myIntent, -1); have the same result.
• startActivity(myIntent); and startActivityForResult(myIntent, 0); have the same result.
• When startActivity is used to launch a new activity from your activity class then your activity class gets notified when the new activity is completed.
• When startActivityForResult is used to launch a new activity from your activity class then your activity class gets notified when the new activity is completed.

22. Consider the XML fragment below, which is taken from one of the files in an Android project:
<MyElement xmlns:»http://schemas.androd.com/apk/res/android»
android:layout_width = «fill_parent»
android:layout_height = «fill_parent»
android:text = «Some Text»>
</MyElement>
Which of the following are true about the XML fragment above?
Answers:
• It is taken from the manifest XML file of the Android project.
• It is taken from an XML file used to define a view.
• It is taken from the package file (.apk) of the Android project.
• The xmlns: attribute is a compulsory attribute.
• If this is not the outer most tag in the XML file then it need not contain the xmlns: attribute.
• MyElement should be the name of a class derived, directly or indirectly, from the View class.

23. Which of the following are true about Intent.CALL_ACTION and Intent.DIAL_ACTION?
Answers:
• Both of them are used to dial a phone number on the device.
• 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.
• Intent.action = Intent.DIAL_ACTION is used when a phone number is to be dialled without the user having to explicitly initiate the call.

24. Suppose Screen1 is the main screen of an Android application MyAndroid. Now if another screen, Screen2 has to be opened from Screen1, then which of the following are true?
Answers:
• Screen2 has to be a part of MyAndroid.
• Screen2 can exist in any other Android application installed on the device.
• Screen2 will always be launched asynchronously.
• Screen2 can be launched synchronously.
• Screen2 can return a result code to Screen1 if launched with startActivity.
• Screen2 can return a result code to Screen1 if launched with startActivityForResult.

25. What is the best way of opening camera as sub-activity?
Answers:
• Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivity(takePictureIntent);
• Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, 1); }
• Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(takePictureIntent, 1);
• Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, -1); }

26. What is the correct way to restrict app visibility on Google Play to devices that have a camera?
Answers:
• <uses-feature android:name=»android.hardware.camera»/>
• <uses-feature android:name=»android.hardware.camera» android:required=»true» />
• <uses-feature android:name=»android.hardware.camera.front» android:required=»true» />
• <uses-permission android:name=»android.permission.CAMERA»/>

27. Which of the following sensors is only hardware-based?
Answers:
• linear acceleration sensor
• gravity sensor
• rotation vector sensor
• accelerometer sensor

28. Which of the following formats is not supported in Android?
Answers:
• MP4
• MPEG
• AVI
• MIDI

29. 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?
Answers:
• When the device receives an incoming phone call.
• When an outgoing phone call is initiated on the device.
• When the user presses the CALL button on the device.
• The code in will never get executed.

30. Which of the following packages provide the classes required to manage the Bluetooth functionality on an Android device?
Answers:
• android.hardware
• android.bluetooth
• android.bluez
• org.bluez

31. What is the purpose of the ContentProvider class?
Answers:
• 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.
• To maintain global application state.

32. Which of the following permissons is needed to perform the network operations through internet?
a) INTERNET
b) ACCESS_NETWORK_STATE
Answers:
• a
• b
• both
• none

33. What is «Android-Positron»?
Answers:
• 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.
• An emulator to execute and debug Android projects.

34. Which of the following are true?
Answers:
• Both startActivity and startSubActivity start an activity synchronously.
• Both startActivity and startActivityForResults start an activity asynchronously.
• startActivity is an asynchronous call, but startSubActivity is synchronous.
• startActivity is a synchronous call, but startSubActivity is asynchronous.

35. 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.
Answers:
• Statement A is true, while Statement B is false.
• Statement B is true, while Statement A is false.
• Both statements are true.
• Both statements are false.

36. Which of the following are Android build modes?
Answers:
• Debug mode
• Release mode
• Production mode
• Development mode

37. What is «Android-activityCreator»?
Answers:
• 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.
• An emulator to execute and debug Android projects.

38. 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
Answers:
• A, B, C and D
• C, D, E and F
• A, B, E and F
• all of these

39. 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>?
Answers:
• editor.save(); editor.close();
• editor.save(); editor.finish();
• editor.commit();
• editor.save();
• editor.close();
• editor.finish();

40. Which of the following are valid features that you can request using requestWindowFeature?
Answers:
• FEATURE_NO_TITLE
• FEATURE_NO_ICON
• FEATURE_RIGHT_ICON
• FEATURE_NO_MENU
• FEATURE_TRANSPARENT_WINDOW

41. Which of the following fields of the Message class should be used to store custom message codes about the Message?
Answers:
• tag
• what
• arg1
• arg2
• userData

42. What is the interface Spannable used for?
Answers:
• Manipulate text that can span across multiple pages.
• Manipulate text that can span across multiple TextView windows.
• This is the interface for text to which markup objects can be attached and detached.
• String parsing.

43. Which of the following can be used to handle commands from menu items in an Android application?
Answers:
• commandAction
• onMenuItem
• onMenuItemSelected
• onMenuItemClicked
• onOptionsItemSelected

44. Which of the following are classes that can be used to handle the Bluetooth functionality on a device?
Answers:
• Adapte
• Manage
• Matche
• BluetoothAdapte

45. Which of the following can be used to bind data from an SQL database to a ListView in an Android application?
Answers:
• SimpleCursor
• SimpleCursorAdapter
• SimpleAdapter
• SQLiteCursor
• SQLLiteAdapter

46. 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
Answers:
• Statement A is true, while Statement B is false.
• Statement B is true, while Statement A is false.
• Both statements are true.
• Both statements are false.

47. Which of the following Integrated Development Environments can be used for developing software applications for the Android platform?
Answers:
• Android IDE
• Eclipse
• Visual Studio 2005
• Visual Studio 2008

48. Which of the following functions will return all available Content Providers?
Answers:
• List<ProviderInfo> returnList = new ArrayList<ProvderInfo>(); for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS)) { ProviderInfo[] providers = pack.providers; if (providers != null) { returnList.addAll(Arrays.asList(providers)); } } return returnList;
• return getContext().getPackageManager().queryContentProviders(«com.google», Process.myUid(), 0);
• List<ActivityInfo> returnList = new ArrayList<ActivityInfo>(); for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_RECEIVERS)) { ActivityInfo[] providers = pack.receivers; if (providers != null) { returnList.addAll(Arrays.asList(providers)); } } return returnList;
• None of these.

49. What is Android?
Answers:
• A new programming language that can be used to develop applications for mobile devices.
• A new IDE that can be used to develop applications for mobile devices.
• A software stack for mobile devices that includes an operating system, middleware and key applications.
• A new mobile device developed by Google.

50. Which of the following can you use to add items to the screen menu?
Answers:
• Activity.onCreate
• Activity.onCreateOptionsMenu
• Constructor of the Activity class.
• Activity.onCreateMenu
• Activity.onStart
• Activity.onPrepareOptionsMenu

51. Which of the following are valid ways to deploy an Android application to a device?
Answers:
• Using the «adb install /path/to/apk» command from the command prompt/terminal, when USB Debugging Mode is enabled in the device.
• Exporting and signing the package, then browsing it to install.
• Launching the application from an IDE, when USB Debugging Mode is enabled in the device.
• All of these.

52. Which of the following tools can be used to reduce apk package size?
Answers:
• lint
• ProGuard
• zipalign
• etc1tool

53. Which of the following widgets helps to embed images in activities?
Answers:
• ImageView
• ImageButton
• both of above
• none of these

54. What is «Android-dx»?
Answers:
• 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.
• An emulator to execute and debug Android projects.

55. Which of the following protocols are provided by Google for GCM Connection Servers?
A) HTTP
B) XMPP
C) SOAP
D) RMI
Answers:
• A and B
• A, B, C
• C, D
• all of these

56. ____ makes appropriate list of application data for the other applications
Answers:
• service provider
• content provider
• application provider
• resource

57. Which of the following 4 classes does not relate to others?
ApplicationInfo, SyncInfo, ActivityInfo, PackageInfo
Answers:
• ApplicationInfo
• SyncInfo
• ActivityInfo
• PackageInfo

58. The simplest widget is the label, referred to in Android as a ____________
Answers:
• TextView
• grid view
• lableview
• none of these

59. Which of the following can you use to display a progress bar in an Android application?
Answers:
• ProgressBar
• ProgressDialog
• ProgressItem

60. Which of the following statements are correct with regards to publishing updates of apps on Google Play?
Answers:
• The android:versionCode attribute in the manifest file must be incremented and the APK file must be signed with the same private key.
• The android:versionCode attribute in the manifest file must be same and the APK file must be signed with the same private key.
• The android:versionCode attribute in the manifest file must be incremented and the APK file must be signed with the new private key.
• The android:versionCode attribute in the manifest file must be same and the APK file must be signed with the new private key.

61. Which of the following 4 classes does not relate to other?
SQLiteOpenHelper, SQLiteDatabase, Cursor, ContentProvider
Answers:
• SQLiteOpenHelper
• SQLiteDatabase
• Cursor
• ContentProvider

62. 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.
Answers:
• CursorLoader
• ContentResolver
• ContentProvider
• Loader

63. What is the advantage of using AsyncTaskLoader instead of AsyncTask?
Answers:
• a bit easier to work with
• the possibility easily update progress bar
• no comparison, because it implements completely different functionality
• less work with the configuration of application

64. 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());
}
Answers:
• checking Network connection.
• checking only WIFI network connectivity.
• checking only Bluetooth data connection.
• checking only Ethernet data connection

65. 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.
Answers:
• Statement A is true, while Statement B is false.
• Statement B is true, while Statement A is false.
• Both statements are true.
• Both statements are false.

66. Which of the following classes is not used in working with database?
Answers:
• SQLiteOpenHelper
• SQLiteDatabase
• ContentProvider
• DatabaseHelper

67. Which of the following is the parent class for the main application class in an Android application that has a user interface?
Answers:
• MIDLet
• AndroidApp
• Activity
• AppLet
• Application

68. Which of the following are true about PhoneStateIntentReceiver.notifyPhoneCallState?
Answers:
• notifyPhoneCallState has to be called if your application wishes to receive a notification about an incoming phone call.
• notifyPhoneCallState is a call back function that is called when the call state changes.
• notifyPhoneCallState is called to initiate a call from the device.
• notifyPhoneCallState is used to send notifications about call states.
• notifyPhoneCallState gets called when the device receives an incoming phone call.

69. How many expansion files can an APK file have? Select all correct options.
Answers:
• one
• two
• three
• four

70. Select the two function calls that can be used to start a Service from your Android application?
Answers:
• bindService
• startService
• runService
• startActivity

71. What is «Android-Positron»?
Answers:
• 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.
• An emulator to execute and debug Android projects.

72. 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?
Answers:
• onCreate
• onInit
• onCompleteThaw
• onRestart

73. What is correct regarding GCM — Google Cloud Messaging service?
Answers:
• It does server to device communication.
• It does device to server communication.
• It does device to server communication and vice versa.
• It does device to device communication.

74. Which of the following procedures will get the package name of an APK file?
Answers:
• Looking for the package attribute’s value of the <manifest> element in the manifest file.
• Executing the command, «pm list packages -f», in the ADB shell.
• Programmatically, using PackageManager in an installed Android app.
• Using the AAPT platform tool, «aapt dump badging apkName.apk».

75. What is the maximum supported file size for a single APK file (excluding expansion packages) in the Google Play Store?
Answers:
• 50MB
• 2GB
• 30MB
• unlimited

76. Which of the following can be used to navigate between screens of different Android applications?
Answers:
• Binde
• Flow
• Navigate
• Intent
• ApplicationContext

77. Fill in the blank:
Once an app is published, the ________ cannot be changed. It should be unique for each APK.
Answers:
• private key
• package name
• main activity
• APK file name

78. 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)?
Answers:
• android:versionCode
• android:versionName
• android:targetSdkVersion
• android:maxSdkVersion

79. 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?
Answers:
• 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 onStart() of the main application class.
• Call setContentView(mView) in the onCreate() of the main application class.

80. Which of the following programming languages can be used to develop software applications for the Android platform?
Answers:
• Java
• C# with .NET Compact Framework for mobile devices.
• C programming language.
• Android programming language.

81. What is the maximum supported size for a single expansion file in the Google Play Store?
Answers:
• 50MB
• 2GB
• 30MB
• unlimited

82. What does the following code do?
public boolean isOnline() {
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
return (networkInfo != null &amp;&amp; networkInfo.isConnected());
}
Answers:
• checking Network connection.
• checking only WIFI network connectivity.
• checking only Bluetooth data connection.
• checking only Ethernet data connection.

82. What is Google Cloud Messaging?
Answers:
• A service that can be used to send messages to Android devices using Google’s cloud platform.
• A data format used for accessing Google APIs.
• A command and control interface for controlling servers from within an Android application.
• None of the above

83. Which of the following is a tool used for profiling the performance of Android apps?
Answers:
• Pixel Perfect
• Hierarchy Viewer
• Genymotion
• Traceview

84. How could using Guava in an Android application cause problems at build time in particular?
Answers:
• The libraries are not supported by the Gradle build process.
• The libraries are large and can cause the compiler to exceed the 65k method limit imposed by Java 7 and below.
• The libraries must be compiled separately before the build process will complete.
• They are deprecated, Google no longer support them so many of the methods that they contain will not compile.

85. In the context of the Android OS, what is the GC?
Answers:
• A Global Constants file.
• Google Cloud service.
• 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.
• None of the above

86. What is the largest size of a texture that can be loaded within an Android application?
Answers:
• 512*512 in all cases.
• 2048*2048 in all cases.
• The value is hardware-dependent, so should be referenced by calling this.getLayoutParams() post Gingerbread, and MATCH_PARENT directly in previous releases.
• 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.

87. Which of the following is true when an Android device is rotated?
Answers:
• The Activity is destroyed and recreated.
• The Activity is paused and resumed.
• The Activity remains active, and the LayoutParams of its contents are provided with an alternative dimensions and values for the new orientation.
• The Activity remains active, and the width of the Window is altered to match the new width of the display.

88. What feature of the Google Play Store allows developers to release pre-production builds to testers?
Answers:
• Google Cloud Messaging upstream communication.
• Crashlytics beta deployment.
• Google Play Alpha and Beta deployment channels.
• TestFlight

89. What is the purpose of the AppCompat library?
Answers:
• It allows the ActionBar UI pattern to be used on older versions of Android.
• It allows the app to share content with other apps via the share intent.
• It allows for the developer to internationalize their app.
• It allows the SnackBar UI to be used on newer versions of Android.

90. Which of the following enables you to use Java 8 features when building apps for Android?
Answers:
• retrofit
• lint
• retrolambda
• spoon

91. Which of the following will cause a Force Close event?
Note: There may be more than one right answer.
Answers:
• An unhandled null pointer exception.
• An unhandled invalid parser exception.
• Attempting a network call without the correct permissins, outside of a Try/Catch statement.
• None of the above

92. Which exception is thrown when an image exceeds the maximum allocated size in memory?
Answers:
• InvalidStateException
• UnhandledException
• NullPointerException
• OutOfMemoryException

93. What are the two types of Intent in Android?
Answers:
• Bad and Good
• Implicit and Explicit
• Explicit and Restricted
• Implicit and System

94. Which feature of the Java build process allows for Android projects with more than 65k method calls?
Answers:
• The Gradle build process
• Multidexing
• Proguard/Dexguard
• The Android Run Time (ART)

95. What is Lint?
Answers:
• A static code analysis tool that checks code for bugs, optimisation opportunities, common coding errors and other patterns indicating that the code could be improved.
• A runtime analysis tool that checks code for bugs, optimisation opportunities, common coding errors and other patterns indicating that the code could be improved.
• The Android layout initializer object.
• A low-level interface for accessing the raw header and body of a network communication packet.

96. Which is the correct file in which you should request permissions that an app will use?
Answers:
• In build.gradle for the module.
• In build.gradle for the project.
• In AndroidManifest.xml.
• In settings.gradle.

97. Which of the following is considered best practice according to Google’s Android Development documentation?
Answers:
• Use Activities wherever possible, Fragments should only be used when supporting older devices.
• Use Fragments whenever possible, Activities should only be used where a FragmentManager and Fragment cannot do the job required.
• Use Activities when developing graphically-intensive apps, use Fragments primarily for text-based content.
• Use Activities for devices with a smaller form factor, use Fragments for tablet and phablet devices.

98. What is Robolectric?
Answers:
• An Android unit testing framework.
• An Android test automation framework.
• The name given to a specific release version of the Android OS.
• An open source, free Java implementation, upon which Android is based.

99. What must be done after a TypeArray is no longer needed?
Answers:
• The invalidate() method must be called in order to refresh the contents of the object.
• 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.
• 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.
• 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.

100. What was Project Butter?
Answers:
• 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.
• An AOSP initiative aimed at reducing the influence that Google has on the open-source platform.
• An internal Google Android team initiative intended to reduce visual stuttering or jank, and UI performance across the platform.
• An AOSP initiative aimed at making APIs easier to understand by the new developers, on order to reduce the instability found in some poorly designed apps.

101. Within the context of Android resource definitions, what do ‘sw600’ and ‘w800’ mean?
Answers:
• sw600 resources are referenced when the screen width exceeds 600dp in width, w800 resources are referenced when the screen width is exactly 800dp.
• sw600 resources are referenced when software rendering is enabled, w800 resources are referenced when WiFi is enabled.
• sw600 resources are referenced when the versionCode is 600 and the device is of small form factor, w800 resources are referenced when the versionCode is 800 and the device is of wide form factor.
• sw600 resources are referenced when the screen width is smaller than 600dp in width, w800 resources are referenced when the screen width is greater than 800dp.

102. What is Retrofit?
Answers:
• A collection of libraries that allows older versions on Android to support the latest APIs and libraries released with newer versions of the platform.
• A type-safe client for consuming RESTful APIs in Android and Java in general.
• A competing operating system from Apple.
• The name given to Google’s integrated fitness and activity tracking API available in recent version of Android.

103. What is the difference between a Broadcast Receiver and an Intent Filter?
Answers:
• A Broadcast Receiver allows an app to register to be notified upon system or application events, an Intent Filter specifies which Intents an app can receive.
• A Broadcast Receiver allows an app to receive video streams from live media sources, an Intent Filter determines which URLs are supported.
• A Broadcast Receiver is a component of the TelephonyManager that determines the cellular network that the device can connect to, an Intent Filter removes noise from telephone call audio.
• A Broadcast Receiver is a server-side endpoint that an app can communicate with, an Intent Filter determines which Android IDs can access the endpoint.

104. In which situation is it acceptable to make network calls on the UI thread?
Answers:
• Where information is held within a dynamic view.
• Network calls should always be executed on the main UI thread.
• Where asynchronous data calls are required.
• Network calls should never be on the main UI thread.

105. Which of the following is the correct way to request permission to allow an app feature to access the internet?
Answers:
• <uses-feature android:name=»android.permission.INTERNET»/>
• <uses-permission android:name=»android.permission.INTERNAL_SYSTEM_WINDOW»/>
• <uses-permission android:name=»android.permission.INTERNET»/>
• <uses-permission android:feature=»android.permission.INTERNET»/>

106. Where should layouts be defined wherever possible?
Answers:
• In XML
• In Java
• In HTML
• In JSON

107. In the context of Android development tools, what does DDMS stand for?
Answers:
• Dalvik Debug Monitor Server
• Download Debugging Master System
• Dalvik Drive Monitor Server
• Dalvik Debug Measure Service

108. When does ANR occur?
Answers:
• When a network thread pauses for more than a minute.
• When there has been no response to a system event within 5 seconds.
• When there has been no response to user input event within 5 seconds.
• When the app is selected from within the app launcher, but is not installed.

109. When defining a View within an XML layout, which two attributes are always required?
Answers:
• Width and Height
• LayoutSum and LayoutWeight
• Style and LayoutWeight
• Height and Orientation

110. What is an Intent Filter?
Answers:
• Provides the OS with the data types that an application can receive from an Intent triggered elsewhere.
• Filters the media types shown in an instance of the MediaStore.
• Filters a defined string and removes characters of the supplied type.
• Provides the OS with a list of users allowed to share content from an app.

111. What is the purpose of Volley?
Answers:
• A type-safe client for consuming RESTful APIs in Android and Java in general.
• A convenience library that makes network calls easier and faster.
• An Android unit testing framework.
• An analytics tool that can shed light on parts of an app’s UI that are used most/least.

112. What is Guava?
Answers:
• A hybrid web framework used for developing cross-platform apps for Windows Phone, iOS and Android.
• An open-source project consisting of common libraries for Java, maintained and primarily developed by Google.
• A library that makes it easy for developers to integrate RESTful APIs using industry-standard encryption techniques.
• An OpenGL graphics library aimed specifically at Android devices.

113. What does ANR stand for?
Answers:
• Application Not Recognised
• Application Not Responding
• Android Network Resource
• Asynchronous Network Response

114. Which of the following is true?
Answers:
• Fragments are top-level classes that can contain and manage Activities.
• Activities are top-level classes that can contain and manage Fragments.
• Fragment is the superclass for UI elements such as Buttons, EditText boxes and ImageViews.
• A Fragment is a data bundle that contains information that an Activity requires in order to be drawn to the display.

115. What is a RemoteView for?
Answers:
• It defines a view hierarchy that can be displayed in another process, such as a rich notification layout or home screen widget.
• It defines an inputstream that can display a remote device such as a hardware camera.
• It allows apps to interact with the Google Cast API.
• 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.

116. Which of the following statements are true with regard to an AsyncTask class.
Answers:
• AsyncTasks are executed serially on a single background thread on all versions of Android.
• AsyncTasks execute on a single thread by default from Eclair to Ice Cream Sandwich, and default to thread pool from Jellybean onwards unless programmatically forced to use a single thread. The number of which is restricted only by available system memory available.
• AsyncTasks are executed on parallel threads in all cases, but the maximum number of concurrent instances is restricted to 8 up until KitKat.
• AsyncTasks execute on a single thread by default from Cupcake to Donut, and default to a single thread from Honeycomb onwards unless forced to use a thread pool.

117. Which superclass do most UI elements extend?
Answers:
• View
• Widget
• LinearLayout
• Activity

118. Which of the following data types AIDL has support?
Answers:
• string
• charSequence
• list
• map
• All of the above

119. Which of the following common design patterns use in Android?
Note: There may be more than one right answer.
Answers:
• Model View Controller
• Model View Presenter
• Model View View Model
• None of the above

120.What is the output if following code executed?
public int pxToDp(int px) {
DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
int dp = Math.round(px / (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
return dp;
}
public int dpToPx(int dp) {
DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
return px;
Answers:
• pxToDp() converts pixel into screen size value, and dpToPx() works via versa
• pxToDp() converts pixel into screen status value, and dpToPx() works via versa
• pxToDp() converts pixel into window DPI value, and dpToPx() works via versa
• pxToDp() converts pixel into activity screen size value, and dpToPx() works via versa

121. What does the following code do?
Calendar cal = Calendar.getInstance();
DateFormat dateFormat = new SimpleDateFormat(«yyyy-MM-dd»);
cal.add(Calendar.DATE, -1);
return dateFormat.format(cal.getTime());
Answers:
• Get yesterday date and returns its formatted string
• Get today date and returns its formatted string
• Get tomorrow date and returns its formatted string
• All of the above

122. How to show option menu using the following source on Samsung phone but cannot see it. How to fix it?
try {
ViewConfiguration config = ViewConfiguration.get(this);
Field menuKeyField = ViewConfiguration.class
.getDeclaredField(«sHasPermanentMenuKey»);
if (menuKeyField != null) {
menuKeyField.setAccessible(true);
menuKeyField.setBoolean(config, false);
}
} catch (Exception e) {
e.printStackTrace();
}
Answers:
• startActivity(new Intent(Settings.ACTION_SETTINGS));
startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
startActivity(new Intent(Settings.ACTION_AIRPLANE_MODE_SETTINGS));
startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
• It can be due to Android OS internal problem, we can try to reinstall OS and retry our work
• -AndroidManifest.xml
<uses-permission android:name=»android.permission.ACCESS_FINE_LOCATION» />
<uses-permission android:name=»android.permission.ACCESS_COARSE_LOCATION» />
<uses-permission android:name=»android.permission. WRITE_SECURE_SETTINGS » />
• None of the above

123. What does A() function do?
private void A() {
B(getActivity(), «com.app.package.here»);
}
public void B(Context context, String packageN) {
Intent i = context.getPackageManager().getLaunchIntentForPackage(packageN);
if (i == null) {
i.addCategory(Intent.CATEGORY_LAUNCHER);
context.startActivity(i);
} else {
try {
context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(«market://details?id=» + packageN)));
}
catch (android.content.ActivityNotFoundException anfe) {
context.startActivity(new Intent(Intent.ACTION_VIEW,
Uri.parse(«http://play.google.com/store/apps/details?id=» + packageN)));
}
}
Answers:
• Load application named as “com.app.package.here” and prepare for the execution
• Launch other app named as “com.app.package.here”
• Creates child process named as “com.app.package.here”
• parent process named as “com.app.package.here”

124. Going to check network connection with below source code. What can be required to make it work?
public boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) return true;
return false;
}
Answers:
• android.permission.ACCESS_NETWORK_STATE
• android.permission.ACCESS_NETWORK_CONNECTION
• android.permission.INTERNET
• android.permission.ACCESS_WIFI_STATE

125. Which of the following mechanisms Android has support for data storing and sharing?
Note: There may be more than one right answer.
Answers:
• Saving Activity State
• Data Providers
• Network Connection
• Shared Preferences

126. Which of the following are possible states of a process?
Note: There may be more than one right answer.
Answers:
• Visible Activity
• Foreground Activity
• Background Activity
• Empty Process
• None of the above

127. By default, ArrayAdapter creates a view for each array item by calling toString() on each item and placing the contents in?
Answers:
• Group
• TextView
• List
• Layout

128. The addCategory() method places a category in an Intent object, ____ deletes a category previously added, and ____ gets the set of all categories currently in the object?
Note: There may be more than one right answer.
Answers:
• destroyCategory()
• removeCategory()
• setCategories()
• getCategories()

129. Android Architecture is consisted of the following components?
Note: There may be more than one right answer.
Answers:
• Linux Kernel
• Android Applications
• Android Framework
• Libraries
• None of the above

130. How to capture screen size, choose a correct answer?
Answers:
• Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
width = size.x;
height = size.y;
• int width = getWindowManager().getDefaultDisplay().getWidth();
int height = getWindowManager().getDefaultDisplay().getHeight();
• int height = Resources.getSystem().getDisplayMetrics().widthPixels;
int width = Resources.getSystem().getDisplayMetrics().heightPixels;
• DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
int width = displaymetrics.widthPixels;
• DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels;
int width = displaymetrics.widthPixels;

131. AndroidManifest.xml
<application android:label=»@string/app_name» android:icon=»@drawable/icon»
android:name=»com.intel.starApp»> … ….
<meta-data android:name=»DATABASE» android:value=» example.db»>
<meta-data android:name=»VERSION» android:value=»2″>
<meta-data android:name=»QUERY_LOG» android:value=»true»>
</meta-data></meta-data></meta-data>
Answers:
• Local custom DataBase file name is “example.db”, App version 2.0, Logs selected queries
• Local SQLite DataBase file name is “example.db”, DBMS version 2.0, Logs selected queries
• Local text-type DataBase file name is “example.db”, DBMS version 2.0, Logs selected queries
• Remote DataBase file name is “example.db”, App version 2.0, Logs selected queries

132. When creating main Android App project with Android studio, how can we support localization of the Android App?
Answers:
• main/res/AndroidManifest.xml
• main/res/layout/activity_my.xml
• main/res/values/strings.xml
• main/res/values/styles.xml

133. An Intent object is a bundle of information and what are the object contains?
Answers:
• A)Component,Category
• B)Active,Send
• C)Type,Extra
• D) A and C
• E)A and B

134. Which of the following ADT generates a debug certificate automatically for emulator and device?
Note: There may be more than one right answer.
Answers:
• Key alias:”androiddebugkey”
• Keystore name:”debug.keystore”
• Keystore password:”android”
• Key password:”android”
• None of the above

135. With regard to Android Wear, what is Ambient Mode?
Answers:
• The state which some devices launch into when an app is launched via voice.
• The dimmed or reduced detail display state which some devices enter when they are not being actively interacted with by the user.
• Ambient mode does not apply to Android Wear devices.
• A high power usage state that is a prerequisite to rendering detailed graphics on Android Wear devices.

136. If required during the build process, where should sensitive information such as API Keys, keystore passwords and VCS login details be kept when using Android Studio?
Answers:
• In a configuration file outside of version control, such as gradle.properties.
• As a hard-coded string in committed code.
• In AndroidManifest.xml.
• In a README.txt file in the /assets directory.

137. What does a strikethrough formatting indicate in Android Studio?
Answers:
• That the method or class in use has been deprecated in the current version of the build tools in use.
• That the method or class in use is private.
• That the method or class in use is public.
• That the method or class in use has been newly introduced in the current version of the build tools in use.

138. When publishing updates to an app on the Google Play Store, which of the following is true?
Note: There may be more than one right answer.
Answers:
• The versionCode must remain the same.
• The keystore used to sign the APK to publish the app must match previous published versions.
• The package name must be the same.
• The versionCode must be incremented or higher than the previous published version.
• The versionCode must be decremented or lower than the previous published version.
• The keystore used to publish the app must be different from that used for previous published versions.

139. What is a Master Detail pattern?
Answers:
• A layout pattern consisting of a Master layout (containing a collection of data) and Detail (containing detailed information about an item from the collection).
• A term used in parallel processing where there are multiple Detail threads controlled by a hypervising Master thread manager.
• A layout pattern consisting of a Detail layout (containing a collection of data) and Master (containing detailed information about an item from the collection).
• A layout pattern consisting of a user-interactive Master layout, and a passive non-touch-enabled Detail layout.

140. With regard to Android XML layout definitions, what is the difference between <include> and <merge>.
Answers:
• Include causes all of the specified layout to be inserted into the current layout without modification, whereas an Merge element becomes the root view for a re-usable layout in order to prevent a redundant root element.
• Merge causes all of the specified layout to be inserted into the current layout without modification, whereas an Include element becomes the root view for a re-usable layout in order to prevent a redundant root element.
• Include is only used when a Fragment needs to be added to a layout after onMeasure has been called, whereas an Include element allows a Fragment to be inserted into a layout before onMeasure.
• Include and Merge are not used in Android XML layout definitions.

141. Which of the following FragmentTransaction methods allow the transaction to occur after the parent Activity’s state has been saved?
Answers:
• execute()
• commitAllowingStateLoss()
• commitStateless()
• runOnUiThread()

142. What is Robotium?
Answers:
• An Android unit testing framework.
• An Android test automation framework.
• An Android graphics library.
• An Android build configuration tool.

143. What is the primary purpose of an Intent?
Answers:
• Indicates whether a process was terminated successfully or with an error.
• Provides an interface which can be used by a Fragment interact with its parent Activity.
• Used in order to launch an Activity.
• Used in order to send a command or data to another Application.

144. With regard to graphics, what is the “dirty rect”?
Answers:
• An object that is passed as an argument to the invalidate() method to denote the portion of screen that should be redrawn.
• An area of screen that is not illuminated on the display when in ambient mode.

145. What are the Android Support Libraries for?
Answers:
• They provide APIs that allow developers to provide in-app customer support features.
• They provide APIs that allow developers to provide features aimed at users with additional accessibility requirements.
• They allow features introduced in more recent versions of Android to be used on devices running older OS versions.
• They allow devices running the latest version of Android to use deprecated features from older OS versions.

146. The default action resultant when pressing the device back button is to pop the backstack. What is the backstack?
Answers:
• A stack data structure containing every activity in the order that they were opened. The pop action removes the most recently opened activity.
• 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.
• An array containing the inheritance architecture of every View in the current Fragment.
• A stack data structure

147. What is the purpose of a Loader?
Answers:
• Loaders are special-case data streams that provide a bytewise iterator when accessing files from external storage.
• Loaders are convenience classes that make the asynchronous fetching and loading of data into a Fragment or Activity easier.
• Loaders are Android native classes that are used when graphics are drawn to screen via a canvas.
• Loaders are UI elements that indicate to the user at an asynchronous action is in progress.

148. What is the purpose of the Systrace tool?
Answers:
• It analyzes the execution of an application and places operations into a system-wide context on a common, visual timeline.
• It outlines the bounds of visual elements of an app to better identify overdraw.

149. What is a WakeLock?
Answers:
• A feature of the PowerManager that indicates to the system that your app requires the device to stay on.
• A system-wide developer setting that prevents apps from waking up the device.
• The internal name for the default Android system clock.
• The internal name for the Chrome for Android password manager.

150. AndroidMainfest.xml file contains the following essential information about your app: (choose all that apply)
Note: There may be more than one right answer.
Answers:
• App icon
• Theme affects
• App activities
• Required libraries

151. The addCategory() method places a category in an Intent object, ____ deletes a category previously added, and ____ gets the set of all categories currently in the object?
Answers:
• destroyCategory()
• removeCategory() , getCategories()
• setCategories(), destoryCategory()
• findCategories()

152. If the intent has extra integer information passed to it with a name of «message», we can retrieve that information using which of the following?
Answers:
• intent.getStringExtra(«message»);
• intent.getIntExtra(«message»);
• intent.getObjectExtra(«message»);
• intent.getExtra(«message»);

153. What is Espresso?
Answers:
• An Android hardware performance analysis library.
• An Android UI testing library and API.
• The name given to a specific release version of the Android OS.
• An open source, free Java implementation, upon which Android is based.

154. What does the following code output do?
public class XYZ extends AsyncTask<string, void,=»» string=»»> {
@Override
protected String doInBackground(String… params) {
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
final WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK
|PowerManager.ACQUIRE_CAUSES_WAKEUP |PowerManager.ON_AFTER_RELEASE, «»);
wl.acquire();
return «Executed»;
}
@Override
protected void onPostExecute(String result) {}
}
Answers:
• Startup power manager to save screen power
• Unlock the screen
• Turn on the screen
• Wake up the phone
• Lock the screen

155. A service has lifecycle callback methods that you can implement to __ changes in the service’s state and you can perform work at the appropriate stage.
Answers:
• load
• monitor
• send
• file

156. Which of the following methods are called during the life cycle of an android activity?
Note: There may be more than one right answer.
Answers:
• onCreated
• onStart
• onStop
• onDestroy
• All of the above

157. After building an Android project with Android Studio, what is the purpose of generating R.java as follows?
package com.intelstar.venus;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class string {
public static final int app_name=0x7f040000;
}
}
Answers:
• R class is used for the linking of the resource into the source code
• R class is the meta-codes for the building of the project
• R class is the extension file that can be edited later for the source upgrading
• R class is a meta class that the resources were built

158. The following are key components under Android application Architecture:
Note: There may be more than one right answer.
Answers:
• resource externalization
• notifications
• content providers
• intented

159. What is the output if the following code is executed?
Values/google_maps_api.xml
google_maps_key (key from <a href=»https://console.developers.google.com/»>https://console.developers.google.com</a>/)
<AndroidManifest.xml
<uses-permission android:name=»android.permission.ACCESS_FINE_LOCATION»>
<uses-permission android:name=»android.permission.ACCESS_COARSE_LOCATION»>
<meta-data
<pre><code> android:name=»com.google.android.geo.API_KEY»
android:value=»@string/google_maps_key» />
</uses-permission></uses-permission>
Build.gradle(Module: app)
Dependencies{
Compile ‘com.google.android.gms:play-services:8.4.0’
}
Answers:
• Load Google map API from the remote library
• Get Google map key from the server and register environment variable for that
• Permits geolocation service and map processing
• Supports Google Map API environment for the geolocation and map related app

160. The best practice is to put string values in ___ file.
Answers:
• strings.xml
• strings.java
• android.text
• resource.rsc

161. The strings.xml has a ____ element, which contains one or more <string> elements.
Answers:
• <container>
• <main>
• <resources>
• <strings>

162. A layout can retrieve the value of the String named ‘stringmessage’ using ‘___’.
Answers:
• string/string_message
• #string/string_message
• @string/string_message
• #string_message

163. What does the following code do?
public void launchScreen(Activity activity) {
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_HOME);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
activity.startActivity(intent);
}
Answers:
• Opens launcher screen
• Opens Home screen
• Opens New task screen
• None of the above

164. Buttons and text views both inherit from the same Android class named ___.
Answers:
• view.View
• android.View
• android.view.View
• android.view.Layout

165. Which of the following is/are correct about Intent filter?
Note: There may be more than one right answer.
Answers:
• An intent filter specifies what types of intent each component can receive.
• Intent filters are defined inside AndroidManifest.xml
• An intent filter also specifies a category
• An intent filter must include a category of android.intent.category.DEFAULT, if it’s to receive explicit intents

166. One can declare logical parent «.MainActivity» to <activity> by adding the following line in respective <activity> in AndroidManifest.xml.
Answers:
• android:parentActivityName=».MainActivity»
• android:logialParentActivityName=».MainActivity»
• android:parentActivity=».MainActivity»
• android:activityName=».MainActivity«

167. To pass extra information with intent we can use the following Intent object method?
Answers:
• putExtra()
• putMessage()
• putText()
• putValue()

168. Which of the following lifecycle methods are common to both Activity and Fragment?
Note: There may be more than one right answer.
Answers:
• onAttach()
• onCreate()
• onStart()
• onDetach()

169. The ‘showAsAction’ attribute of item in a menu resource file can have which of the following values? Check all that apply.
Note: There may be more than one right answer.
Answers:
• ifRoom
• withText
• never
• withIcon

170. ____ are like reusable components or subactivities and can be reused between screens.
Answers:
• Views
• Activities
• Fragments
• Layouts

171. Which of the following is true for R.java? (choose all that apply)
Note: There may be more than one right answer.
Answers:
• R.java is a special Java file that gets generated by the Android tools whenever you create or build your app
• Android uses R.java to keep track of the resources used within the app
• It enables you to get references to GUI components from within your activity code
• It contain string resources

172. Which statement converts the Object into String?
Answers:
• String.valueOf(Object)
• String.value(Object)
• string.valueOf(Object)
• None of the above

173. Which method sets the layout for the activity?
Answers:
• setLayoutView()
• setActivityView()
• setView()
• setContentView()

174. To run your app on REAL device which of the following are required? Check all that apply.
Note: There may be more than one right answer.
Answers:
• Enable USB debugging on Android device
• Install USB driver for Windows or create udev rules file for Linux. No USB drivers needed for Mac
• Create AVD in Android Studio
• Plug Android device to your computer

175. Which of the following is not an activity lifecycle method?
Answers:
• onCreate()
• onStart()
• onStop()
• onDetach()

176. Which of the following are true for intent?
Note: There may be more than one right answer.
Answers:
• It’s a type of message that allows you to bind separate objects (such as activities) together at runtime.
• If one activity wants to start a second activity, it does it by sending an intent to Android.
• startActivity(intent);
This tells Android to start the activity specified by the intent.
• Intent is an Object

177. Which of the following correctly adds a string array resource to strings.xml?
Answers:
• <string_array name=»string_array_name»>
<item>string_value1</item>
<item>string_value2</item>
<item>string_value3</item>
</string_array>
• <array name=»string_array_name»>
<item>string_value1</item>
<item>string_value2</item>
<item>string_value3</item>
</array>
• <string-array name=»string_array_name»>
<item>string_value1</item>
<item>string_value2</item>
<item>string_value3</item>
</string-array>
• None of the above

178. What is the output if the following code is executed?
final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List pkgAppsList = getPackageManager().queryIntentActivities(mainIntent, 0);
for (Object object : pkgAppsList) {
<pre><code>ResolveInfo info = (ResolveInfo) object;
File file = new File(info.activityInfo.applicationInfo.publicSourceDir);
// …
}
Answers:
• Get list of installed applications and try to launch them one by one.
• Get list of installed applications and get public source directory for each app
• Get list of launched applications and get file handle for each app
• Get list of launched applications and get public source directory for each app

179. To connect list view to array we can use:
Answers:
• ArrayAdapter
• listView
• Activity
• Handle

No comments:

Post a Comment