Exam4Training

Android AND-401 Android Application Development Online Training

Question #1

What method you should override to use Android menu system?

  • A . onCreateOptionsMenu()
  • B . onCreateMenu()
  • C . onMenuCreated()
  • D . onCreateContextMenu()

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

To specify the options menu for an activity, override onCreateOptionsMenu() (fragments provide their own onCreateOptionsMenu() callback).

References: http://developer.android.com/guide/topics/ui/menus.html

Question #2

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 . findViewById(int id)
  • C . retrieveResourceById(int id)
  • D . findViewById(String id)

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

The findViewById(int id) method looks for a child view with the given id.

References: http://developer.android.com/reference/android/view/View.html

Question #3

Which of the following is not an Android component (i.e. a point from which the system can enter your application)?

  • A . Service
  • B . Activity
  • C . Layout
  • D . Content Provider

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

Here are the four types of app components: Activities, Services, Content providers, and Broadcast receivers.

References: http://developer.android.com/guide/components/fundamentals.html

Question #4

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

  • A . onStop()
  • B . onStart()
  • C . onCreate()
  • D . onRestore()

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #5

Which configuration file holds the permission to use the internet?

  • A . Layout file
  • B . Property file
  • C . Java source file
  • D . Manifest file

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #6

What does the following line of code achieve?

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

  • A . Creates a hidden Intent
  • B . Creates an implicit Intent
  • C . Create an explicit Intent
  • D . Create an explicit Intent

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #7

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

  • A . Activate and Activity
  • B . Activate a Service
  • C . Activate a Broadcast receiver
  • D . Activate a SQLite DB Connection.

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #8

Which of the following is not a valid Android resource file name?

  • A . mylayout.xml
  • B . myLayout.xml
  • C . my_layout.xml
  • D . mylayout1.xml

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #9

Which of these is not defined as a process state?

  • A . Non-visible
  • B . Visible
  • C . Foreground
  • D . Background

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #10

What is the name of the folder that contains the R.java file?

  • A . src
  • B . res
  • C . bin
  • D . gen

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #11

What is a correct statement about an XML layout file?

  • A . A layout PNG image file
  • B . A file used to draw the content of an Activity
  • C . A file that contains all application permission information
  • D . A file that contains a single activity widget.

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #12

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

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #13

Which file specifies the minimum required Android SDK version your application supports?

  • A . main.xml
  • B . R.java
  • C . strings.xml
  • D . AndroidManifest.xml

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #14

What is the parent class of all Activity widgets?

  • A . ViewGroup
  • B . Layout
  • C . View
  • D . Widget

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #15

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

  • A . Extra
  • B . Parcelable
  • C . Bundle
  • D . DataStore

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #16

Which is not included in the Android application framework?

  • A . WindowManager
  • B . NotificationManager
  • C . DialerManager
  • D . PackageManager

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #17

What Eclipse plugin is required to develop Android application?

  • A . J2EE
  • B . Android Software Development Kit
  • C . Android Development Tools
  • D . Web Development Tools

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #18

A developer can create a custom view by extending class Activity.

  • A . True
  • B . False

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #19

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

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #20

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

  • A . Java Activity classes
  • B . Resource files
  • C . Java source code
  • D . Libraries

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #21

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 a sub-activity
  • B . Starts a service
  • C . Sends results to another activity.
  • D . Starts an activity using an implicit intent.

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #22

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

  • A . Detector
  • B . OnTapListener
  • C . OnClickDetector
  • D . OnClickListener

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #23

Which of the following is not an Activity lifecycle call-back method?

  • A . onStart
  • B . onCreate
  • C . onPause
  • D . onBackPressed

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #24

Which method is used to close an activity?

  • A . Destroy()
  • B . Finish()
  • C . Stop()
  • D . Close()

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #25

Which of the following Activity life-cycle methods is called once the activity is no longer visible?

  • A . onStop
  • B . onPause
  • C . onDestroy
  • D . onHide

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #26

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”/>

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #27

Which of the following is true about attribute android:windowSoftInputMode of the <activity> tag in file AndroidManifest.xml?

  • A . It specifies whether the window is in full screen or not
  • B . It adjusts how the main window of the activity interacts with keyboard
  • C . It adjusts how the window should be launched
  • D . It adjusts the window orientation

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #28

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

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

References: Android ATC Self Study Guide http://www.androidatc.com/pages-19/Self-Study

Question #29

Javascript is enabled by default in a WebView

  • A . True
  • B . False

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

If the web page you plan to load in your WebView use JavaScript, you must enable JavaScript for your WebView.

References: http://developer.android.com/guide/webapps/webview.html

Question #30

How to enable JavaScript in WebView?

  • A . myWebView. setJavaScriptEnabled(true);
  • B . myWebView.getJavaScriptSettings.setEnabled(true)
  • C . myWebView.getSettings().setJavaScriptEnabled(true);
  • D . Java script is always enabled in WebView

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

