Sunday, November 6, 2016

Android Programming Test 2016 – Upwork Test Answers

Upwork Android Programming Test 2016 >>> 

80 Answered Test Questions:
1. Which of the following are UI elements that you can use in a window in an Android application?
Answers:
a. TextBox
a. TextView
a. TextField
a. TextElement
a. EditText
a. RichText
2. What is the correct way to fix if checking the status of the GPS_PROVIDER throws SecurityException?
Answers:
a. request permission for ACCESS_COARSE_LOCATION
a. request permission for ACCESS_FINE_LOCATION
a. request permission for INSTALL_LOCATION_PROVIDER
a. None of the above
3. Which of the following is not Content Provider?
Answers:
a. Contacts
a. Contacts
a. Shared Preferences
a. MediaStore
a. Bookmarks
a. Settings
4. 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. a) and b) are true
a. a) and c) are true
a. b) and c) are true
a. all statements are true
5. What does the following code do?
SensorManager mgr = (SensorManager) getSystemService(SENSOR_SERVICE);
List sensors = mgr.getSensorList(Sensor.TYPE_ALL);
for (Sensor sensor : sensors) {
System.out.println(“”+sensor.getName());
}
Answers:
a. prints names of all available sensors in device
a. prints names of all available sensor types in device
a. prints names of all sensors which are not available
a. none of above
6. 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:
a. prints token
a. prints IOException
a. prints UserRecoverableAuthException
a. prints GoogleAuthException
7. Which of the following is correct to use for data transfer regularly and efficiently, but not instantaneously?
Answers:
a. AsyncTask
a. IntentService
a. Sync adapters
a. All of these
8. What is the ListActivity class used for?
Answers:
a. Create a view to display a list of items from a data source. 
a. List all the activities currently running on the Android device.
a. List all the activites that are installed on the Android device.
a. List the activities whose IntentFilters match with a particular Intent type.
9. Using a content provider, which of the following operations are able to perform?
a) create
b) read
c) update
d) delete
Answers:
a. a, b and c
a. b, c and d
a. all of these
a. none of these
10. Which of the following widgets helps to embed images in activities?
Answers:
a. ImageView
a. ImageButton
a. both of above
a. none of these
11. What is the best way of opening camera as sub-activity?
Answers:
a. Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivity(takePictureIntent);
a. Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, 1); }
a. Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(takePictureIntent, 1);
a. Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takePictureIntent, -1); }
12. What is the correct way to restrict app visibility on Google Play to devices that have a camera?
Answers:
a.
a. 
a.
a.
13. Which of the following sensors is only hardware-based?
Answers:
a. linear acceleration sensor
a. gravity sensor
a. rotation vector sensor
a. accelerometer sensor
14. Which of the following formats is not supported in Android?
Answers:
a. MP4
a. MPEG
a. AVI
a. MIDI
15. 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. A, B, C and D
a. C, D, E and F
a. A, B, E and F
a. all of these
16. Which of the following permissons is needed to perform the network operations through internet?
a) INTERNET
b) ACCESS_NETWORK_STATE
Answers:
a. a
a. b
a. both
a. none
17. 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);
}
Which of the following should be used ?
Answers:
a. editor.save(); editor.close();
a. editor.save(); editor.finish();
a. editor.commit();
a. editor.save();
a. editor.close();
a. editor.finish();
18. 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:
a. CursorLoader
a. ContentResolver
a. ContentProvider
a. Loader
19. What is the advantage of using AsyncTaskLoader instead of AsyncTask?
Answers:
a. a bit easier to work with
a. the possibility easily update progress bar
a. no comparison, because it implements completely different functionality
a. less work with the configuration of application
20. 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:
a. checking Network connection. 
a. checking only WIFI network connectivity.
a. checking only Bluetooth data connection.
a. checking only Ethernet data connection
21. 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:
a. Statement A is true, while Statement B is false.
a. Statement B is true, while Statement A is false.
a. Both statements are true.
a. Both statements are false. 
22. 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:
a. Statement A is true, while Statement B is false.
a. Statement B is true, while Statement A is false. 
a. Both statements are true.
a. Both statements are false.
23. Which of the following protocols are provided by Google for GCM Connection Servers?
A) HTTP
B) XMPP
C) SOAP
D) RMI
Answers:
a. A and B
a. A, B, C
a. C, D
a. all of these
24. Which of the following 4 classes does not relate to others?
ApplicationInfo, SyncInfo, ActivityInfo, PackageInfo
Answers:
a. ApplicationInfo
a. SyncInfo
a. ActivityInfo
a. PackageInfo
25. Which of the following are valid ways to deploy an Android application to a device?
Answers:
a. Using the “adb install /path/to/apk” command from the command prompt/terminal, when USB Debugging Mode is enabled in the device.
a. Exporting and signing the package, then browsing it to install.
a. Launching the application from an IDE, when USB Debugging Mode is enabled in the device.
a. All of these. 
26. Which of the following classes is not used in working with database?
Answers:
a. SQLiteOpenHelper
a. SQLiteDatabase
a. ContentProvider
a. DatabaseHelper
27. Consider the XML fragment below, which is taken from one of the files in an Android project:
Which of the following are true about the XML fragment above?
Answers:
a. It is taken from the manifest XML file of the Android project.
a. It is taken from an XML file used to define a view.
a. It is taken from the package file (.apk) of the Android project.
a. The xmlns: attribute is a compulsory attribute.
a. If this is not the outer most tag in the XML file then it need not contain the xmlns: attribute.
a. MyElement should be the name of a class derived, directly or indirectly, from the View class. 
28. Which of the following statement is correct regarding StrictMode?
Answers:
a. StrictMode detects improper layouts
a. StrictMode detects operation which blocks UI
a. StrictMode detects the speed of the connection
a. All of the above
29. Consider the code snippet below:
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(PATH_TO_FILE);

