Type
Quiz
Book Title
Android How to Program 2nd Edition
ISBN 13
978-0133764031

CICS 93797

July 17, 2017
(True/False) A SoundPool can play only one sound stream at once.
(True/False) If Android cannot find an image in the appropriate drawable folder, it will
scale the version from another drawable folder up or down to different densities as
necessary.
(True/False) @android:id/list is the required Id for the ListView in a ListActivity's
custom layout.
(True/False) You should perform long-running operations or operations that block
execution until they complete (e.g., file and database access) in the GUI thread.
(True/False) Each activity lifecycle method you override may call the superclass's
version but is not required to do so.
(True/False) If you want to test your apps for multiple Android devices, you"ll need to
create a single AVD that emulates all of the devices, or use a service (like testdroid.com
or appthwack.com) that enables you to test on many different devices.
(True/False) By default, there are 8dp marginsspaces that separate viewsaround a
GridLayout's cells.
(True/False) The vast majority of apps on Google Play are paid apps.
(True/False) Unlike Apple's iOS, which is available only on Apple devices, Android is
available on devices from dozens of original equipment manufacturers (OEMs) and
through numerous telecommunications carriers worldwide.
(True/False) Android makes it easy for you to share various types of information from
an app via e-mail, instant messaging (SMS), Facebook, Google+, Twitter and more.
(True/False) Media files, such as the sounds, are placed in the app's resource folder
res/raw.
(True/False) A GestureDetector allows an app to react to user interactions such as flings,
single taps, double taps, long presses and scrolls by implementing the methods of
interfaces GestureDetector.OnGestureListener and
Gesture-Detector.On-Double-Tap-Listener interfaces.
(True/False) An AlertDialog that asks the user to register to gain access to additional
features might provide a Remind Me Later buttonsuch a button represents a positive
action.
(True/False) IOExceptions are unchecked exceptions.
(True/False) Java requires that you override every method in an interface that you
implement.
(True/False) File names for image resourcesand all the other resources must be in all
lowercase letters.
(True/False) When the first GUI component in the GUI is an EditText, Android gives
that component the focus when the app loads.
(True/False) When exceptions occur, you can log them for debugging purposes with
Android's built-in logging mechanism. Android provides class Log with several static
methods that represent messages of varying detail.
(True/False) When a String resource contains multiple format specifiers you must
number the format specifiers for localization purposes. A d in a format specifier formats
an integer; an f in one formats a floating-point number.
(True/False) You can configure a Fragment to be retained across configuration changes,
such as when the user rotates the device.
(True/False) In addition to directly programming portions of your apps, you can also
use the Eclipse and Android Studio IDEs to conveniently drag and drop predefined
objects such as buttons and textboxes into place on your screen, and label and resize
them.
(True/False) Store the image in the device's Gallery by calling class
MediaStore.Images.Media's insertImage method. Method insertImage returns a String
representing the image's location on the device, or null if the image could not be saved.
(True/False)You call CursorAdapter method changeCursor with the argument true to
remove the Cursor from the CursorAdapter.
Objects know how other objects that they communicate with are implemented.
(True/False) All of your app's resources in the res/values folder must be defined in
specific files based on the type of the resourcesfor example, array resources must be
defined in arrays.xml, colors in colors.xml, Strings in strings.xml and numeric values in
values.xml.
(True/False) The Android documentation recommends that games use the music audio
stream to play sounds.
(True/False) The system MotionEvent passed from onTouchEvent contains touch
information for multiple moves on the screen if they occur at the same time.
MotionEvent method getPointerCount returns the number of touches the
Motion-Event describes.
(True/False) Log static method e is used to log error messages.
(True/False) The Android design guidelines indicate that text displayed in your GUI
should be brief, simple and friendly with the important words last.
(True/False) You can restrict the user's input to integer digits, for example, so that the
user cannot enter invalid input.
(True/False) Android's documentation for supporting multiple screen sizes recommends
that you use scale-independent pixels for the dimensions of GUI components and other
screen elements, and density-independent pixels for font sizes.
(True/False) Fragments can be hosted by an Activity, or they can execute independently.
(True/False) AlertDialogs can display buttons, checkboxes, radio buttons and lists of
items that the user can touch to respond to the dialog's message.
(True/False) To communicate data between Fragments and a host Activity or the
Activity's other Fragments, it's considered best practice to do so through the root
Fragment.
(True/False) Unlike an app's drawable folders, which require their image contents to be
at the root level in each folder, the assets folder may contain files of any type and they
can be organized in subfolders.
(True/False) Each menu item's Order in category values determines the order in which
the menu items appear on the action bar.
(True/False) A view's layout Weight (in certain layouts, such as LinearLayout) specifies
the view's relative importance with respect to other views in the layout. By default, all
views have a Weight of 1.
To add a custom component to a layout's XML file, you must provide its class name.
(True/False) You can support both portrait and landscape orientations by designing the
GUI so that it can dynamically adjust GUI component sizes based on the current
orientation.
(True/False) You can build apps that display text and images without writing any code.
Which of the following statements is false?
a. Class Bundle of package android.os represents an app's state information.
b. Android gives an app the opportunity to save its state before another app appears on
the screen. This might occur, for example, when the user launches another app or
receives a phone call.
c. The app that's currently on the screen at a given time is in the foreground (the user
can interact with it, and the app consumes the CPU) and all other apps are in the
background (the user cannot interact with them, and they"re typically not consuming
the CPU).
d. When another app comes into the foreground, the app that was previously in the
foreground is given the opportunity to remain in the foreground.
GUI programming in Java is ________ drivenapps respond to various user-initiated
actions such as screen touches.
a. touch
b. action
c. event
d. object
Passing an Intent to the inherited Activity method startActivity starts an Activity that
can perform the specified action on the given data. If we"ve specified to view a URI,
the Intent launches the device's ________ to display the corresponding web page.
Which of the following statements is false?
a. If you externalize color values, all components that use the same color can be
updated to a new color simply by changing the color value in a central resource file.
b. If you wish to localize your app in several languages, storing the strings in the app's
Java source code allows you to change them easily.
c. In your project's res folder, the subfolder values contains a strings.xml file that's used
to store the app's default language strings.
d. To provide localized strings for other languages, you can create separate values
folders for each language.
Which of the following statements is false?
a. Cursor method moveToFirst can be used to move the Cursor to the first row in the
result set.
b. It's considered good practice to ensure that Cursor method moveToFirst returns true
before attempting to get data from the Cursor.
c. Class Cursor provides method getColumnIndexOrThrow if you prefer to get an
exception when the specified column name does not exist.
d. Android automatically releases resources like database connections when they are not
being used so that other activities can use the resources.
Which of the following is not a characteristic of great apps?
a. Innovating with augmented reality technologyenhancing a real-world environment
with virtual components; this is particularly popular with video-based apps.
b. Using location-based services to provide local services (e.g., coupons for local
businesses, best gas prices, food delivery).
c. Innovating with augmented reality technologyenhancing a real-world environment
with virtual components; this is particularly popular with video-based apps.
d. Running input/output and compute-intensive code on the same thread of execution to
improve interface responsiveness and app performance.
Which of the following statements is false?
a. You can declare each Fragment in an Activity's layout or, for a DialogFragment, call
its show method to create it.
b. An app can use multiple activities to host an app's Fragments on a phone device.
c. You can use only one Activity to host all of an app's Fragments.
d. On a phone-sized device, you"ll typically display several Fragments at a time.
Which of the following statements about resources and the resources subfolder is false?
a. Folder names that begin with drawable typically contain images. These folders may
also contain XML files representing shapes and other types of drawables.
b. Folder names that begin with layout contain XML files that describe GUIs, such as
the activity_main.xml file.
c. Folder names that begin with values contain XML files that specify values for arrays
(arrays.xml), colors (colors.xml), dimensions (dimen.xml; values such as widths,
heights and font sizes), strings (strings.xml) and styles (styles.xml). These file names
are required.
d. It's considered best practice to define the data from hard-coded arrays, colors, sizes,
strings and styles as resources so they can be modified easily without changing the
app's Java code.
Which of the following statements is false?
a. There are several predefined colors (each starts with @android:color) in Android's
Holo theme. You can also use any custom color created from a combination of red,
green and blue components called RGB valueseach is an integer in the range 0"255 that
defines the amount of red, green and blue in the color, respectively.
b. Custom colors are defined in hexadecimal (base 16) format, so the RGB components
are values in the range 00"FF.
c. Android also supports alpha (transparency) values in the range 0 (completely opaque)
to 255 (completely transparent).
d. To use alpha, you specify the color in the format #AARRGGBB, where the first two
hexadecimal digits represent the alpha value. If both digits of each color component are
the same, you can use the abbreviated formats #RGB or #ARGB. For example, #9AC is
treated as #99AACC and #F9AC is treated as #FF99AACC.
(True/False) You use the method getSharedPreferences (inherited from class Context) to
get a SharedPreferences object that can read existing tag"query pairs from an app's
shared preferences. The first argument indicates the name of the file that contains the
data. The second argument is a constant that specifies the accessibility of the filethese
constants can be combined with the bitwise AND operator.
Which of the following statements is false?
a. An animation set is a collection of animations that make up a larger animation.
b. Property animation types include alpha (transparency), scale (resize), translate
(move) and rotate.
c. A translate animation moves a View within its parent.
d. Property animations can animate any property of any object.
Which of the following are included in the Eclipse IDE?
a. Auto-indenting and auto-complete
b. Version control system
c. Refactoring support
d. (a) and (b) only.
e. (a), (b) and (c).
Which of the following statements is false?
a. Defining your GUIs with density-independent pixels enables the Android platform to
scale the GUI, based on the pixel density of a given device's screen.
b. One density-independent pixel is equivalent to one pixel on a 160-dpi screen. On a
240-dpi screen, each density-independent pixel will be scaled by a factor of 160/240
(i.e., 0.67). So, a component that's 100 density-independent pixels wide will be scaled
to 67 actual pixels wide.
c. On a screen with 120 dpi, each density-independent pixel is scaled by a factor of
120/160 (i.e., 0.75). So, the same component that's 100 density-independent pixels wide
will be 75 actual pixels wide.
d. Scale-independent pixels are scaled like density-independent pixels, and they"re also
scaled by the user's preferred font size (as specified in the device's settings).
Throughout its life, an Activity can be in one of several statesactive (i.e., running),
paused or stopped. The Activity transitions between these states in response to various
events. Which of the following statements is false?
a. An active Activity is visible on the screen and "has the focus"that is, it's in the
foreground. This is the Activity the user is interacting with.
b. A paused Activity is visible on the screen but does not have the focussuch as when an
alert dialog is displayed.
c. A stopped activity is not visible on the screen and is likely to be killed by the system
when its memory is needed. An Activity is stopped when another Activity becomes
active.
d. As an Activity transitions among these states, the Android runtime calls various
Activity lifecycle methodsall of which are defined in the Lifecycle class.
Which of the following statements is false?
a. When a Fragment is attached to an Activity, its lifecycle is tied to that of its parent
Activity.
b. There are six Activity lifecycle methods that have corresponding Fragment lifecycle
methodsonCreate, onStart, onResume, onPause, onStop and onDestroy.
c. When the system calls any of the methods onCreate, onStart, onResume, onPause,
onStop and onDestroy on an Activity, it will also call these corresponding methods (and
potentially other Fragment lifecycle methods) on only the Activity's attached primary
Fragment.
d. An Activity's onPause method is called when another Activity receives the focus,
which pauses the one that loses the focus and sends it to the background.
The explore-by-touch mode is associated with which API?
a. Face Detection
b. Bluetooth Health Devices
c. Accessibility
d. Social
Which of the following statements is false?
a. You can make your app to display something for a few seconds then move on by
using a Handler.
b. Handler method postDelayed receives as arguments a Runnable to execute and a
delay in milliseconds.
c. After the delay has passed, the Handler's Runnable executes in the same thread that
created the Handler.
d. Operations that interact with or modify the GUI must be performed in the GUI
thread, because GUI components are thread safe.
All apps support ________ orientation(s) by default.
a. neither portrait nor landscape
b. only landscape
c. only portrait
d. both portrait and landscape
Which gesture is used to flip item-by-item through a series, such as photos, and
automatically stop at the next item?
a. drag.
b. double touch.
c. pinch zoom.
d. swipe.
Which of the following statements is false?
a. When an Activity's primary task is to display a scrollable list of items, you can extend
class ListActivity, which uses a ListView that occupies the entire app as its default
layout.
b. ListView is a subclass of Adaptera GUI component is bound to a data source via an
Adapter object.
c. When use an ArrayAdapter to create an object that populates the ListView using data
from an ArrayList collection object, this is known as data binding.
d. Several types of AdapterViews can be bound to data using an Adapter. You can bind
database data to a ListView.
Which of the following is false?
a. Before Android 3.0, a separate Activity was typically associated with each screen of
an app.
b. An Activity can manage multiple Fragments.
c. On a phone, each Fragment typically occupies the entire screen and the Activity
switches between the Fragments based on user interactions.
d. On a tablet, activities often display multiple screens per Fragment to take better
advantage of the larger screen size.
Which of the following allows you to share apps and source code and contribute to
others' open-source projects?
a. SourceForge
b. Stack Overflow
c. GitHub
d. (a) and (b)
e. (a) and (c)
Which of the following statements is false?
a. Once the layout is inflated, you can get references to the individual widgets so that
you can interact with them programmatically.
b. Method findViewById takes an int constant representing a specific view's Id and
returns the view.
c. The name of each view's R.id constant is determined by the component's Id property
that you specified when designing the GUI.
d. As an example of c) amountEditText's constant is R.id.amountEditText.
Which of the following statements is false?
a. Unlike activities, Fragments do not have lifecycles.
b. The onCreatemethod is called when a Fragment is created.
c. The onCreateViewmethod is called after onCreate to build and return a View
containing the Fragment's GUI.
d. The onCreateView method receives a LayoutInflater, which you"ll use to
programmatically inflate a Fragment's GUI from the components specified in a
predefined XML layout.
Which of the statements in a), b) and c) is false?
a. You can combine several fragments to create user interfaces that take advantage of
tablet screen sizes.
b. You can easily interchange fragments to make your GUIs more dynamic.
c. Class SettingsFragment is a subclass of PreferenceFragment, which can
automatically maintain an app's user preferences in a SharedPreferences file on the
device.
d. All of the preceding statements are true.
Which of the following capabilities is available on the emulator?
a. Bluetooth.
b. Pinch zoom.
c. USB connections.
d. Determining the battery charge or power charging state.
Which of the following statements is false?
a. Motion-Event's getActionMaskedmethod returns an int representing the MotionEvent
type, which you can use with constants from class MotionEvent to determine how to
handle each event.
b. Motion-Event's getActionIndex method returns an integer index representing which
finger caused the event. This index is the finger's unique ID.
c. To get the finger's unique ID that persists across MotionEvents until the user removes
that finger from the screen, we"ll use Motion-Event's getPointerID method, passing the
finger index as an argument.
d. If the action is MotionEvent.ACTION_DOWN or Motion
Event.ACTION_POINTER_DOWN, the user touched the screen with a new finger.
Which of the following statements is false?
a. When TalkBack is enabled and the user touches an accessible GUI component,
TalkBack speaks the component's accessibility text and vibrates the device to provide
feedback to users who have trouble hearing.
b. Android also provides Explore by Touch, which enables the user to hear TalkBack
speak what's on the screen where the user touches.
c. You enable TalkBack in the Settings app under Accessibility. From that page, you can
also enable other Android accessibility features such as a larger default text size and the
ability to use gestures that magnify areas of the screen.
d. TalkBack is supported in AVDs.
What does the following code do?
if (screenSize == Configuration.SCREENLAYOUT_SIZE_XLARGE)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
else
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
In-app advertising and selling virtual goods are key resources for ________ apps.
With Android's ________ you can draw on the entire screenthe device's system bars and
action bar toggle between displayed and hidden when you tap the screen.
Any local variable or method parameter that will be used in an anonymous inner class
must be declared ________.
You register to receive accelerometer events using SensorManager's registerListener
method. One of its arguments is the rate at which sensor events should be delivered to
the app. Why would you specify SENSOR_DELAY_NORMAL to receive sensor
events at the default rate, instead of choosing a faster rate?
When you upload your app to Google Play, you will be asked to upload a(n) ________
file that includes the app's code files, assets, resources and the manifest file.
Color's static methods alpha-, red, green and blue extract the ARGB values from the
color, and SeekBar's ________ method positions the thumbs.
The first argument of Intent's constructor is ________.
In Android, it's important to minimize the amount of work you do in the GUI thread to
ensure that the GUI remains responsive and does not display ________ dialogs.
It's considered a best practice in Android to ensure that every GUI component can be
used with TalkBack. For components that don"t have descriptive text, such as an
ImageButton, provide text for the component's ________ property.
Android's ________ enables the user to touch the screen to hear TalkBack speak what's
on the screen near the touch.
It's often easiest to select a particular GUI component in the _________ window.
Google created the open-source ________ tool to help you translate your Java app code
to Objective-C for iOS apps.
People with visual and physical disabilities can use Android's ________ to allow a
device to speak screen text or text that you provide to help them understand the purpose
and contents of a GUI component.
The predefined action named ________ specifies that the Activity can be used to
launch the app to begin its execution.
Literal numeric values that specify view dimensions (e.g., widths, heights and spacing)
should be placed in the ________ resource file.

Subscribe Now

Sign up to view full document

View Document