JavaScript is disabled in a WebView by default. You can enable it through the WebSettings attached to your WebView. You can retrieve WebSettings with getSettings(), then enable JavaScript with setJavaScriptEnabled().

For example:

WebView myWebView = (WebView) findViewById(R.id.webview);

WebSettings webSettings = myWebView.getSettings();

webSettings.setJavaScriptEnabled(true);

References:

http://developer.android.com/guide/webapps/webview.html

Question #31

What two methods you have to override when implementing Android context menus?

  • A . onCreateOptionsMenu, onCreateContextMenu
  • B . onCreateContextMenu, onContextItemSelected
  • C . onCreateOptionsMenu, onOptionsItemSelected
  • D . onCreateOptionsMenu, onContextItemSelected

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

need to create context menu. For this need to override this method:

@Override

public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {

super.onCreateContextMenu(menu, v, menuInfo);

menu.setHeaderTitle("My Context Menu");

menu.add(0,

NEW_MENU_ITEM, 0, "new");

menu.add(0,

SAVE_MENU_ITEM, 1, "save");

}

And last one need to handle menu clicks:

@Override

public boolean onContextItemSelected(MenuItem item) {

switch

(item.getItemId()) {

case NEW_MENU_ITEM:

doSomething();

break;

case SAVE_MENU_ITEM:

doSomething();

break;

}

return

super.onContextItemSelected(item);

}

References:

https://thedevelopersinfo.wordpress.com/2009/11/06/using-context-menus-in-android/


Question #32

What two methods you have to override when implementing Android option menus?

  • A . onCreateOptionsMenu, onCreateContextMenu
  • B . onCreateContextMenu, onContextItemSelected
  • C . onCreateOptionsMenu, onOptionsItemSelected
  • D . onCreateOptionsMenu, onContextItemSelected

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

To specify the options menu for an activity, override onCreateOptionsMenu().

When the user selects an item from the options menu (including action items in the app bar), the system calls your activity’s onOptionsItemSelected() method. This method passes the MenuItem selected. You can identify the item by calling getItemId(), which returns the unique ID for the menu item (defined by the android:id attribute in the menu resource or with an integer given to the add() method). You can match this ID against known menu items to perform the appropriate action. For example:

@Override

public boolean onOptionsItemSelected(MenuItem item) {

Etc.

References:

http://developer.android.com/guide/topics/ui/menus.html

Question #33

Which of the following is a call-back method that inflates an options menu from file res/menu/menu.xml?

  • A . onOptionsItemSelected
  • B . onCreate
  • C . onCreateMenu
  • D . onCreateOptionsMenu

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

To specify the options menu for an activity, override onCreateOptionsMenu() (fragments provide their own onCreateOptionsMenu() callback). In this method, you can inflate your menu resource (defined in XML) into the Menu provided in the callback. For example:

@Override

public boolean onCreateOptionsMenu(Menu menu) {

MenuInflater inflater

= getMenuInflater();

inflater.inflate(R.menu.game_menu, menu);

return true;

}

References:

http://developer.android.com/guide/topics/ui/menus.html

Question #34

Which of the following Activity methods is invoked when the user clicks on an options menu item?

  • A . onItemClicked
  • B . onItemSelected
  • C . onOptionsItemClicked
  • D . onOptionsItemSelected

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

When the user selects an item from the options menu (including action items in the app bar), the system calls your activity’s onOptionsItemSelected() method.

References: http://developer.android.com/guide/topics/ui/menus.html

Question #35

Which of the following WebView methods allows you to manually load custom HTML markup?

  • A . loadData
  • B . loadHTML
  • C . loadCustomData
  • D . loadCustomHTML

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

To load the desired web page from an HTML string:

String summary =

"<html><body>You scored <b>192</b>

points.</body></html>";

webview.loadData(summary,

"text/html", null);

References:

http://developer.android.com/reference/android/webkit/WebView.html

Question #36

Which of the following is the base class of all UI components?

  • A . ListView
  • B . Layout
  • C . View
  • D . ViewGroup

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

View is the base class for android.widget subclasses, which instantiate fully-implemented UI objects.

References: http://eagle.phys.utk.edu/guidry/android/androidUserInterface.html

Question #37

Which of the following is true about object arrayAdapter declared in the code below?

String[] items = {“Item 1”,”Item 2”,”Item 3”};

ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,

android.R.layout.simple_list_item_1, items);

listView.setAdapter(arrayAdapter);

  • A . It creates a TextView for each String in array items.
  • B . It creates Buttons for each String in array items.
  • C . It creates four views for listView.
  • D . It replaces the layout of the activity with three consecutive TextView items.

Reveal Solution Hide Solution

Correct Answer: A
Question #38

Which of the following is NOT a correct constructer for ArrayAdapter?

  • A . ArrayAdapter(Context context)
  • B . ArrayAdapter (Context context, int recourse)
  • C . ArayAdpater (Context context , int resource, int textViewResourceId)
  • D . ArrayAdapter (Context context , int resource, List<T> items)

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Public ArrayAdapter Constructors include:

public ArrayAdapter (Context context, int resource)

public ArrayAdapter (Context context, int resource, int textViewResourceId)

public ArrayAdapter (Context context, int resource, List<T> objects)

References: http://developer.android.com/reference/android/widget/ArrayAdapter.html

Question #39

Which of the following add a click listener to items in a listView?

  • A . onClickListener.
  • B . onItemClickListener.
  • C . onItemClicked.
  • D . onListItemClickListener.

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

AdapterView.OnItemClickListener is an interface definition for a callback to be invoked when an item in this AdapterView has been clicked.

References: http://developer.android.com/reference/android/widget/AdapterView.OnItemClickListener.html

Question #40

Which of the following makes a ListView Clickable?

  • A . setClickable(true)
  • B . setVisibility(View.Visible)
  • C . setEnabled(true)
  • D . setItemsEnabled(true)

Reveal Solution Hide Solution

Correct Answer: C

Question #41

Which of the following classes is used by Intent to transfer data between different android components?

  • A . Extras
  • B . Bundle
  • C . Parcelables
  • D . PendingIntent

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

Bundle is generally used for passing data between various activities of android. It depends on you what type of values you want to pass, but bundle can hold all types of values, and pass to the new activity.

References: http://stackoverflow.com/questions/4999991/what-is-a-bundle-in-an-android-application

Question #42

Which of the following is true about implicit intents? (Choose two)

  • A . They do not have a component specified
  • B . They have components specified to run an exact class.
  • C . They must include information that allows Android system to choose the best component to run.
  • D . They must contain extra information saved in a Bundle object.

Reveal Solution Hide Solution

Correct Answer: AC
AC

Explanation:

Implicit intents do not name a specific component, but instead declare a general action to perform, which allows a component from another app to handle it.

References: http://developer.android.com/guide/components/intents-filters.html

Question #43

Which of the following classes should be extended to create a custom view?

  • A . View
  • B . ViewGroup
  • C . Context
  • D . Activity

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

All of the view classes defined in the Android framework extend View. Your custom view can also extend View directly, or you can save time by extending one of the existing view subclasses, such as Button.

References: http://developer.android.com/training/custom-views/create-view.html

Question #44

An AsyncTask can be cancelled anytime from any thread.

  • A . True
  • B . False

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

A task can be cancelled at any time by invoking cancel(boolean).

References: http://developer.android.com/reference/android/os/AsyncTask.html

Question #45

Which of the following is NOT true about onMeasure() method of class View?

  • A . It measures the view and its contents to determine the measured width and height.
  • B . It is invoked by measure().
  • C . When overriding this method, a developer must call setMeasuredDimension().
  • D . It takes three parameters: the height, width, and the depth of the view.

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

Syntax: protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)

onMeasure() measures the view and its content to determine the measured width and the measured height. This method is invoked by measure(int, int) and should be overridden by subclasses to provide accurate and efficient measurement of their contents.

References:

http://developer.android.com/reference/android/view/View.html#onMeasure(int, int)

Question #46

Which of the following Activity life-cycle methods is invoked when a dialog is shown?

  • A . onPause()
  • B . onCreate()
  • C . onStop()
  • D . onDestroy()

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

onPause() is where you deal with the user leaving your activity.

References: http://developer.android.com/reference/android/app/Activity.html

Question #47

Which of the following is NOT true about class DefaultHttpClient?

  • A . It supports HTTPS.
  • B . It supports streaming uploads and downloads.
  • C . It is only supported on Android versions 2.2 and older.
  • D . It is Andriod’s default implementation of an HTTP client.

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

Android 6.0 release removes support for the Apache HTTP client. If your app is using this client and targets Android 2.3 (API level 9) or higher, use the HttpURLConnection class instead.

References: http://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache­http-client

Question #48

Which of the following is NOT true about the SharedPreferences interface?

  • A . The data it saves is persistent even if application is killed.
  • B . It only saves primitive data in key-value pairs.
  • C . Modifications to preferences saved should go through class SharedPreferences.Editor
  • D . It can save any data type in key-value pairs.

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

SharedPreferences class is an interface for accessing and modifying preference data returned by getSharedPreferences(String, int). For any particular set of preferences, there is a single instance of this class that all clients share. Modifications to the preferences must go through an SharedPreferences.Editor object to ensure the preference values remain in a consistent state and control when they are committed to storage. Objects that are returned from the various get methods must be treated as immutable by the application.

References: http://developer.android.com/reference/android/content/SharedPreferences.html

Question #49

What does the following code do?

dialog.getWindow().setFlags(LayoutParams.FLAG_BLUR_BEHIND, LayoutParams.FLAG_BLUR_BEHIND);

  • A . When dialog is displayed the activity behind it will be blurred.
  • B . When dialog is displayed the activity behind it will be dimmed.
  • C . Any EditText behind the dialog will be disabled.
  • D . When the dialog is displayed, the edges of the dialog will be blurred.

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