mp.start();
Which of the following should be placed at ?
Answers:
a. mp.prepare();
a. mp.prepareAsync();
a. mp.loadMedia();
a. mp.loadSource();
a. mp.loadSource(); mp.prepare();
a. No code is required at to start playback.
30. 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:
a. When the device receives an incoming phone call.
a. When an outgoing phone call is initiated on the device. 
a. When the user presses the CALL button on the device.
a. The code in will never get executed.
31. Which of the following are true about enabling/disabling menu items from an Activity class?
Answers:
a. onCreateOptionsMenu can be used to enable/disable some menu items in an Android application.
a. onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application. 
a. onShowOptionsMenu can be used to enable/disable some menu items in an Android application.
a. The menu items in an Android application cannot be disabled.
32. Which of the following should be used to save the unsaved data and release resources being used by an Android application?
Answers:
a. Activity.onStop()
a. Activity.onPause()
a. Activity.onDestroy()
a. Activity.onShutdown()
a. Activity.onFreeze()
33. Which of the following statements are correct with regards to publishing updates of apps on Google Play?
Answers:
a. The android:versionCode attribute in the manifest file must be incremented and the APK file must be signed with the same private key. 
a. The android:versionCode attribute in the manifest file must be same and the APK file must be signed with the same private key.
a. The android:versionCode attribute in the manifest file must be incremented and the APK file must be signed with the new private key.
a. The android:versionCode attribute in the manifest file must be same and the APK file must be signed with the new private key.
34. Which of the following would you have to include in your project to use the SimpleAdapter class?
Answers:
a. import android.content;
a. import android.widget; 
a. import android.database;
a. import android.database.sqlite;
a. import android.util;
35. Which of the following is/are appropriate for saving the state of an Android application?
Answers:
a. Activity.onFreeze()
a. Activity.onPause()
a. Activity.onStop()
a. Activity.onDestroy()
36. Which of the following is the parent class for the main application class in an Android application that has a user interface?
Answers:
a. MIDLet
a. AndroidApp
a. Activity
a. AppLet
a. Application
37. Which of the following can be used to bind data from an SQL database to a ListView in an Android application?
Answers:
a. SimpleCursor
a. SimpleCursorAdapter
a. SimpleAdapter
a. SQLiteCursor
a. SQLLiteAdapter
38. Consider the code snippet below:
MediaPlayer mp = new MediaPlayer();
mp.setDataSource(PATH_TO_FILE);

