100% found this document useful (36 votes)
421 views10 pages

Java How To Program Late Objects 10th Edition Deitel Test Bank

The document discusses Xcode and Swift programming concepts like projects, the Xcode workspace window, storyboarding, auto layout, and internationalization. It provides questions and answers related to chapter 2 of the Java How to Program book on creating a universal iOS app with Xcode and Swift.

Uploaded by

tyrone
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
100% found this document useful (36 votes)
421 views10 pages

Java How To Program Late Objects 10th Edition Deitel Test Bank

The document discusses Xcode and Swift programming concepts like projects, the Xcode workspace window, storyboarding, auto layout, and internationalization. It provides questions and answers related to chapter 2 of the Java How to Program book on creating a universal iOS app with Xcode and Swift.

Uploaded by

tyrone
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 10

Test Bank for Java How to Program Late Objects 10th

Edition Deitel 0132575655 9780132575652


Full Link Download:
Test Bank:
https://testbankpack.com/p/test-bank-for-java-how-to-program-late-objects-10th-
edition-deitel-0132575655-9780132575652/

Solution Manual:
https://testbankpack.com/p/solution-manual-for-java-how-to-program-late-
objects-10th-edition-deitel-0132575655-9780132575652/
Chapter 2
Welcome App
2.1 Introduction
1. A app is an app that can run on iPhones, iPod touches and iPads.
a. multi-purpose
b. global
c. unrestricted
d. universal
Ans: d. universal

2. You can your apps so that they can display strings in different spoken
languages based on the user’s device settings.
a. limit b.
restrict c.
confine d.
localize
Ans: d. localize

2.2 Technologies Overview

2.2.2 Labels and Image Views


1. Which of the following statements is false?
a. Text can be displayed in a Label (an object of class UILabel from the Cocoa
Touch’s UIKit framework) and a picture can be displayed in an Image View (an object
of class UIImageView).
b. Using Cocoa Touch, you can (without programming) drag and drop a Label and an
Image View onto the UI.
c. iOS’s auto layout capabilities can maintain various relationships among GUI ele-
ments when the user rotates the device.
d. You can edit UI component attributes (e.g., the Text attribute of a Label and the
Image attribute of an Image View) to customize them for your apps.

© Copyright 1992-2015 by Deitel & Associates, Inc. and Prentice Hall. All Rights Reserved.
Ans: b. Using Cocoa Touch, you can (without programming) drag and drop a
Label and an Image View onto the UI. [Actually, using Interface Builder, you can
(without programming) drag and drop a Label and an Image View onto the UI.]

2.2.3 Asset Catalogs and Image Sets


2. Which of the following statements is false?
a. When your app is installed on a device, its icon and name appear with all other
installed apps in the iOS home screen.
b. You specify the icon for your app as part of the app’s settings-.
c. iOS supports asset catalogs, which manage image resources that require different
resolutions for different devices-. An asset catalog contains image sets from which iOS
automatically chooses the appropriate image based only on the device running the app.
d. Your app’s icon will appear in different sizes and resolutions based on the device
and context in which it’s displayed.
Ans: c. iOS supports asset catalogs, which manage image resources that require
different resolutions for different devices-. An asset catalog contains image sets
from which iOS automatically chooses the appropriate image based only on the
device running the app. Actually, an asset catalog contains image sets from which
iOS automatically chooses the appropriate image based on the device running the
app and the context in which the icon is used—such as in the iOS Settings app, in
Spotlight search or as the app’s icon on the home screen.

2.3 Creating a Universal App Project with Xcode

2.3.2 Projects and App Templates


1. Which of the following statements is false?
a. A project is a group of related files, such as the Swift code files and any media
files (e.g., images, video, audio) that compose an app. b. Select File > New > Project…
to create a new project.
c. Selecting File > New > Project… displays a sheet containing the design patterns that
you can use as your new project’s foundation. Design patterns save you time by
providing preconfigured starting points for commonly used app designs. d. A sheet is
a type of dialog that slides down from the top of a window.
Ans: c. Selecting File > New > Project… displays a sheet containing the design pat-
terns that you can use as your new project’s foundation. Design patterns save you
time by providing preconfigured starting points for commonly used app designs.
[Actually, this sheet contains templates, not design patterns.]