public static final int FLAG_BLUR_BEHIND

Window flag: blur everything behind this window.

Note: Added in API level 1

This constant was deprecated in API level 14.

Blurring is no longer supported.

References:

http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html#FLAG_BLUR_BEHIND

Question #50

What does the following code achieve?

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

  • A . Starts a browser activity
  • B . Starts a sub-activity
  • C . Starts an activity service
  • D . Sends results to another activity.

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

startActivityForResult launches an activity for which you would like a result when it finished.

References: http://developer.android.com/reference/android/app/Activity.html

Question #51

When using an implicit intent, what process does the system use to know what to do with it?

  • A . Intent resolution
  • B . Intent declaration
  • C . Intent overloading
  • D . Intent transition

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

When using implicit intents, given such an arbitrary intent we need to know what to do with it. This is handled by the process of Intent resolution, which maps an Intent to an Activity, BroadcastReceiver, or Service (or sometimes two or more activities/receivers) that can handle it.

The intent resolution mechanism basically revolves around matching an Intent against all of the <intent­filter> descriptions in the installed application packages.

References: http://developer.android.com/reference/android/content/Intent.html

Question #52

Which of the following is NOT true about the MenuItem interface?

  • A . The MenuItem instance will be returned by the Menu class add(…) method.
  • B . MenuItem can decide the Intent issued when clicking menu components.
  • C . MenuItem can display either an icon or text.
  • D . MenuItem can set a checkbox.

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

Both an icon and text can be displayed.

The <item> element supports several attributes you can use to define an item’s appearance and behavior. The items in the above menu include the following attributes:

android:id

A resource ID that’s unique to the item, which allows the application to recognize the item when the user selects it.

android:icon

A reference to a drawable to use as the item’s icon.

android:title

A reference to a string to use as the item’s title.

Incorrect:

B: Adding Menu Items Based on an Intent

Sometimes you’ll want a menu item to launch an activity using an Intent (whether it’s an activity in your application or another application). When you know the intent you want to use and have a specific menu item that should initiate the intent, you can execute the intent with startActivity() during the appropriate on-item-selected callback method (such as the onOptionsItemSelected() callback).

However, if you are not certain that the user’s device contains an application that handles the intent, then adding a menu item that invokes it can result in a non-functioning menu item, because the intent might not resolve to an activity. To solve this, Android lets you dynamically add menu items to your menu when Android finds activities on the device that handle your intent.

References:

http://developer.android.com/guide/topics/ui/menus.html

Question #53

Which of the following is correct about XML layout files?

  • A . In order to display a UI defined in the XML layout file “main.xml”, call the setContentView method of the Activity with the parameter string “main.xml".
  • B . There is no distinction between implementation of the layout definition by code, or by XML layout file.
  • C . In an Eclipse project using the ADT plugin, the XML layout file is found in the /res/layout directory.
  • D . Layout information written in the XML layout file will be converted into code by the Android platform when the screen is displayed.

Reveal Solution Hide Solution

Correct Answer: C
Question #54

The DalvikVM core libraries are a subset of which of the following?

  • A . Java ME
  • B . Java SE
  • C . Java EE
  • D . JAX-WS

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

Dalvik is a discontinued process virtual machine (VM) in Google’s Android operating system that executes applications written for Android. Dalvik is compiled with JAVA SE.

References: https://en.wikipedia.org/wiki/Dalvik_(software)

Question #55

Which of the following is correct about file access in the Android system?

  • A . Generally, files are handled as dedicated resources per each application.
  • B . Files created by an application can be directly accessed by any application.
  • C . The content of file created by application cannot be accessed by any other application.
  • D . You can only access a file from within an Activity.

Reveal Solution Hide Solution

Correct Answer: A
Question #56

Which is the correct explanation of ListView?

  • A . It is necessary to use ListView as a set with ListActivity.
  • B . You cannot use a ListView when there is no information to be displayed.
  • C . When displaying a list of Strings using an ArrayAdapter class in ListView, you must save the value in an ArrayList.
  • D . ListView has a function to display a list of uniquely defined Views other than TextView.

Reveal Solution Hide Solution

Correct Answer: D
Question #57

Which of following is incorrect about the Toast class?

  • A . You cannot set a custom layout for a Toast.
  • B . A Toast can only be created by an Activity class C. There is no need to close or hide a Toast, since it closes automatically.
  • C . A Toast is displayed for only one of the following periods: Toast.LENGHT_SHORT or Toast.LENGTH_LONG

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

An Android Toast is a small message displayed on the screen, similar to a tool tip or other similar popup notification. A Toast is displayed on top of the main content of an activity, and only remains visible for a short time period.

References: http://tutorials.jenkov.com/android/toast.html

Question #58

Which of the following is not a ContentProvider provided natively by Android?

  • A . The contacts list
  • B . The telephone log
  • C . The bookmarks
  • D . The application list

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

Incorrect:

A: You usually need the MIME type when you are working with a provider that contains complex data structures or files. For example, the ContactsContract.Data table in the Contacts Provider uses MIME types to label the type of contact data stored in each row.

C: The Browser’s Bookmark and History content provider URI is in: android.provider.Browser.BOOKMARKS_URI

References: http://developer.android.com/guide/topics/providers/content-provider-basics.html http://jcla1.com/blog/using-content-providers-in-android/

Question #59

When creating a file using android.content.Context.openFileOutput("test.txt", 0), where is the file created?

  • A . /data/app/<package name>/files
  • B . /data/data/<package name>/files
  • C . /system/app/<package name>/files
  • D . /system/data/<package name>/files

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

The file is created in the /data/data/PACKAGE_NAME/files folder.

References: http://www.programcreek.com/java-api-examples/index.php? class=android.content.Context&method=openFileOutput

Question #60

Which of the following is incorrect about the LogCat tool?

  • A . LogCat UI tool is available inside Android Studio.
  • B . You can create a log in your application using Log.v(String, String)
  • C . Each log message has a tag
  • D . Only one of your applications can create log entries, and it should be component class (Activity,Service,…etc)

Reveal Solution Hide Solution

Correct Answer: D

Question #61

Which of the following information cannot not be included in the Manifest file?

  • A . The activities contained in the application
  • B . The permissions required by the application
  • C . The application’s minimum SDK version required.
  • D . The handset model compatible with your application.

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

Among other things, the manifest does the following:

– It describes the components of the application ― the activities, services, broadcast receivers, and content providers that the application is composed of.

– It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.

– It declares the minimum level of the Android API that the application requires.

References: http://developer.android.com/guide/topics/manifest/manifest-intro.html


Question #62

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

  • A . startActivity(Intent intent)
  • B . startActivityForResult(Intent intent , int requestCode)
  • C . startService(Intent intent)
  • D . startSubActivity(Intent intent)

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

startActivityForResult launches an activity for which you would like a result when it finished.

References: http://developer.android.com/reference/android/app/Activity.html

Question #63

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

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

The android.location package contains the framework API classes that define Android location-based (GPS) and related services.

References: http://developer.android.com/reference/android/location/package-summary.html

Question #64

Which of the following tools creates certificates for signing Android applications?

  • A . adb
  • B . logcat
  • C . keytool
  • D . certgen

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK.

To sign an app in release mode from the command line:

Question #64

Which of the following tools creates certificates for signing Android applications?

  • A . adb
  • B . logcat
  • C . keytool
  • D . certgen

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK.

To sign an app in release mode from the command line:

Question #64

Which of the following tools creates certificates for signing Android applications?

  • A . adb
  • B . logcat
  • C . keytool
  • D . certgen

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK.

To sign an app in release mode from the command line:

Question #64

Which of the following tools creates certificates for signing Android applications?

  • A . adb
  • B . logcat
  • C . keytool
  • D . certgen

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK.

To sign an app in release mode from the command line:

Question #68

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

  • A . READ_ADDRESS_DATA
  • B . READ_PHONE_STATE
  • C . READ_PHONE_CONTACTS
  • D . READ_CONTACTS

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

To do any type of search of the Contacts Provider, your app must have READ_CONTACTS permission. To request this, add this <uses-permission> element to your manifest file as a child element of <manifest>:

<uses-permission android:name="android.permission.READ_CONTACTS" />

References: http://developer.android.com/training/contacts-provider/retrieve-names.html

Question #69

You can create a custom view by extending class:

  • A . android.widget.View
  • B . android.widget.LinearLayout
  • C . android.view.View
  • D . android.content.Context

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

References: http://developer.android.com/reference/android/view/View.html

Question #70

In which Activity life-cycle method you should do all of your normal static set up such as: creating views and bind data to lists?

  • A . onResume()
  • B . onStart()
  • C . onCreate()
  • D . onPause()

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

onCreate(Bundle) is where you initialize your activity.

References: http://developer.android.com/reference/android/app/Activity.html

Question #71

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

Reveal Solution Hide Solution

Correct Answer: D
Question #72

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

  • A . onStop()
  • B . onPause()
  • C . onDestroy()
  • D . onExit()

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

onPause() is where you deal with the user leaving your activity.

References: http://developer.android.com/reference/android/app/Activity.html

Question #73

Which of the following attributes of the activity tag in the manifest file is used to set an activity screen to landscape orientation?

  • A . screenorientation = landscape
  • B . screenOrientation=”landscape”
  • C . android:ScreenOrientation=“landscape”
  • D . android:screenOrientation=”landscape”

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

Adding this to your manifest should force your app to landscape:

<!– Force Landscape–>

<activity

android:name=".ActivtyName"

android:screenOrientation="landscape">

</activity>

References:

http://answers.unity3d.com/questions/534216/how-force-the-app-to-landscape-in-android-with-a-m.html

