Font size
WorksheetsExam Code: AND-401
Total questions: 74
Worksheet time: 6hrs 10mins
Q1.What method you should override to use Android’s menu which is placed on the action bar?
onCreateOptionsMenu( )
onCreateMenu( )
onMenuCreated( )
onMenuCreated( )
Q2.What Activity method you use to retrieve a reference to an Android view by using the id attribute of a resource XML?
findViewByReference(int id)
findViewById(int id)
retrieveResourceById(int id)
findViewById(String id)
Q3.Which of the following is not an Android component (i.e. a point from which the system can enter your application)?
Service
Activity
Layout
Content Provider
Q4.During an Activity life-cycle, what is the first callback method invoked by the system?
onStop( )
onStart( )
onCreate( )
onRestore( )
Q5.Which configuration file holds the permission to use the internet?
Layout file
Property file
Java source file
Manifest file
Q6.What does the following line of code achieve?
Intent intent = new Intent(FirstActivity.this, SecondActivity.class );
Creates a hidden Intent.
Creates an implicit Intent.
Create an explicit Intent.
Starts an activity.
Q7. Which of the following is NOT a valid usage for Intents?
Activate and Activity
Activate a Service.
Activate a Broadcast receiver.
Activate a SQLite DB Connection.
Q8. Which of the following is not a valid Android resource file name?
mylayout.xml
myLayout.xml
my_layout.xml
mylayout1.xml
Q9. Which one of the following is not a valid name for process state?
Bound
A Visible
Foreground
Background
Q10. What is a correct statement about an XML layout file?
A layout PNG image file
A file used to draw the content of an Activity
A file that contains all application permission information
. A file that contains a single activity widget
Q11. Which folder contains the Android project Java files?
res
manifests
assets
java
Q12.Which file specifies the minimum required Android SDK version your application supports?
main.xml
R.java
strings.xml
build.gradle
Q13. What is the parent class of all Activity widgets?
ViewGroup
Layout
View
Widget
Q14. What is the name of the class used by Intent to store additional information?
Extra
Parcelable
Bundle
DataStore
Q15.Which of the following is not included in the Android application framework?
WindowManager
NotificationManager
DialerManager
PackageManager
Q16.Which of the following is NOT true about the R.java file?
It is auto-generated during the build of the project
It is used by developers to access any resource through an ID
It can be modified manually to change the ID of a resource
It contains resource IDs for all resources in your /res/ folder
Q17.You can create a custom view by extending class Activity
True
False
Q18.Which of these files contains text values that you can use in your application?
AndroidManifest.xml
res/Text.xml
res/layout/Main.xml
res/values/strings.xml
Q19. What does the Android project folder “res/” contain?
Java Activity classes
Resource files
Java source code
Libraries
Q20. What does this code do?
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW); intent.setData(android.net.Uri.parse("http://www.androidatc.com")); startActivity(intent);
Starts a sub-activity.
Starts a service
Sends results to another activity
Starts an activity using an implicit intent
Q21.Which method should you use to start a sub-activity?
startActivity(Intent intent)
startActivityForResult(Intent intent)
startService(Intent intent)
startSubActivity(Intent intent)
Q22. Which of following is NOT correct about Battery Historian tool?
It is an open source script
It converts the battery data collected by Batterystats into HTML visualization
It collects and converts the battery data into HTML visualization
It is not the part of Android framework
Q23. Which of the following is required for getting the best output from performance profiling tools in Android Studio?
A. It works only on real devices
B. Disable the instant run before profiling the app
C. Enable the instant run before profiling the app
D. Both A & C
Q24.What is the second layer from top called in the following diagram of Android’s Architecture
Applications layer
Application framework.
Linux kernel.
Android runtime
Q25.Which of the following tools creates certificates for signing Android applications?
adb
logcat
keytoo
certgen
Q26. Which Android permission you should add to allow your application to read the device’s address book?
READ_ADDRESS_DATA
READ_PHONE_STATE
READ_PHONE_CONTACTS
READ_CONTACTS
Q27.Which of the following methods is called in an Activity when another activity gets into the foreground?
onStop( )
onPause( )
onDestroy( )
onExit( )
Q28.Which of the following attributes is used to set an activity screen to landscape orientation?
screenorientation = landscape
screenOrientation=”landscape”
android:ScreenOrientation=“landscape”
android:screenOrientation=”landscape”
Q29.What is not true about the AndroidManifest.xml file?
It declares the views used within the application.
It declares user permissions the application requires.
It declares application components
It declares hardware and software features used within the application.
Q30. Which of the following commands is used to dump all the battery data in txt file?
adb shell dump batterystats > batterystats.txt
adb shell dumpsys batterystats > batterystats.txt
adb shell dump batterystats.txt > batterystats
adb shell dumpsys batterystats.txt > batterystats
Q31. If your application is throwing exception android.content.ActivityNotFoundException, which of the following could resolve the problem?
Create a new sub-class of the View class
Create a new broadcast receiver
Create the activity layout
Add the activity to AndroidManifest.xml]
Q32. Which of the following statements are NOT needed to adding support for RecyclerView with CardView in your application? (Choose two)
dependencies { compile 'com.android.support:recyclerview-v7:24.2.1' }
dependencies { compile 'com.android.support:cardview-v7:24.2.1' }
dependencies { compile 'com.android.support.recyclerview:design:24.2.1' }
dependencies { compile 'com.android.support.recyclerview-v7:24.2.1' }
Q33. BROWSABLE belongs to which of the following tags
<url>
<data>
<category>
<action>
Q34. Which of the following is a valid attribute of ConstraintLayout?
layout_constraintEdge_toEdgeOf
layout_constraintMiddle_toMiddleOf
layout_constraintLeft_toRightOf
All answers are correct.
Q35.Consider the following code:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW); intent.setData(android.net.Uri.parse("http://www.androidatc.com")); startActivity(intent);
Which of the following is correct about the code above?
It sends a result to a new Activity in a Bundle.
It will not compile without adding the INTERNET permission the Manifest file
It starts any activity in the application that has a WebView in its layout
When it is executed, the system starts an intent resolution process to start the right Activity.
Q36.Which of the following Android View sub-classes uses the WebKit rendering engine to display web pages?
PageView
WebView
MapView
HttpClient
Q37.Which of the following lines of codes adds zoom controls to a WebView?
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setZoomControls(true);
webView.getZoomSettings().setControls(CONTROLS.enabled);
Zoom controls are included by default in WebViews
Q38.Which of the following best explains the Android option menus?
It is a popup menu that displays a list of items in a vertical list anchored to the view that invoked the menu
It is a floating menu that appears when the user performs a long-click on an element. It provides actions that affect the selected content or context frame.
It is the primary collection of menu items for an activity where you should place actions that have a global impact on the app, such as "Search," "Compose email," and "Settings”.
It is a type of List Activity with predefined headers and footers for special commands
Q39.Which of the following best explains the Android context menus?
It is a popup menu displays a list of items in a vertical list that's anchored to the view that invoked the menu.
It is a floating menu that appears when the user performs a long-click on an element. It provides actions that affect the selected content or context frame.
It is the primary collection of menu items for an activity. It's where you should place actions that have a global impact on the app, such as "Search," "Compose email," and "Settings".
It is a sub-menu of an options menu item
Q40.Which of the following applies a context menu on a ListView? (Choose two)
ListView lv = getListView(); lv.registerForContextMenu()
ListView lv= getListView(); registerForContextMenu(lv);
ListView lv = (ListView) findViewById(R.id.list_view_id); registerForContextMenu(lv)
getListView().setConextMenuEnabled(true)
Q41.Consider the following code :
Which of the following best explains the code above?
The code inflates an xml file into menu items.
The code creates menu items for context menu programmatically
The code assign actions to menu items.
The code Opens a menu resource file, modifies it, and saves the changes
Q42.Which Which of the following does NOT correctly describe interface android.widget.Adapter?
It is an object that acts as a bridge between a View and underlying data for that view
It provides access to the data items
It provides access to deprecated ListView methods.
It is responsible for making a View for each item in the data set
Q43.When is the intent resolution process triggered?
When the system receives an implicit intent to start an activity
When an explicit intent starts a service
When the system receives an explicit intent to start an activity
When the application calls method startAcitivyIntentResolution
Q44.Which of the following applies to the onDraw() method of class View? (Choose two)
It must be overridden if a customized drawing of a view is required
It takes two parameters: a Canvas and a View
It takes one parameter of type Canvas
It uses the Canvas parameter to draw the border of the activity that contains it
Q45. GPS provider requires a physical device and cannot be tested on an Emulator.
True
False
Q46.What is the location of the APK generated by the build system of Android Studio?
app/build/apk
app/apks
app/build/outputs/apk
app/intermediates/outputs/apk
Q47.Which of the following statements is NOT correct about Android fragments?
Multiple fragments can be combined in a single activity
The life-cycle of a fragment is totally independent of the activity hosting it
Fragments have their own life-cycle
You can add/remove fragments to and an activity dynamically; i.e. while the activity is running
Q48.Which of the following statements is incorrect about Android Device Monitor in Android Studio?
You can display a list of currently running threads and select one to check its stack trace
It can add dynamically Google SDK libraries to the Android image running on the emulator
You can forcibly execute garbage collection and check the present heap usage status
You can do simulations of network zone speed and bandwidth limitations
Q49.Which of the following is incorrect about intents?
They can be used to start an Activity
They can be used to start a service
They can be used to start database insertion
They can be used to start a dialog-themed activity
Q50.Method onDraw() of class android.view.View has the following signature:
public void onDraw(Color)
public void onDraw(Canvas)
public boolean onDraw(Canvas)
public Canvas onDraw( )
Q51. Which of the following Classes is responsible for capturing the location using GPS?
GPSLocationManager
GPSManager
LocationManager
GPS Provider
Q52.To create a blank Wear activity in Android Studio, the project should have a minimum SDK version >= 20.
True
False
Q53.To create a customized Adapter for a compound list item layout , you should:
Extend class android.widget.Adapter or any of its descendants then override method getView( )
Extend class android.widget.ListView or any of its descendants, then override method getView( )
Extend class android.widget.AbsAdapter or any of its descendants, then override method getView( )
Extend class android.widget.Adapter or any of its descendants, then override method getAdapterView( )
Q54.When publishing an update to your application to the market, the following must be taken into consideration:
The package name must be the same, but the .apk may be signed with a different private key
The package name does not have to be the same and the .apk can be signed with a different private key
The package name must be the same and the .apk must be signed with the same private key
The package name does not have to be the same, but the .apk must be signed with the same private key
Q55.Which of these is the incorrect method for an Application to save local data?
Extend PreferencesActivity and save in an XML file
Save as a file in the local file system
Save in the database using SQLite
Save in the hash table file using the Dictionary class
Q56.Which of the following lines of code is used to pass a value to the next activity?
Intent i = new Intent(this,newActivity); i.addExtra(“test”); startActivity(i);
Intent i = new Intent(this,newActivity); i.putValue(“test”); startActivity(i);
. Intent i = new Intent(this,newActivity); i.putValue(“value1”,“test”); startActivity(i);
Intent i = new Intent(this,newActivity); i.putExtra(“value1”,“test”); startActivity(i);
Q57. Which of the following permissions is not required to integrate Google Maps into your Android application?
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.READ_EXTERNAL_STORAGE
android.permission.ACCESS_FINE_LOCATION
All answers are correct.
Q58.Which of the following lines of code sets the entire Activity window as a WebView?
WebView webview = new WebView(this); webview.setAsWindow;
setContentView(R.layout.webview);
WebView webview = new WebView(this); setContentView(webview);
setContentView(“http://www.androidatc.com”);
Q59. Which of the following functions does not belong to LocationListner?
onLocationChanged
onStatusChanged
onLocationCaptured
onProviderDisabled
Q60.Consider the following the code :
Which of the following is true about the code above?
The code is auto generated and should not be edited
This method handles clicks and assign actions to menu items
This function inflates an XML file in the res/menu folder into menu items.
This method inflates an XML file in the res/layout folder into layout.
Q61.Which of the following is a rule that developers must always follow when writing multi-threaded Android applications? (Choose two)
A worker thread must not be created from inside the UI thread.
Each UI thread must not create more than one worker thread
The UI thread must never be blocked
The Android UI must not be accessed from outside the UI thread
Q62. Which of the following is the correct syntax for locating a Google Maps Camera?
Q63.Which of the following is NOT true about class AsyncTask?
It must be used by sub-classing it
It must be created on the UI thread.
Its sub-class override at least two methods: doInBackground, onPostExecute
It uses three generic types
Q64.When the user clicks on an action item in the action bar, which of the following Activity methods does the system call?
onOptionsItemSelected()
onOptionsItemClicked()
onActionButtonSelected()
onActionBarItemSelected()
Q65.Gradle is the build system used in Android Studio. It builds, tests, runs, and packages your apps
True
False
Q66.Which of the following is NOT correct about the Gradle build system of Android Studio?
The Gradle build file is called build.gradle
Gradle supports generating only one build variant
Gradle uses the Groovy syntax to configure the build
. A build is configured by using elements provided by the Android plugin for Gradle
Q67.To use the material design features of Android 5.0, you should set the android:targetSdkVersion attribute to 20 in your application’s build.gradle file.
True
False
Q68.Which UI does the following code builds?
An edit text to the left of a text view and a button beneath it
An edit text to the right of a text view and a button to the right of the text view
An edit text to the right of a text view and a button beneath them
A text view, an edit text beneath it and the button beneath the edit text
Q69. Assume that a XML layout has 2 views ViewA (with viewA as android:id) and ViewB (with viewB as android:id). The id of the parent layout is parentId. What would the following code display?
ViewA will be on the top-left corner of the screen and to the right of ViewA will be ViewB, both aligned next to each other
ViewB will be on the top-right corner of the screen. ViewA will be on top of ViewB, such that bottom edge of ViewA is touching the top edge of ViewB
ViewA is in the center of the screen and ViewB is on the left of ViewA such that right edge of ViewB is touching the left edge of ViewA
ViewB is in the center of the screen. ViewA is on the right of ViewB, both aligned on the same axis
Q70. Which of the following methods invoke a Snackbar?
Make( )
View( );
Show( );
Create( );
Q71. Which tag can we use to define an action for a broadcast receiver?
<receiver android:name:””> </receiver>
<intent-filter> </intent-filter>
<activity> </activity>
<task> </task>
Q72. Which ORMLite library annotation would you use to mark a class Xyz to be persisted in SQL database?
@DatabaseClass
@DatabaseTable(tableName = "xyz")
@DataTable(tableName = "xyz")
@PersistenceTable(name = "xyz")
Q73. Which of the following methods can we call in Notification.Builder to add an action?
setContentAction( )
setRemoteAction( )
setAction( )
addAction( )
Q74. Which of the following are constants for Location providers?
LocationManager.GPS_PROVIDER and LocationManager.NETWORK_PROVIDER.
LocationManager.GPS_PROVIDER and LocationManager.GMS_PROVIDER
LocationManager.GMS_PROVIDER and LocationManager.GPS_PROVIDER.
LocationManager.GPS_PROVIDER and LocationManager.GCM_PROVIDER.