© Copyright 1992-2015 by Deitel & Associates, Inc. and Prentice Hall. All Rights Reserved.
2.4 Xcode Workspace Window
1. A new project’s window is known as a window, which is divided into
four main areas below the toolbar: the Navigator area, Editor area, Utilities area and the
Debug area.
a. workplace
b. workbench
c. workspace
d. workdesk
Ans: c. workspace

2.4.5 Xcode Toolbar


2. Clicking the Xcode 6 toolbar’s Run button builds then runs the project on the cur-
rently selected simulator or device as specified in the Scheme selector. Clicking and
holding on this button displays Run, Test, Profile and Analyze options. The Test op- tion
allows you to run unit tests on your app. The Profile option collects information about
your running code to help you locate performance issues, memory leaks and more. The
Analyze option checks your source code for .
a. syntax errors
b. current programming
idiom c. compilation errors
d. potential logic errors
Ans: d. potential logic errors

2.5 Storyboarding the Welcome App’s UI

2.5.2 Providing an App Icon


1. The manages image resources that require different sizes and resolu-
tions for different devices and contexts.
a. asset catalog b.
image catalog c.
device manager d.
context manager
Ans: asset catalog

2.5.4 Overview of the Storyboard and the Xcode Utilities Area


2. Which of the following statements about size classes and auto layout tools is false?
a. Size classes help you design scenes for different screen sizes and orientations.
b. By default, the scene is configured for Any width and Any height, meaning that the
scene is designed for any iOS device and any device orientation.

© Copyright 1992-2015 by Deitel & Associates, Inc. and Prentice Hall. All Rights Reserved.
c. The Any/Any scene is 256-by-256 pixels.
d. The auto layout tools enable you to specify how UI components adjust their sizes
and positions based on a device’s size and orientation.
Ans: c. The Any/Any scene is 256-by-256 pixels. Actually, The Any/Any scene is
600-by-600 pixels.

2.5.8 Using Auto Layout to Support Different Screen Sizes and


Orientations
3. You use constraints to specify how UI components are positioned rela-
tive to other components and how components should resize and reposition based on
the device and device orientation.
a. relative layout
b. auto layout
c. position layout
d. device-based layout
Ans: b. auto layout

2.6 Running the Welcome App


No questions

2.7 Making Your App Accessible


1. Which of the following statements is false?
a. For people with visual and physical disabilities, iOS’s VoiceOver can speak the
screen text (such as the text on a Label or Button) or text that you provide to help the
user understand the purpose of a UI component.
b. When VoiceOver is enabled and the user touches an accessible UI component,
VoiceOver speaks the accessibility text associated with the component.
c. All UIKit framework components support accessibility and many have it enabled
by default. For example, when the user touches a Label, VoiceOver speaks the La- bel’s
text.
d. VoiceOver is supported in the iOS simulator.
Ans: d. VoiceOver is supported in the iOS simulator. Actually, VoiceOver is not
currently supported in the iOS simulator, so you must run this app on a device
to hear VoiceOver speak the text. However, in the simulator you can use the
Accessibility Inspector to view the text that VoiceOver will speak.

© Copyright 1992-2015 by Deitel & Associates, Inc. and Prentice Hall. All Rights Reserved.
2.8 Internationalizing Your App
1. Using layout to design your UI is a key part of internationaliza-tion—
when used correctly, it enables iOS to present your UI in a manner appropriate for each
locale. For example, a UI arranged left-to-right for some languages (e.g., English,
French, Spanish, etc.) would typically be arranged right-to-left for others (e.g., Arabic,
Hebrew, etc.).
a. adjusting
b. customizing
c. regulating
d. auto
Ans: auto

2.8.1 Locking Your UI During Translation


2. If you’re still developing your app and want to have your string resources trans-
lated in parallel, you can your UI components for an entire storyboard or
individually so they cannot be modified accidentally.
a. load
b. lock
c. parallelize
d. freeze
Ans: b. lock

© Copyright 1992-2015 by Deitel & Associates, Inc. and Prentice Hall. All Rights Reserved.
Chapter 2 Introduction to
Java Applications; Input/Output
and Operators
1.1 Introduction
No questions

