Saturday, January 2, 2016

Complete Android Programming Test answers 2016

Find Complete and recently updated Correct Question and answers of Android Programming Test of Upwork. All Answers updated regularly with new questions. Upwork Android Programming Test answers of 2016.



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

Answer: • TextView

Answer: • EditText

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

Answer: • request permission for ACCESS_FINE_LOCATION

Question:* Which of the following is not Content Provider?

Answer: • Shared Preferences

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.

Answer: • all statements are true

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()); }

Answer: • prints names of all available sensors in device

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"); }

Answer: • prints token

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

Answer: • Sync adapters

Question:* What is the ListActivity class used for?

Answer: • Create a view to display a list of items from a data source.

Question:* Using a content provider, which of the following operations are able to perform? a) create b) read c) update d) delete

Answer: • b, c and d

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

Answer: • both of above

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

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

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

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

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

Answer: • accelerometer sensor

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

Answer: • AVI

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

Answer: • all of these

Question:* Which of the following permissons is needed to perform the network operations through internet? a) INTERNET b) ACCESS_NETWORK_STATE

Answer: • a

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

Answer: • editor.commit();

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.

Answer: • ContentResolver

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

Answer: • less work with the configuration of application

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()); }

Answer: • checking Network connection.

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.

Answer: • Both statements are false.

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

Answer: • Statement B is true, while Statement A is false.

Question:* Which of the following protocols are provided by Google for GCM Connection Servers? A) HTTP B) XMPP C) SOAP D) RMI

Answer: • A and B

Question:* Which of the following 4 classes does not relate to others? ApplicationInfo, SyncInfo, ActivityInfo, PackageInfo

Answer: • SyncInfo

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

Answer: • All of these.

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

Answer: • DatabaseHelper

Question:* 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?

Answer: • MyElement should be the name of a class derived, directly or indirectly, from the View class.

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

Answer: • All of the above

Question:* 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>?

Answer: • mp.prepare();

Question:* 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?

Answer: • When an outgoing phone call is initiated on the device.

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

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

Question:* Which of the following should be used to save the unsaved data and release resources being used by an Android application?

Answer: • Activity.onDestroy()

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

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

Question:* Which of the following would you have to include in your project to use the SimpleAdapter class?

Answer: • import android.widget;

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

Answer: • Activity.onPause()

Question:* Which of the following is the parent class for the main application class in an Android application that has a user interface?

Answer: • Activity

Question:* Which of the following can be used to bind data from an SQL database to a ListView in an Android application?

Answer: • SimpleCursorAdapter

Question:* 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>?

Answer: • mp.prepare();

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

Answer: • android.bluetooth

Question:* Which of the following can be accomplished by using the TelephoneNumberUtil class?

Answer: • Format an international telephone number.

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?

Answer: • 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" />

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

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

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.

Answer: • Both statements are true.

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

Answer: • 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;

Question:* What is the purpose of the ContentProvider class?

Answer: • To share data between Android applications.

Question:* Which of the following are true?

Answer: • Both startActivity and startActivityForResults start an activity asynchronously.

Question:* Which of the following is the immediate base class for Activity and Service classes?

Answer: • Context

Question:* Which of the following are classes that can be used to handle the Bluetooth functionality on a device?

Answer: • BluetoothAdapte

Question:* How many expansion files can an APK file have? Select all correct options.

Answer: • two

Question:* Which of the following are Android build modes?

Answer: • Debug mode

Question:* What is "Android-dx"?

Answer: • A tool to generate Android byte code from .class files.

Question:* 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?

Answer: • MyElement should be the name of a class derived, directly or indirectly, from the View class.

Question:* Which of the following fields of the Message class should be used to store custom message codes about the Message?

Answer: • what

Question:* 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?

Answer: • Screen2 can return a result code to Screen1 if launched with startActivityForResult.

Question:* Select the two function calls that can be used to start a Service from your Android application?

Answer: • startService

Question:* Which of the following Integrated Development Environments can be used for developing software applications for the Android platform?

Answer: • Eclipse

Question:* Which of the following can you use to display an HTML web page in an Android application?

Answer: • WebView

Question:* Consider the following snippet of code: <font size =2> @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>? </font

Answer: • editor.commit();

Question:* What is "Android-Positron"?

Answer: • A framework to create unit tests for Android projects.

Question:* Which of the following can you use to add items to the screen menu?

Answer: • Activity.onCreateOptionsMenu

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?

Answer: • onCompleteThaw

Question:* What is the interface Spannable used for?

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

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

Answer: • It does device to server communication and vice versa.

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

Answer: • Programmatically, using PackageManager in an installed Android app.

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

Answer: • 50MB

Question:* What is Android?

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

Question:* Which of the following can be used to navigate between screens of different Android applications?

Answer: • Intent

Question:* Which of the following are valid features that you can request using requestWindowFeature?

Answer: • FEATURE_NO_TITLE

Question:* Which of the following are true?

Answer: • startActivity and startActivityForResult can both be used to start a new activity from your activity class.

Question:* Which of the following can you use to display a progress bar in an Android application?

Answer: • ProgressDialog

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

Answer: • onOptionsItemSelected

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

Answer: • package name

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)?

Answer: • android:versionCode

Question:* Which of the following are true about Intent.CALL_ACTION and Intent.DIAL_ACTION?

Answer: • Intent.action = Intent.CALL_ACTION is used when a phone number is to be dialled without showing a UI on the device.

Question:* 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?

Answer: • Call setContentView(mView) in the onCreate() of the main application class.

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

Answer: • Java

Question:* 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?

Answer: • import android.hardware.camera;

Question:* What is "Android-activityCreator"?

Answer: • A command line tool to create Android project files.

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

Answer: • 2GB

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

Answer: • ProGuard



HTML5 Upwork (oDesk) TEST ANSWERS 2022

HTML5 Upwork (oDesk) TEST ANSWERS 2022 Question: Which of the following is the best method to detect HTML5 Canvas support in web br...

Disqus for upwork test answers