Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Login

Register Now

Welcome to All Test Answers

Android How to Program Chapter 02


 

Download  file with the answers

If you are not a member register here to download this file 


 

Chapter 2—Welcome App
2.1 Introduction
Q1. Which of the following statements is false?
a. Android Studio’s layout editor enables you to build GUIs using drag-and-drop techniques.
b. You can edit the GUI’s XML directly.
c. In portrait orientation the device’s width is greater than its height.
d. Android’s Explore by Touch enables users to touch items on the screen and hear TalkBack speak the corresponding descriptive text.

Q2. You can ________ an app so that you can provide localized strings in different languages.
a. translate.
b. convert.
c. transcribe.
d. internationalize.

2.2.2 LinearLayout, TextView and ImageView
Q1. ________ are views that contain and arrange other views.
a. Layouts.
b. TextViews.
c. ImageViews.
d. None of the above.

Q2. Which of the following statements is false?
a. You can use a vertical LinearLayout to arrange an app’s text and image with each occupying half the LinearLayout’s vertical space.
b. A LinearLayout also can arrange views horizontally.
c. The default GUI created by Android Studio already contains an ImageView.
d. You can use the layout editor’s Palette of views to drag and drop an ImageView onto a GUI, then configure its properties.

Q3. Which of the following statements is true?
a. Extensible Markup Language (XML) is a natural way to express GUIs.
b. XML is human- and computer-readable text and, in the context of Android, helps you specify the layouts and components to use, as well as their attributes, such as size, position, color, text size, margins and padding.
c.You use XML files to store app resources, such as strings, numbers and colors.
d. All of the above are true.

2.2.3 App Resources
Q1. (True/False) It’s considered good practice to define all strings, numeric values and other values in XML resource- files that are placed in the subfolders of a pro-ject’s resources folder.

Q2. (True/False) For a TextView font color, you should typically create a color resource using a color selected from Google’s Material Design color palette.

2.2.4 Accessibility
Q1. Which of the first three statements below is false?
a. Android provides accessibility features to help people with certain disabilities use their devices.
b. People with visual impairments can use Android’s TalkBack to allow a device to speak screen text or text that you provide to help them understand the purpose and contents of a view.
c. Android’s Explore by Touch enables the user to touch the screen to hear TalkBack speak what’s on the screen near the touch.
d. All of the above are true.

2.2.5 Internationalization
Q1. Which of the following statements is true?
a. To reach the most users with your apps, you should consider customizing them for various locales and spoken languages.
b. Configuring your app so that it can be customized for various locales is known as localization.
c. Customizing your app for a specific locale is known as internationalization.
d. All of the above statements are false.

2.3.2 Creating a New Project
Q1. A ________ is a group of related files, such as code files, resource files and images that make up an app.
a. folder
b. directory
c. solution
d. project

2.3.3 Create New Project Dialog
Q1. Which of the following statements is false?
a. The package name normally begins with your company’s or institution’s Com-pany Domain in reverse. This is followed by a dot (.) and the app’s name in all lowercase letters with any spaces removed.
b. By convention, package names use only lowercase letters.
c. The IDE sets the package name using the text you enter for Company Name and Company Domain.
d. By default, Android Studio places new project folders in the subfolder An-droidStudioProjects in your user account directory.

2.3.4 Target Android Devices Step
Q1. Which of the following statements is false?
a. The Minimum SDK is the minimum Android API level that’s required to run your app. This allows your app to execute on devices supporting that API level and high-er.
b. Lower Minimum SDK values enable your app to run on more devices.
c. Generally you should target the highest API level on which your app can run.
d. You must disable newer features that are not available on older platforms when your app is installed on those platforms.

2.3.5 Add an Activity to Mobile Step
Q1. Which type of app template is described by: “Used for a single-screen app (sim-ilar to Blank Activity) that occupies the entire screen, but can toggle visibility of the device’s status bar and the app’s app bar.”
a. Empty Activity.
b. Fullscreen Activity.
c. Master/Detail Flow.
d. None of the above.

2.4.1 Project Window
Q1. The ________ window provides access to all of the project’s files.
a. Organizer
b. Explorer
c. Project
d. None of the above.

Q2. (True/False) You can have only one project open in the IDE at once.

Q3. The ________ folder contains the files you’ll edit to create your apps’ GUIs and logic.
a. java
b. res
c. app
d. manifests

2.4.2 Editor Windows
Q1. The code editors for Java and XML help you write code quickly and correctly via ________—as you type, you can press Enter (or Return) to automatically finish a Java code element or an XML element name, attribute name or value that is cur-rently highlighted in the code-completion window.
a. code-for-me
b. code-completion
c. automated coding
d. None of the above.