Question #74

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 application components
  • D . It declares hardware and software features used within the application

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Among other things, the manifest does the following:

It declares which permissions the application must have in order to access protected parts of the API and interact with other applications.

It also declares the permissions that others are required to have in order to interact with the application’s components.

It describes the components of the application ― the activities, services, broadcast receivers, and content providers that the application is composed of.

It declares the minimum level of the Android API that the application requires.

References:

http://developer.android.com/guide/topics/manifest/manifest-intro.html

Question #75

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

  • A . Create a new sub-class of the View class.
  • B . Create a new broadcast receiver
  • C . Create the activity layout
  • D . Add the activity to the AndroidManifest.xml

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

The ActivityNotFoundException is thrown when a call to startActivity(Intent) or one of its variants fails because an Activity cannot be found to execute the given Intent.

References: http://developer.android.com/reference/android/content/ActivityNotFoundException.html

Question #76

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 sends a result to a new Activity in a Bundle.
  • B . It will not compile without adding the INTERNET permission the Manifest file.
  • C . It starts any activity in the application that has a WebView in its layout.
  • D . When it is executed, the system starts an intent resolution process to start the right Activity.

Reveal Solution Hide Solution

Correct Answer: D
Question #77

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

  • A . Declares an activity that implements part of the application’s visual user interface
  • B . Contained in <application> 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.

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

Incorrect:

A: An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View).

B, D: Example:

<application . . .>

<activity android:name="com.example.project.FreneticActivity"

android:permission="com.example.project.DEBIT_ACCT"

. . . >

. . .

</activity>

References:

http://developer.android.com/reference/android/app/Activity.html

Question #78

Which of these is NOT recommended in the Android Developer’s Guide as a method of creating an individual View?

  • A . Create by extending the android.view.View class.
  • B . Create by extending already existing View classes such as Button or TextView.
  • C . Create by copying the source of an already existing View class such as Button or TextView
  • D . Create by combining multiple Views.

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

Incorrect:

A, B: All of the view classes defined in the Android framework extend View. Your custom view can also extend View directly, or you can save time by extending one of the existing view subclasses, such as Button.

D: When building complex applications, you’ll often want to reuse the same group of views in various places of the application. One way to solve this problem is by creating a view that encapsulates the logic and layout of a group of views so you can reuse them without duplicating code in various places of the project.

References: http://developer.android.com/training/custom-views/create-view.html http://code.tutsplus.com/tutorials/creating-compound-views-on-android–cms-22889

Question #79

Which of these is the incorrect explanation of the Android SDK and AVD Manager?

  • A . They are provided from version 1.6 of the SDK. Up to Version 1.5, there was an AVD Manager but it lacked SDK management functions.
  • B . You can create and startup AVD, and on startup you can delete user data up to that point.
  • C . The "android" command can be used if "<SDK install folder>/tools" is added to the command path.
  • D . The development tools that can be downloaded from Android SDK and AVD Manager are SDK Android platform, NDK-platform, emulator images, and USB drivers for handsets.

Reveal Solution Hide Solution

Correct Answer: D
Question #80

Which of these is the correct explanation regarding the following methods?

(1)android.content.Context.sendBroadcast

(2)android.content.Context.startActivity

  • A . Both methods are defined by overloading.
  • B . Both methods throw an exception.
  • C . Both methods are asynchronous.
  • D . Both methods are able to broadcast an Intent.

Reveal Solution Hide Solution

Correct Answer: D

Question #81

Which of the following is incorrect about ProgressDialog?

  • A . ProgressDialog inherits from the AlertDialog class.
  • B . ProgressDialog can be set as 2 types of style: STYLE_HORIZONTAL and STYLE_SPINNER.
  • C . ProgressDialog is able to apply a custom XML-defined layout by using the setContentView(…) method.
  • D . ProgressDialog can be freely configured to use a Drawable class to display as its progress bar.

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

Incorrect:

A: ProgressDialog extends the AlertDialog class.

B: STYLE_HORIZONTAL creates a ProgressDialog with a horizontal progress bar. STYLE_SPINNERcreates a ProgressDialog with a circular, spinning progress bar.

References: http://developer.android.com/reference/android/app/ProgressDialog.html

Question #82

Which of these is the correct function of Traceview?

  • A . Displays a graphical task execution log.
  • B . Displays graphically a memory acquisition and release log
  • C . Displays graphically the call stack.
  • D . Displays graphically the Ul state hierarchy.

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

Traceview is a graphical viewer for execution logs saved by your application. Traceview can help you debug your application and profile its performance.

References: http://developer.android.com/tools/help/traceview.html

Question #83

Which of the following is the correct way to add access permission to your application?

  • A . Add a <uses-permission> tag as a child tag of the <manifest> tag in AndroidManifest.xml
  • B . Add a <add-permission> tag as a child tag of the <manifest> tag in AndroidManifest.xml.
  • C . Add a <uses-permission> tag as a child tag of the <application> tag in AndroidManifest.xml.
  • D . add a <permission> tag as a child tag of the <application> tag in AndroidManifest.xml

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