mp.start();
Which of the following should be placed at ?
Answers:
a. mp.prepare();
a. mp.prepareAsync();
a. mp.loadMedia();
a. mp.loadSource();
a. mp.loadSource(); mp.prepare();
a. No code is required at to start playback.
39. Which of the following packages provide the classes required to manage the Bluetooth functionality on an Android device?
Answers:
a. android.hardware
a. android.bluetooth
a. android.bluez
a. org.bluez
40. Which of the following can be accomplished by using the TelephoneNumberUtil class?
Answers:
a. Save a phone number to the contacts in the phone device.
a. Retrieve a phone number from the contacts in the phone device.
a. Delete a phone number from the contacts in the phone device.
a. Format an international telephone number. 
a. Setting and retrieving the call forwarding phone number on the phone device.
41. 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:
a. Adding this line to the Android manifest file:
a. Adding these two lines to the Android manifest file: 
a. Adding this line to the Android manifest file:
a. Adding this line to the Android manifest file:
42. Which of the following are true about PhoneStateIntentReceiver.notifyPhoneCallState?
Answers:
a. notifyPhoneCallState has to be called if your application wishes to receive a notification about an incoming phone call. 
a. notifyPhoneCallState is a call back function that is called when the call state changes.
a. notifyPhoneCallState is called to initiate a call from the device.
a. notifyPhoneCallState is used to send notifications about call states.
a. notifyPhoneCallState gets called when the device receives an incoming phone call.
43. 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:
a. Statement A is true, while Statement B is false.
a. Statement B is true, while Statement A is false.
a. Both statements are true. 
a. Both statements are false.
44. Which of the following functions will return all available Content Providers?
Answers:
a. List returnList = new ArrayList(); for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_PROVIDERS)) { ProviderInfo[] providers = pack.providers; if (providers != null) { returnList.addAll(Arrays.asList(providers)); } } return returnList; 
a. return getContext().getPackageManager().queryContentProviders(“com.google”, Process.myUid(), 0);
a. List returnList = new ArrayList(); for (PackageInfo pack : getPackageManager().getInstalledPackages(PackageManager.GET_RECEIVERS)) { ActivityInfo[] providers = pack.receivers; if (providers != null) { returnList.addAll(Arrays.asList(providers)); } } return returnList;
a. None of these.
45. What is the purpose of the ContentProvider class?
Answers:
a. To play rich media content files.
a. To create and publish rich media files.
a. To share data between Android applications. 
a. To access the global information about an application environment.
a. To maintain global application state.
46. Which of the following are true?
Answers:
a. Both startActivity and startSubActivity start an activity synchronously.
a. Both startActivity and startActivityForResults start an activity asynchronously. 
a. startActivity is an asynchronous call, but startSubActivity is synchronous.
a. startActivity is a synchronous call, but startSubActivity is asynchronous.
47. Which of the following is the immediate base class for Activity and Service classes?
Answers:
a. Application
a. ApplicationContext
a. Context
a. Component
a. Object
48. Which of the following are classes that can be used to handle the Bluetooth functionality on a device?
Answers:
a. Adapte
a. Manage
a. Matche
a. BluetoothAdapte
49. How many expansion files can an APK file have? Select all correct options.
Answers:
a. one
a. two
a. three
a. four
50. Which of the following are Android build modes?
Answers:
a. Debug mode
a. Release mode
a. Production mode
a. Development mode
51. What is “Android-dx”?
Answers:
a. A command line tool to create Android project files.
a. A framework to create unit tests for Android projects.
a. A resource editor to create user interface for Android applications.
a. A tool to generate Android byte code from .class files. 
a. An emulator to execute and debug Android projects.
52. Consider the XML fragment below, which is taken from one of the files in an Android project:


Which of the following are true about the XML fragment above?
Answers:
a. It is taken from the manifest xml file of the Android project.
a. It is taken from an XML file used to define a view.
a. It is taken from the package file (.apk) of the Android project.
a. The xmlns: attribute is a compulsory attribute.
a. If this is not the outer most tag in the XML file then it need not contain the xmlns: attribute.
a. MyElement should be the name of a class derived, directly or indirectly, from the View class. 
53. Which of the following fields of the Message class should be used to store custom message codes about the Message?
Answers:
a. tag
a. what
a. arg1
a. arg2
a. userData
54. 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:
a. Screen2 has to be a part of MyAndroid.
a. Screen2 can exist in any other Android application installed on the device.
a. Screen2 will always be launched asynchronously.
a. Screen2 can be launched synchronously.
a. Screen2 can return a result code to Screen1 if launched with startActivity.
a. Screen2 can return a result code to Screen1 if launched with startActivityForResult. 
55. Select the two function calls that can be used to start a Service from your Android application?
Answers:
a. bindService
a. startService
a. runService
a. startActivity
56. Which of the following Integrated Development Environments can be used for developing software applications for the Android platform?
Answers:
a. Android IDE
a. Eclipse
a. Visual Studio 2005
a. Visual Studio 2008
57. Which of the following can you use to display an HTML web page in an Android application?
Answers:
a. WebBrowser
a. BrowserView
a. WebView
a. Browser
a. HtmlView
58. 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);

}
Which of the following should be used ?
Answers:
a. editor.save(); editor.close();
a. editor.save(); editor.finish();
a. editor.commit();
a. editor.save();
a. editor.close();
a. editor.finish();
59. What is “Android-Positron”?
Answers:
a. A command line tool to create Android project files.
a. A framework to create unit tests for Android projects. 
a. A resource editor to create user interface for Android applications.
a. A tool to generate Android byte code from .class files.
a. An emulator to execute and debug Android projects.
60. Which of the following can you use to add items to the screen menu?
Answers:
a. Activity.onCreate
a. Activity.onCreateOptionsMenu
a. Constructor of the Activity class.
a. Activity.onCreateMenu
a. Activity.onStart
a. Activity.onPrepareOptionsMenu
61. 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:
a. onCreate
a. onInit
a. onCompleteThaw
a. onRestart
62. What is the interface Spannable used for?
Answers:
a. Manipulate text that can span across multiple pages.
a. Manipulate text that can span across multiple TextView windows.
a. This is the interface for text to which markup objects can be attached and detached. 
a. String parsing.
63. What is correct regarding GCM – Google Cloud Messaging service?
Answers:
a. It does server to device communication.
a. It does device to server communication.
a. It does device to server communication and vice versa. 
a. It does device to device communication.
64. Which of the following procedures will get the package name of an APK file?
Answers:
a. Looking for the package attribute’s value of the element in the manifest file.
a. Executing the command, “pm list packages -f”, in the ADB shell.
a. Programmatically, using PackageManager in an installed Android app. 
a. Using the AAPT platform tool, “aapt dump badging apkName.apk”.
65. What is the maximum supported file size for a single APK file (excluding expansion packages) in the Google Play Store?
Answers:
a. 50MB
a. 2GB
a. 30MB
a. unlimited
66. What is Android?
Answers:
a. A new programming language that can be used to develop applications for mobile devices.
a. A new IDE that can be used to develop applications for mobile devices.
a. A software stack for mobile devices that includes an operating system, middleware and key applications. 
a. A new mobile device developed by Google.
67. Which of the following can be used to navigate between screens of different Android applications?
Answers:
a. Binde
a. Flow
a. Navigate
a. Intent
a. ApplicationContext
68. Which of the following are valid features that you can request using requestWindowFeature?
Answers:
a. FEATURE_NO_TITLE
a. FEATURE_NO_ICON
a. FEATURE_RIGHT_ICON
a. FEATURE_NO_MENU
a. FEATURE_TRANSPARENT_WINDOW
69. Which of the following are true?
Answers:
a. startActivity and startActivityForResult can both be used to start a new activity from your activity class. 
a. Only startActivityForResult can be used to launch a new activity from your activity class.
a. startActivity(myIntent); and startActivityForResult(myIntent, -1); have the same result.
a. startActivity(myIntent); and startActivityForResult(myIntent, 0); have the same result.
a. 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.
a. 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.
70. Which of the following can you use to display a progress bar in an Android application?
Answers:
a. ProgressBa
a. ProgressDialog
a. ProgressItem
71. Which of the following can be used to handle commands from menu items in an Android application?
Answers:
a. commandAction
a. onMenuItem
a. onMenuItemSelected
a. onMenuItemClicked
a. onOptionsItemSelected
72. Fill in the blank:
Once an app is published, the ________ cannot be changed. It should be unique for each APK.
Answers:
a. private key
a. package name
a. main activity
a. APK file name
73. 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:
a. android:versionCode
a. android:versionName
a. android:targetSdkVersion
a. android:maxSdkVersion
74. Which of the following are true about Intent.CALL_ACTION and Intent.DIAL_ACTION?
Answers:
a. Both of them are used to dial a phone number on the device.
a. Intent.action == Intent.CALL_ACTION is true when a phone call is received on the device.
a. Intent.action = Intent.CALL_ACTION is used when a phone number is to be dialled without showing a UI on the device. 
a. Intent.action = Intent.DIAL_ACTION is used when a phone number is to be dialled without showing a UI on the device.
a. Intent.action = Intent.CALL_ACTION is used when a phone number is to be dialled without the user having to explicitly initiate the call.
a. Intent.action = Intent.DIAL_ACTION is used when a phone number is to be dialled without the user having to explicitly initiate the call.
75. Suppose MyView is a class derived from View and mView is a variable of type MyView. Which of the following should be used to display mView when the Android application is started?
Answers:
a. Call setCurrentView(mView) in the startApp() of the main application class.
a. Call setContentView(mView) in the startApp() of the main application class.
a. Call setContentView(mView) in the onStart() of the main application class.
a. Call setContentView(mView) in the onCreate() of the main application class. 
76. Which of the following programming languages can be used to develop software applications for the Android platform?
Answers:
a. Java
a. C# with .NET Compact Framework for mobile devices.
a. C programming language.
a. Android programming language.
77. 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:
a. import android.drivers;
a. import android.hardware.camera; 
a. import android.camera;
a. import android.util;
a. import android.hardware;
78. What is “Android-activityCreator”?
Answers:
a. A command line tool to create Android project files. 
a. A framework to create unit tests for Android projects.
a. A resource editor to create user interface for Android applications.
a. A tool to generate Android byte code from .class files.
a. An emulator to execute and debug Android projects.
79. What is the maximum supported size for a single expansion file in the Google Play Store?
Answers:
a. 50MB
a. 2GB
a. 30MB
a. unlimited
80. Which of the following tools can be used to reduce apk package size?
Answers:
a. lint
a. ProGuard
a. zipalign
a. etc1tool

No comments:

Post a Comment

Earn for Free

http://hiredrmjru.trade/3670784521590/