2.4.3 Component Tree Window
Q1. When the layout editor is open in Design view, the ________ appears at the right side of the IDE. This window shows the layouts and views (GUI components) that comprise the GUI and their parent-child relationships—for example, a layout (the parent) might contain many nested views (the children), including other lay-outs.
a. Project window
b. Properties window
c. Palette
d. Component Tree

2.4.4 App Resource Files
Q1. Layout files like activity_main.xml are app ________ and are stored in sub-folders of the project’s res folder.
a. code
b. descriptions
c. resources
d. None of the above.

2.4.6 Default GUI
Q1. With a ________ you can, for example, specify that one view should appear below another and be centered horizontally within this layout.
a. LinearLayout
b. CenteredLayout
c. RelativeLayout
d. None of the above.

2.4.7 XML for the Default GUI
Q1. In a layout XML file, attribute values that begin with @, such as
@dimen/activity_vertical_margin are ________ with values defined in other files.
a. resources
b. variables
c. dimentions
d. None of the above.

2.5 Building the App’s GUI with the Layout Editor
Q1. Android Studio allows you to build your GUI by dragging and dropping views—such as Text-Views, Image-Views and Buttons—onto the ________.
a. GUI designer
b. layout designer
c. GUI editor
d. layout editor

2.5.1 Adding an Image to the Project
Q1. Which of the following statements is false?
a. Android devices have various screen sizes, resolutions and pixel densities (that is, dots per inch or DPI), so you typically provide images in various resolutions that the operating system chooses based on a device’s pixel density. These are placed in drawable folders (in a project’s res folder) that store images with different pixel densities.
b. Android Studio displays only one drawable folder containing the app’s drawa-ble resources, even if your project contains resources for multiple densities.
c. If Android cannot find an image in the drawable folder that most closely matches the device’s pixel density, Android will display nothing for that image.
d. Low-resolution images do not scale well. For images to render nicely, a high-pixel-density device needs higher-resolution images than a low-pixel-density device.

2.5.2 Adding an App Icon
Q1. When your app is installed on a device, its icon and name appear with all other installed apps in the ________.
a. finder
b. explorer
c. launcher
d. None of the above.

Q2. Which of the first three statements about uploading apps to Google Play is false?
a. You can upload multiple versions of the app for various device- sizes and screen resolutions.
b. All images in the mipmap folders are uploaded with every version of your app.
c. You can remove extra drawable folders for specific pixel densities from a given app version to minimize the total installation size for a particular device.
d. All of the above are true.
Answer: d. All of the above are true.
2.5.3 Changing RelativeLayout to a LinearLayout
Q1. When you open a layout XML file, the layout’s design appears in the layout editor and the layout’s views and their hierarchical relationships appear in the ________ window.
a. Outline
b. Tree
c. Layout Editor
d. Component Tree

2.5.4 Changing the LinearLayout’s id and orientation
Q1. Which of the following statements is false?
a. When a GUI is displayed in the layout editor, you can use the Properties window below the Component Tree to configure the selected view’s properties.
b. You also can edit a view’s most commonly used properties by double clicking the view in the canvas. The layout editor then displays a small dialog in which you can set the view’s id property and other properties that depend on the specific view:
c. For a LinearLayout, you can set the orientation to specify whether the lay-out’s children are arranged in horizontal or vertical orientation.
d. For an ImageView, you can set the src (source) of the image to display.

2.5.5 Configuring the TextView’s id and text Properties
Q1. Which of the following statements is false?
a. It’s considered good practice to place strings, string arrays, images, colors, font sizes, dimensions and other app resources in XML files within the subfolders of the project’s res folder, so these resources can be managed separately from your app’s Java code.
b. If you externalize color values, it becomes more difficult to update all compo-nents that use the same color.
c. If you wish to localize your app in several languages, storing the strings separate-ly from the app’s code allows you to change them easily.
d. 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—English for our apps.

2.5.6 Configuring the TextView’s textSize Property—Scaled Pixels and Density-Independent Pixels
Q1. Which of the following statements is false?
a. You should use density-independent pixels for font sizes, and scale-independent pixels for dimensions of views and other screen elements.
b. Defining your GUIs with density-independent pixels enables the Android plat-form to scale the GUI, based on the pixel density of a given device’s screen.
c. One density-independent pixel is equivalent to one pixel on a 160-dpi screen.
d. On a 240-dpi screen, each density-independent pixel will be scaled by a factor of 240/160 (i.e., 1.5). So, a component that’s 100 density-independent pixels wide will be scaled to 150 actual pixels wide.

