ex2 android
A/an ________________ widget lets the user enter text.
EditText
The ________________ event of a check box or radio button occurs when a check box or radio button is checked or unchecked.
CheckChange
Given this image: res/drawable-mdpi/jack_of_spades.png Which ImageView attribute specifies the location of the image? a. android:src="@drawable/jack_of_spades.png" b. android:src="@drawable/jack_of_spades" c. android:src="@drawable-mdpi/jack_of_spades.png" d. android:src="@drawable-mdpi/jack_of_spades"
b
In a linear layout, the ________________ attribute determines how much space Android allocates to a widget. a. gravity c. orientation b. weight d. linear
b
In a linear layout, which attribute can you add to switch to horizontal orientation? a. android:weight="horizontal" b. android:orientation="horizontal" c. android:gravity="horizontal" d. android:layout="horizontal"
b
A task that runs in a separate thread in the background and does not need to be synchronized with other threads is called a/an ________________ task.
asynchronous
(Refer to code example 5-1) Given a text view named helloTextView, what does this code do if the check box named helloCheckBox is checked? a. It makes the text view visible. b. It hides the text view. c. It hides the text in the text view. d. It makes the text in the text view visible.
b
(Refer to code example 6-1) If you decided to wire this event handler to multiple check boxes, which switch statement could you add to this method to compare the ID of the check box that was changed with the IDs of the check boxes on the layout? a. switch (view.getId()) { ... } b. switch (widget.getId()) { ... } c. switch (isChecked) { ... } d. switch (checkedId) { ... } Code example 6-2 @Override public void onItemSelected(AdapterView<?> parent, View v, int position, long id) { month = 0; }
b
A type of thread that ends when the app ends is called a/an a. UI thread c. context thread b. daemon thread d. none of the above
b
A/an ________________ is a collection of properties that specify formatting for a widget. a. Theme c. property b. Style d. all of the above
b
A/an ________________ is a collection of styles that apply to an entire activity or app. a. style sheet c. property b. Theme d. none of the above
b
By default, if you specify an icon for an item, Android uses that icon in the ________________, but it uses text for that item in the ________________ . a. options menu, action bar c. popup menu, action bar b. action bar, options menu d. popup menu, options menu
b
For a seek bar, the ________________ method is executed as the user changes the value of the seek bar. a. onStartTrackingTouch c. onStopTrackingTouch b. onProgressChanged d. none of the above
b
To apply a color, you can a. use a hex value. b. use a name for a user-defined color. c. use a name for a built-in Android color. d. all of the above
b
To determine which widget an event occured on, you use the ________________ method of the View class. a. CheckChanged c. onClick b. getID d. all of the above
b
What directory is used to store the XML for a menu? a. res\layout b. res\menu c. res\values d. res\xml
b
Which method is executed when the user selects one of the items in the ListView widget? a. onCreateView c. OnDestroy b. onItemClick d. none of the above
b
Which of the following declares a class for an asynchronous thread? a. class GetItems extends AsyncTask {} b. class GetItems extends AsyncTask<String, Void, String> {} c. class GetItems extends Timer {} d. class GetItems extends Timer<String, Void, String> {}
b
Which of the following statements selects the second item in the spinner? a. monthsSpinner.select(1) b. monthsSpinner.setSelection(1) c. monthsSpinner.select(2) d. monthsSpinner.setSelection(2)
b
Within a class for an asynchronous thread, which of the following methods is executed on the asynchronous thread? a. onPreExecute() b. doInBackground(Params...) c. onProgressUpdate(Progress...) d. onPostExecute(Result)
b
Within an XML file that defines styles, a property of a style is specified by a/an ________________. a. style element c. application element b. item element d. theme element
b
You can group preferences by ________________ one or more Preference elements within a PreferenceCategory element. a. wiring c. fragmenting b. nesting d. burrowing
b
(Refer to code example 7-1) The style named PrimaryButton inherits... a. the Button style b. the TextView style c. the Button style and the TextView style d. no styles
c
What directory is used to store the XML for a preferences screen? a. res\layout b. res\menu c. res\values d. res\xml
d
What type of content can a WebView widget display? a. Only XML b. Only HTML and CSS c. Only HTML, CSS, and JavaScript d. Any type of content that a web browser can display
d
Which of the following directories should you use to store a layout that's designed for landscape orientation? a. src/layout b. src/layout-land c. res/layout d. res/layout-land Code example 5-1 if (helloCheckBox.isChecked()) { helloTextView.setVisibility(View.GONE); } else { helloTextView.setVisibility(View.VISIBLE); }
d
A ________________ layout displays a column or row of child widgets.
linear
An interface that defines the listener for a/an ________________ event is typically nested within the adroid.view.View class. These listerners can be wired to any type of widget.
low-level
The action bar can include ________________ .
menu items
It's common to code the class for an asynchronous thread as a/an ________________ class of the activity.
nested inner
For a spinner, the ________________ method is executed when the spinner is first displayed and whenever a new item is selected.
onItemSelected
For a spinner, the ________________ method is only executed when the selection disappears.
onNothingSelected
A/an ________________ displays a visual indicator of the progress of an operation.
progress bar
A/an ________________ lets the user specify a value by dragging a/an ________________ to the right or left.
seek,bar, thumb
A/an ________________ is a collection of styles that can be applied througout an application.
style sheet
If necessary, you can use multiple ________________ files to set appropriate themes for the different API levels.
styles.xml
A ________________ layout displays widgets in rows and columns.
table
Holo, Material, and Holo.Light.DarkActionBar are all names of ________________ .
themes
A/an ________________ is a single sequential flow of control within a program that often completes a specific task.
thread
You can open the ________________ file and edit it to apply a theme to the entire application or to a specific activity.
AndroidManifest.xml
You can use ________________ code to dynamically show or hide widgets.
Java
Android provides ________________ that allow you to build an interface that's consistent with the user experience in other Android apps.
Preference APIs
A/an ________________ feed can be used to publish frequently updated works, such as blog entries and news headlines.
RichSiteSummary
To parse XML files, you can use ________________ .
SAX
To display data in a ListView widget, you can use the ________________ class.
SimpleAdapter
By default, an Android app uses a single thread, called the ________________, to display the user interface. Any task that can slow or stop the responsiveness of this should be run in a separate thread.
UI thread
The ________________ class is the superclass for all widgets.
View
A/an ________________ widget uses a built-in browser to display web content.
WebView
(Refer to code example 6-1) Assuming this method is wired to a CheckBox widget, what happens when the user checks that box? a. The deleteOldMessages variable is set to true. b. The deleteOldMessages variable is set to false c. The deleteOldMessages variable is not changed. d. A runtime exception is thrown.
a
A ScrollView widget displays a/an ________________ scroll bar. a. vertical c. both a and b b. horizontal d. none of the above
a
A/an ________________ allows the user to select an item from a list of items. a. spinner c. both a and b b. check box d. none of the above
a
Assume the prefs object is a SharedPreferences object. What does the following statement do? deleteOldMessages = prefs.getBoolean("delete_old_messages", true); a. It returns the Boolean value that's saved for a preference with a key of "delete_old_messages". b. It returns the Boolean value that's saved for a preference with a title of "delete_old_messages". c. It returns the default value for the preference with a key of "delete_old_messages". d. It returns the default value for the preference with a title of "delete_old_messages".
a
Given a TextView widget named secondsTextView and a Runnable object named updateSeconds, which statement updates the widget on the UI thread? a. secondsTextView.post(updateSeconds); b. secondsTextView.run(updateSeconds); c. updateSeconds.post(secondsTextView); d. updateSeconds.run(secondsTextView);
a
One of the simplest and most efficient types of layouts, which often displays only a single widget is a ________________ layout. a. frame c. linear b. table d. relative
a
The AsyncTask class provides for these generic types: a. Params, Progress, Result b. Async, Task c. TimerTask, URL, String d. URL, Context
a
The ________________ file uses its application element to specify the theme for the application. a. AndroidManifest.xml c. styles.xml b. colors.xml d. none of the above
a
What does the following statement do? startActivity(new Intent(getApplicationContext(), SettingsActivity.class)); a. It starts the activity that's defined by the class named SettingsActivity. b. It starts the activity that's defined by the class named Intent. c. It creates a menu item for the class named SettingsActivity. d. This statement won't compile because it uses the wrong number of parameters.
a
When a user presses a hardware button on a device, a/an ________________ event occurs. a. Key c. Press b. systemService d. all of the above
a
Which of the following attributes sets the style for the widget to the Spinner style? a. style="@style/Spinner" b. style="@android:style/Spinner" c. android:style="@style/Spinner" d. android:style="Spinner" Code example 7-1 <style name="TextView"> <item name="android:textSize">20sp</item> </style> <style name="Button" parent="@style/TextView"> <item name="android:textStyle">bold</item> </style> <style name="PrimaryButton" parent="@style/Button"> <item name="android:textColor">@color/primary</item> </style>
a
Which of the following gets the current value of the seek bar? a. int volume = volumeSeekBar.getProgress(); b. int volume = volumeSeekBar.progress; c. int volume = volumeSeekBar.getValue(); d. int volume = volumeSeekBar.value;
a
You can create an instance variable that creates an object from a class that implements the listener interface. Since this class doesn't have a name, it's known as a/an ________________ class.
anonymous
You can create an instance of a listener interface without assigning it to an instance variable. This is known as a/an ________________ class.
anonymous ineer
A/an ________________ adapter can provide the list that a spinner should display.
array
(Refer to code example 7-1) Within the res/values/colors.xml file for the project, which of the following elements defines the color for the text of the PrimaryButton style? a. <item name="textColor">#141315</item> b. <color style="PrimaryButton">@android:blue</color> c. <color name="primary">#141315</color> d. <color name="primaryColor">@android:blue</color>
c
An activity can include a/an ________________ that includes one or more ________________ . a. menu item, options menus c. options menu, menu items b. popup menu, options menus d. options menu, popup menus
c
How do you code the opening tag for a style named Label that inherits a style named TextView. a. <style name="Label" parent="@style/TextView"> b. <style name="TextView.Label"> c. Either a or b. d. None of the above.
c
In a table layout, which attribute can you add to have a widget span two columns? a. android:span="2" b. android:widget_span="2" c. android:layout_span="2" d. android:col_span="2"
c
To create a thread that executes tasks after a specified delay or at a specified interval, use the ________________ class. a. Timer c. both a and b b. TimerTask d. none of the above
c
To define names for colors, you typically add a/an ________________ file to the res/values directory. a. styles.xml c. colors.xml b. AndroidManifest.xml d. all of the above
c
When a user touches a widget on a touchscreen device, a/an ________________ event occurs on the widget. a. View c. Touch b. Motion d. all of the above
c
Which XML element do you use to code a preference that uses a check box? a. PreferenceCheckBox b. SettingCheckBox c. CheckBoxPreference d. CheckBoxSetting
c
Which method do you typically override to handle the event that occurs when a user selects an item from the options menu? a. onCreateOptionsMenu b. onPrepareOptionsMenu c. onOptionsItemSelected d. onOptionsItemClick
c
Within a <style> element, which of the following elements would set the text size of the style to 15sp? a. <item textSize="15sp"> b. <item name="textSize">15sp</item> c. <item name="android:textSize">15sp</item> d. <property name="textSize">15sp</property>
c
You can ________________ one layout within another, but it can degrade performance. a. post c. nest b. list d. bury
c
You can use Java and Android APIs to download a file by reading input from the ________________ and writing output to the ________________ . a. UI thread, file system c. Internet, file system b. file system, Internet d. daemon thread, file system
c
The built-in style called TextAppearance.Small.Inverse displays a small font size and inverse ________________.
color scheme
(Refer to code example 6-2) Assume that this method is wired to a Spinner widget that displays the 12 months in order (January, February, March, etc.). How can you change the statement in this method so that the month variable stores a value of 1 for January, 2 for February, 3 for March, etc.? a. month = parent.getPosition(); b. month = parent.getPosition() + 1; c. month = position; d. month = position + 1;
d
1. If a device doesn't have a physical Menu button, a/an ________________ is displayed on the right side of the action bar to display the options menu. a. options menu c. floating context menu b. popup menu d. action overflow icon
d
A/an ________________ intent specifies the action you want to perform, and can be used to view a URL in a web browser or to call a phone number. a. explicit c. daemon b. complacent d. implicit
d
A/an ________________ lets the user select one option from several options. a. editable text view c. text view b. check box d. radio button
d
Android supports ________________ images. a. PNG c. GIF b. JPG d. all of the above
d
For an asynchronous task, within the inner class, you can access the context for the activity by coding a. the name of the outer class b. a period c. the this keyword d. the name of the outer class, a period, and the this keyword
d
Given a Timer object named timer and a TimerTask object named task, which of the following statements runs the task immediately and again every minute? a. timer.run(task, 60000); b. timer.run(task, 0, 60000); c. timer.schedule(task, 60000); d. timer.schedule(task, 0, 60000);
d
The KeyEvent class contains constants for almost every possible hardware key on a device including the keys on a a. key card c. ten key b. key ring d. DPad
d
To handle an event, you can a. use the current class as the listener b. use an anonymous inner class as the listener c. use a named class as the listener d. all of the above
d
What attributes do you use to set the names and values of the items on an XML element for a list box preference? a. The names attribute and the values attribute b. The itemNames attribute and the itemValues attribute c. The items attribute and the itemValues attribute d. The entries attribute and the entryValues attribute
d
Which of the following is a disadvantage of using a fragment to use the Preferences API to display preferences? a. This technique doesn't allow the fragment to be used by multiple activities b. This technique uses deprecated methods c. This technique only works prior to Android 3.0 (API 11) d. This technique only works with Android 3.0 (API 11) and later
d
Which of the following menu item attributes displays the icon for the menu item in the action bar only when there's enough room in the action bar to fit the icon? a. android:icon="ifRoom" b. android:icon="showAsAction" c. android:showAsAction="icon" d. android:showAsAction="ifRoom"
d
With Android 4.0 (API 14) and later, an activity can include a/an ________________ that displays the activity's title and, optionally, buttons that perform actions. a. properties bar c. title bar b. style bar d. action bar
d
Within a class for an asynchronous thread, which of the following methods is executed on the UI thread after the asynchronous thread has finished executing? a. onPreExecute() b. doInBackground(Params...) c. onProgressUpdate(Progress...) d. onPostExecute(Result)
d
You can enable or disable a preference by using its ________________ attribute to link the preference to a corresponding CheckBoxPreference element.
depedency
When a/an ________________ occurs on a widget, the appropriate method of the ________________ object is executed.
event, listener
A/an ________________ intent specifies a component such as an activity, and can be used to pass data from one activity to another.
explicit
The AsyncTask class uses _____________ to allow a class to operate on various types of objects.
generics
The ________________ attribute aligns a widget with the top, bottom, center, left, or right of its linear layout.
gravity
To specify a color, you can use ________________ values to specify an RGB value.
hex
An interface that defines a listener for a/an ________________ event is typically nested within the class that defines the widget. These listeners can only be wired to an appropriate widget
high-level
Within the onCreateOptionsMenu method, you typically use a MenuInflater object to ________________ the XML for the menu items into Java objects and store them in the Menu parameter.
inflate
A/an ________________ provides a description of an operation to be performed. This type of object can be used with the startActivity method to start activities
intent
A menu can contain one or more ________________ .
items