If an application needs access to a feature protected by a permission, it must declare that it requires that permission with a <uses-permission> element in the manifest. Then, when the application is installed on the device, the installer determines whether or not to grant the requested permission by checking the authorities that signed the application’s certificates and, in some cases, asking the user. If the permission is granted, the application is able to use the protected features. If not, its attempts to access those features will simply fail without any notification to the user.

References: http://developer.android.com/guide/topics/manifest/manifest-intro.html

Question #84

Which of the following statements is correct about SQLite?

  • A . It is an object database.
  • B . It is client-server format.
  • C . It is possible to create and access a database by using SQLOpenHelper.
  • D . It can be accessed by other applications through ContentProvider.

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

Content providers are one of the primary building blocks of Android applications, providing content to applications. They encapsulate data and provide it to applications through the single ContentResolver interface. A content provider is only required if you need to share data between multiple applications. For example, the contacts data is used by multiple applications and must be stored in a content provider. If you don’t need to share data amongst multiple applications you can use a database directly via SQLiteDatabase.

References: http://stackoverflow.com/questions/13542892/android-access-sqlite-database-via-content-provider-or­implement-dao

Question #85

When including a text file in your application to read from as a resource, what is the recommended location of such file?

  • A . res/anim
  • B . res/files
  • C . res/raw
  • D . res/values

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

You should place each type of resource in a specific subdirectory of your project’s res/ directory. The raw/ subfolder should contain arbitrary files to save in their raw form.

References: http://developer.android.com/guide/topics/resources/providing-resources.html

Question #86

Which of the following statements about DDMS is incorrect?

  • A . You can display a list of currently running threads and select one to check its stack trace.
  • B . You can use it to acquire screenshots of a terminal.
  • C . You can forcibly execute garbage collection and check the present heap usage status.
  • D . You can do simulations of network zone speed and bandwidth limitations.

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

Note: Android Studio includes a debugging tool called the Dalvik Debug Monitor Server (DDMS), which provides port-forwarding services, screen capture on the device, thread and heap information on the device, logcat, process, and radio state information, incoming call and SMS spoofing, location data spoofing, and more.

Incorrect:

A: LogCat is integrated into DDMS, and outputs the messages that you print out using the Log class along with other system messages such as stack traces when exceptions are thrown.

C: DDMS allows you to view how much heap memory a process is using. This information is useful in tracking heap usage at a certain point of time during the execution of your application.

To view heap usage for a process:

Question #86

Which of the following statements about DDMS is incorrect?

  • A . You can display a list of currently running threads and select one to check its stack trace.
  • B . You can use it to acquire screenshots of a terminal.
  • C . You can forcibly execute garbage collection and check the present heap usage status.
  • D . You can do simulations of network zone speed and bandwidth limitations.

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

Note: Android Studio includes a debugging tool called the Dalvik Debug Monitor Server (DDMS), which provides port-forwarding services, screen capture on the device, thread and heap information on the device, logcat, process, and radio state information, incoming call and SMS spoofing, location data spoofing, and more.

Incorrect:

A: LogCat is integrated into DDMS, and outputs the messages that you print out using the Log class along with other system messages such as stack traces when exceptions are thrown.

C: DDMS allows you to view how much heap memory a process is using. This information is useful in tracking heap usage at a certain point of time during the execution of your application.

To view heap usage for a process:

Question #86

Which of the following statements about DDMS is incorrect?

  • A . You can display a list of currently running threads and select one to check its stack trace.
  • B . You can use it to acquire screenshots of a terminal.
  • C . You can forcibly execute garbage collection and check the present heap usage status.
  • D . You can do simulations of network zone speed and bandwidth limitations.

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

Note: Android Studio includes a debugging tool called the Dalvik Debug Monitor Server (DDMS), which provides port-forwarding services, screen capture on the device, thread and heap information on the device, logcat, process, and radio state information, incoming call and SMS spoofing, location data spoofing, and more.

Incorrect:

A: LogCat is integrated into DDMS, and outputs the messages that you print out using the Log class along with other system messages such as stack traces when exceptions are thrown.

C: DDMS allows you to view how much heap memory a process is using. This information is useful in tracking heap usage at a certain point of time during the execution of your application.

To view heap usage for a process:

Question #86

Which of the following statements about DDMS is incorrect?

  • A . You can display a list of currently running threads and select one to check its stack trace.
  • B . You can use it to acquire screenshots of a terminal.
  • C . You can forcibly execute garbage collection and check the present heap usage status.
  • D . You can do simulations of network zone speed and bandwidth limitations.

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

Note: Android Studio includes a debugging tool called the Dalvik Debug Monitor Server (DDMS), which provides port-forwarding services, screen capture on the device, thread and heap information on the device, logcat, process, and radio state information, incoming call and SMS spoofing, location data spoofing, and more.

Incorrect:

A: LogCat is integrated into DDMS, and outputs the messages that you print out using the Log class along with other system messages such as stack traces when exceptions are thrown.

C: DDMS allows you to view how much heap memory a process is using. This information is useful in tracking heap usage at a certain point of time during the execution of your application.

To view heap usage for a process:

Question #90

Which of the following is incorrect about intents?

  • A . They can be used to start an Activity
  • B . They can be used to start a service
  • C . They can be used to start database insertion
  • D . They can be used to start a dialog-themed activity.

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

Incorrect:

A, B: An intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.

D: Example:

public static final String ACTION_BATTERY_LOW

Added in API level 1

Broadcast Action: Indicates low battery condition on the device. This broadcast corresponds to the "Low battery warning" system dialog.

References:

http://developer.android.com/reference/android/content/Intent.html

Question #91

Method onDraw() of class android.view.View has the following signature:

  • A . public void onDraw(Color)
  • B . public void onDraw(Canvas)
  • C . public boolean onDraw(Canvas)
  • D . public Canvas onDraw()

Reveal Solution Hide Solution

Correct Answer: B
B

Explanation:

The parameter to onDraw() is a Canvas object that the view can use to draw itself.

References: http://developer.android.com/training/custom-views/custom-drawing.html

Question #92

To add a new Activity to your application, you need to perform the following steps:

  • A . Create a Java class that extends View, set a layout, and add an Activity tag in AndroidManifest.xml
  • B . Create layout resource only.
  • C . Create a Java class that extends Activity, add an Activity tag in AndroidManifest.xml, and create a layout for the activity.
  • D . Add an Activity tag to AndroidManifest.xml, and add ACTIVITY permission.

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

References: http://www.itcsolutions.eu/2011/08/31/android-tutorial-how-to-create-a-new-activity-class-with-manifest­editor/

Question #93

To create a customized Adapter for a compound list item layout, you should:

  • A . Extend class android.widget.Adapter or any of its descendants then override method getView()
  • B . Extend class android.widget.ListView or any of its descendants, then override method getView()
  • C . Extend class android.widget.AbsAdapter or any of its descendants, then override method getView()
  • D . Extend class android.widget.Adapter or any of its descendants, then override method getAdapterView ().

Reveal Solution Hide Solution

Correct Answer: A
A

Explanation:

The android.widget.Adapter class included the method getView(), which gets a View that displays the data at the specified position in the data set.

References: http://developer.android.com/reference/android/widget/Adapter.html

Question #94

When publishing an update to your application to the market, the following must be taken into consideration:

  • A . The package name must be the same, but the .apk may be signed with a different private key.
  • B . The package name does not have to be the same and the .apk can be signed with a different private key.
  • C . The package name must be the same and the .apk must be signed with the same private key.
  • D . The package name does not have to be the same, but the .apk must be signed with the same private key.

Reveal Solution Hide Solution

Correct Answer: C
C

Explanation:

You should sign all of your apps with the same certificate throughout the expected lifespan of your applications.

App upgrade: When the system is installing an update to an app, it compares the certificate(s) in the new version with those in the existing version. The system allows the update if the certificates match. If you sign the new version with a different certificate, you must assign a different package name to the application ― in this case, the user installs the new version as a completely new application.

References: http://developer.android.com/tools/publishing/app-signing.html

Question #95

Which of these is the incorrect method for an Application to save local data?

  • A . Extend PreferencesActivity and save in an XML file.
  • B . Save as a file in the local file system.
  • C . Save in the database using SQLite.
  • D . Save in the hash table file using the Dictionary class.

Reveal Solution Hide Solution

Correct Answer: D
D

Explanation:

Incorrect:

B: You can save files directly on the device’s internal storage.

C: Android provides full support for SQLite databases. Any databases you create will be accessible by name to any class in the application, but not outside the application.

Reference: http://developer.android.com/guide/topics/data/data-storage.html

Question #96

Which UI does the following code builds?

<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android=http://

schemas.android.com/apk/res/android

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

>

<LinearLayout

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal" >

<TextView

android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Name:" />

<EditText

android:id="@+id/editText1"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_weight="1"

android:ems="10" />

</LinearLayout>

<Button

android:id="@+id/button1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="Post" />

</LinearLayout>

  • A . An edit text to the left of a text view and a button beneath it
  • B . An edit text to the right of a text view and a button to the right of the text view
  • C . An edit text to the right of a text view and a button beneath them
  • D . A text view, an edit text beneath it and the button beneath the edit text

Reveal Solution Hide Solution

Correct Answer: C
Question #97

Consider the following code:

Intent i = new Intent(this, MainActivity.class);

i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

startActivity(i);

What best explains the code above?

  • A . The activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity as a new Intent.
  • B . Any existing task that would be associated with the activity to be cleared before the activity is started.
  • C . A new Activity will be launched and it will be on the top of the stack
  • D . A new activity will be launched but will be in full-screen mode.

Reveal Solution Hide Solution

Correct Answer: A
Exit mobile version