1.2 A First Swift Program: Printing a Line of Text


1. Any scoped statements in main.swift—that is, statements that are
not written inside function, method or type definitions—serve as the app’s entry
point.
a. locally
b. outer
c. generically
d. globally
Ans: globally
2. String literals cannot span multiple lines of code, but you may concatenate mul-
tiple Strings into a longer String by using the operator.
a. @
b. -
c. ^
d. +
Ans: d. +

3. As you type code in the source-code editor, Xcode displays con-text-


sensitive, suggestions that help you write code quickly and correct-ly.

a. code-anticipation
b. code-fill
c. code-fulfillment
d. code-completion
Ans: code-completion

© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.


4. Where the standard output appears depends on the type of program and where you
execute it. Which of the following statements is false?
a. If you execute a println in a playground, the result displays in playground’s
Console window.
b. If you execute any app from an Xcode project, the output appears in the Debug
area at the bottom of the Xcode window.
c. If the statement is part of a Command Line Tool application, when you execute the
application in a Terminal window, the output appears in that window.
d. If you execute an iOS app on a device, the result is sent to a log file that you can
view in Xcode’s Devices window.
Ans: a. If you execute a println in a playground, the result displays in play-
ground’s Console window. Actually, if you execute a println in a playground, the
result displays in playground’s Assistant- Editor window.

1.3 Modifying Your First Program


1. How many lines of readable text does the following statement print?

println("Welcome\nto\nSwift\nProgramming!")

a. 1
b. 2
c. 3
d. 4
Ans: d. 4

2. The backslash (\) is a(n) character, which has special meaning in a


String literal—\n, for example, represents the line-feed special character.
a. outbreak
b. escape
c. release
d. break
Ans: b. escape

1.4 Composing Larger Strings with String


Interpolation
1. Swift uses type to determine a constant’s or variable’s type from its
initializer value.
a. interpolation
b. conjecture
c. inference
d. interpretation
Ans: c. inference

© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.


2. Constants and variables of the type are limited to the range –32,768 to
32767.
a. Int8
b. Int16
c. Int32
d. Int64
Ans: Int16

3. Constants and variables of the type are limited to the range 0 to


4,294,967,295.
a. UInt8
b. UIntnt16
c. UIntnt32
d. UIntnt64
Ans: c. UInt32

1.5 Another Application: Adding Integers


1. Which of the following statements is false? a.
Whole-number values are treated as type Int.
b. Use constants rather than variables when you know a value will not change after
it’s initialized.
c. Compilers can perform optimizations on variables that cannot be performed on
constants.
d. Constants also eliminate accidental modifications of data that should remain con-
stant.
Ans: c. Compilers can perform optimizations on variables that cannot be per-
formed on constants. [Actually, compilers can perform optimizations on con-
stants that cannot be performed on variables.]

2. An expression is any portion of a statement that has a(n) associated


with it.
a. name
b. constant
c. variable
d. value
Ans: d. value

1.6 Arithmetic
1. Among the arithmetic operators, the asterisk (*) indicates multiplication, and the
percent sign (%) is the operator.
a. division
b. integer division
c. remainder

© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.


d. interpolation
Ans: c. remainder

2. Integer division yields an integer quotient. For example, the expression 7 / 4


evaluates to 1, and the expression 17 / 5 evaluates to 3. Any fractional part in integer
division is simply —no rounding occurs.
a. rounded
b. averaged
c. truncated
d. interpolated
Ans: c. truncated

3. 9 % 4 yields .
a. 1
b. 2
c. 39
d. 5
Ans: a. 1

2.6.2 Operator Precedence


4. When we say that operators are applied from left to right, we’re referring to
their .
a. associativity
b. commutativity
c. idempotence
d. transitivity
Ans: a. associativity

1.7 Decision Making:


The if Conditional Statement and the
Comparative Operators
1. (True/False) An empty control-statement body is represented as in
Swift.
a. blank space
b. ;
c. {}
d. ()
Ans: c. {}

© 2016 Pearson Education, Inc., Hoboken, NJ. All rights reserved.

You might also like