wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Android Development Associate

Total questions: 40

Worksheet time: 1hrs 29mins

Name
Class
Date
1.

What Activity method you use to retrieve a reference to an Android view by using the id attribute of a resource XML?

a)

findViewByReference(int id)

b)

retrieveResourceById(int id)

c)

findViewById(int id)

d)

findViewById(String id)

2.

During an Activity life-cycle, what is the first callback method invoked by the system?

a)

onCreate()

b)

onStart()

c)

onStop()

d)

onRestore()

3.

What does the following line of code achieve?

Intent intent = new Intent(FirstActivity.this, SecondActivity.class );

a)

Starts an activity

b)

Creates an implicit Intent.

c)

Creates a hidden Intent.

d)

Create an explicit Intent.

4.

Which of the following is NOT a valid usage for Intents?

a)

Activate a SQLite DB Connection.

b)

Activate a Broadcast receiver.

c)

Activate a Service.

d)

Activate and Activity.

5.

What is the parent class of all Activity widgets?

a)

Layout

b)

ViewGroup

c)

View

d)

Widget

6.

What is the name of the class used by Intent to store additional information?

a)

Parcelable

b)

DataStore

c)

Extra

d)

Bundle

7.

You can create a custom view by extending class Activity.

a)

True

b)

False

8.

What does the Android project folder “res/” contain?

a)

Resource files

b)

Java Activity classes

c)

Java source code

d)

Libraries

9.

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

a)

Starts an activity using an implicit intent.

b)

Sends results to another activity

c)

Starts a sub-activity.

d)

Starts a service

10.

Which method should you use to start a sub-activity?

a)

startSubActivity(Intent intent)

b)

startService(Intent intent)

c)

startActivity(Intent intent)

d)

startActivityForResult(Intent intent)

11.

Which Android permission you should add to allow your application to read the device’s address book?

a)

READ_PHONE_STATE

b)

READ_ADDRESS_DATA

c)

READ_CONTACTS

d)

READ_PHONE_CONTACTS

12.

Which of the following methods is called in an Activity when another activity gets into the foreground?

a)

onDestroy()

b)

onStop()

c)

onPause()

d)

onExit()

13.

What is not true about the AndroidManifest.xml file?

a)

It declares the views used within the application.

b)

It declares user permissions the application requires.

c)

It declares hardware and software features used within the application.

d)

It declares application components.

14.

If your application is throwing exception android.content.ActivityNotFoundException, which of the following could resolve the problem?

a)

Add the activity to AndroidManifest.xml

b)

Create the activity layout

c)

Create a new sub-class of the View class

d)

Create a new broadcast receiver

15.

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?

a)

It will not compile without adding the INTERNET permission the Manifest file

b)

It starts any activity in the application that has a WebView in its layout

c)

When it is executed, the system starts an intent resolution process to start the right Activity.

d)

It sends a result to a new Activity in a Bundle

16.

Which of the following Android View sub-classes uses the WebKit rendering engine to display web pages?

a)

MapView

b)

PageView

c)

WebView

d)

HttpClient

17.

Which of the following is incorrect about intents?

a)

They can be used to start an Activity

b)

They can be used to start database insertion

c)

They can be used to start a service

d)

They can be used to start a dialog-themed activity

18.

To create a blank Wear activity in Android Studio, the project should have a minimum SDK version >= 20

a)

True

b)

False

19.

Which of the following lines of code is used to pass a value to the next activity?

a)

Intent i = new Intent(this,newActivity);

i.addExtra(“test”);

startActivity(i);

b)

Intent i = new Intent(this,newActivity);

i.putValue(“test”);

startActivity(i);

c)

Intent i = new Intent(this,newActivity);

i.putValue(“value1”,“test”);

startActivity(i);

d)

Intent i = new Intent(this,newActivity);

i.putExtra(“value1”,“test”);

startActivity(i);

20.

Gradle is the build system used in Android Studio. It builds, tests, runs, and packages your apps

a)

True

b)

False

21.

What method you should override to use Android menu system?

a)

onCreateOptionsMenu()

b)

onCreateMenu()

c)

onMenuCreated()

d)

onCreateContextMenu()

22.

Which of these files contains text values that you can use in your application?

a)

AndroidManifest.xml

b)

res/Text.xml

c)

res/layout/Main.xml

d)

res/values/strings.xml

23.

Which of the following is a Java call-back method invoked when a view is clicked?