2.5.7 Setting the TextView’s textColor Property
Q1. Which of the following statements is false?
a. When you need custom colors in your apps, Google’s Material Design guidelines recommend using colors from the Material Design color palette.
b. Colors are specified as RGB (red-green-blue) or ARGB (alpha-red-green-blue) values.
c. An RGB value consists of integer values in the range 1–100 that define the amounts of red, green and blue in the color, respectively.
d. Custom colors are defined in hexadecimal format, so the RGB components are values in the range 00 (the hexadecimal value for 0) to FF (the hexadecimal value for 255).

2.5.8 Setting the TextView’s gravity Property
Q1. To center the text in the TextView if it wraps to multiple lines, you can set its ________ property to center.
a. alignment
b. weight
c. gravity
d. positioning

2.5.10 Setting the TextView’s layout:weight Property
Q1. A LinearLayout can proportionally size its children based on their ________, which specify the view’s relative size with respect to the layout’s other views.
a. layout:widths
b. layout:heights
c. layout:gravity
d. layout:weights

Q2. Android ________ checks your project for common errors, and makes sugges-tions for better security-, enhanced performance, improved accessibility, interna-tionalization- and more. Some checks occur as you build your apps and write code.
a. Cleanser.
b. Lint.
c. Error Checker.
d. None of the above.

2.5.11 Adding an ImageView to Display the Image
Q1. Which of the following statements about adding an ImageView to the GUI by dragging it from the Palette’s Widgets section onto the canvas is false?
a. When you drag a view onto the canvas, the layout editor displays orange guide lines, green guide lines and a tooltip.
b. The orange guide lines show the bounds of each existing view in the layout.
c. The green guide lines indicate where the new view will be placed with respect to the existing views—by default, new views are added at the top of a vertical Line-arLayout, unless you position the mouse below the orange box that bounds the layout’s bottommost view.
d. The tooltip displays how the view will be configured if you drop it at the current position.

2.7 Making Your App Accessible
Q1. Which of the following statements is false?
a. For people with visual disabilities, Android’s TalkBack can speak screen text or text that you provide (when designing your GUI or programmatically) to help the user understand the purpose of a view.
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. Most standard Android views support accessibility.
d. You enable TalkBack in the Settings app under Accessibility. From that page, you also can enable other Android accessibility features such as a larger default text size and the ability to use gestures that magnify areas of the screen.

Q2. For an ImageView there is no text for TalkBack to speak unless you provide it. It’s considered good practice in Android to ensure that every view can be used with TalkBack by providing text for the ________ property of any view that does not display text.
a. talkBack
b. description
c. hint
d. contentDescription

2.8 Internationalizing Your App
Q1. Which of the following statements is false?
a. To reach the largest possible audience, you should consider designing your apps so that they can be customized for various locales and spoken languages.
b. You might also choose to use different colors, graphics and sounds based on the locale.
c. When the user launches the app, Android automatically finds and loads the re-sources that match the device’s locale settings.
d. Designing an app so it can be customized is known as localization. Customizing an app’s resources for each locale is known as internationalization.

2.8.2 Naming the Folders for Localized Resources
Q1. Android uses a special folder-naming scheme to automatically choose the cor-rect localized resources. You can name these folders with region infor-mation—values-en-rUS would contain a strings.xml file for United States Eng-lish and ________ would contain a strings.xml file for United Kingdom English.
a. values-en-rUK
b. values-en-rEN
c. values-en-rGB
d. values-en-rBR

Q2. If localized resources are not provided for a given locale, Android uses the app’s default resources—that is, those in the res folder’s ________ subfolder.
a. defaults
b. english
c. values
d. strings

2.8.3 Adding String Translations to the App’s Project
Q1. Android Studio provides a ________ for quickly and easily adding translations for existing strings in your app.
a. Translator
b. Translations Editor
c. Converter
d. None of the above.

2.8.5 Testing the App in Spanish on an AVD
Q1. If Android cannot find a localized version of a string resource, it uses the de-fault version in the ________ file.
a. res/values/defaults.xml
b. res/values/english.xml
c. res/values/values.xml
d. res/values/strings.xml

2.8.7 TalkBack and Localization
Q1. When you first switch your device to French and enable TalkBack, Android will automatically download the ________ engine.
a. English-to-French.
b. Translations.
c. French text-to-speech.
d. French Transalation.

About

Leave a reply

Captcha Click on image to update the captcha .

error: Content is protected !!