a)

Detector

b)

OnTapListener

c)

OnClickDetector

d)

OnClickListener

24.

Which of the following tools dumps system log messages including stack traces when the device or emulator throws an error?

a)

DDMS

b)

Logcat

c)

Console

d)

ADB

25.

Which method should you use to start a sub-activity?

a)

startActivity(Intent intent)

b)

startActivityForResult(Intent intent)

c)

startService(Intent intent)

d)

startSubActivity(Intent intent)

26.

Which package of the following does not have classes needed for Android network connections?

a)

java.net

b)

org.apache.http

c)

android.location

d)

android.net

27.

What is the second layer from top called in the following diagram of Android’s Architecture?

a)

Applications layer

b)

Application framework

c)

Linux kernel

d)

Android runtime

28.

Which of the following is not true about tag in AndroidManifest file?

a)

Declares an activity that implements part of the application's visual user interface

b)

Contained in tag.

c)

Declares a single hardware or software feature that is used by the application.

d)

Has an attribute that specifies the name of the Activity sub-class that implements the activity.

29.

Which of the following AsyncTask methods is NOT executed on the UI thread?

a)

onPreExecute()

b)

onPostExecute()

c)

publishProgress()

d)

onProgressUpdate()

30.

Which of the following is a NOT valid form of notification invoked by the NotificationManager?

a)

A Flashing LED.

b)

A persistent icon in the status bar.

c)

A sound played.

d)

A SMS sent.

31.

What does the src folder contain?

a)

Image and icon files

b)

XML resource files

c)

The application manifest file

d)

Java source code files

32.

Which of the following is a correct Android Manifest

statement?

a)

<uses-permission android:name =”android.Internet”/>

b)

<uses-permission android:name =”android.Internet”></uses-permission>

c)

<uses-permission android:name =”android.permission.Internet”>

d)

<uses-permission android:name =”android. permission.Internet”/>

33.

Which of the following attributes is used to set an activity screen to

landscape orientation?

a)

screenorientation = landscape

b)

screenOrientation=”landscape”

c)

android:ScreenOrientation=“landscape”

d)

android:screenOrientation=”landscape”

34.

Which of the following best explains the Android option menus?

a)

It is a popup menu that displays a list of items in a vertical list anchored to the view that

invoked the menu.

b)

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.

c)

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."

d)

It is a type of List Activity with predefined headers and footers for special commands.

35.

Which of the following best explains the Android context menus?

a)

It is a popup menu displays a list of items in a vertical list that's anchored to the view

that invoked the menu.

b)

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.

c)

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."

d)

It is a sub-menu of an options menu item.

36.

@Override

public void onCreateContextMenu(ContextMenu menu, View v,

ContextMenuInfo menuInfo) {

super.onCreateContextMenu(menu, v, menuInfo);

menu.setHeaderTitle("Menu");

AdapterContextMenuInfo cmi = (AdapterContextMenuInfo) menuInfo;

menu.add(1, cmi.position, 0, "Open file");

menu.add(2, cmi.position, 0, "Save file");

}

a)

The code inflates an xml file into menu items

b)

The code creates menu items for context menu programmatically

c)

The code assign actions to menu items

d)

The code Opens a menu resource file, modifies it, and saves the changes.

37.

Which of the following is true about method startActivity?

a)

It starts a new activity and destroys the previous one

b)

It starts a new activity and sends the previous one to the background.

c)

It starts a new activity and pauses the previous one.

d)

It starts a new activity in a paused mode.

38.

Which of the following AsyncTask methods is NOT executed on the

UI thread?

a)

onPreExecute()

b)

onPostExecute()

c)

publishProgress()

d)

onProgressUpdate()

39.

Which of the following lines of code starts activity Activity2 from a

current activity Activity1?

a)

Intent intent = new Intent(this,new Activity2());

startActivity(intent);

b)

Intent intent = new Intent(new Activity2());

startActivity(intent);

c)

Intent intent = new Intent (Activity1.class,Activity2.class);

startActivity(intent);

d)

Intent intent = new Intent(this,Activity2.class);

startActivity(intent);

40.

Which of the following does NOT correctly describe interface

android.widget.Adapter?

a)

It is an object that acts as a bridge between a View and underlying data for that view.

b)

It provides access to the data items.

c)

It provides access to deprecated ListView methods.

d)

It is responsible for making a View for each item in the data set.