Get immediate PDF access to the full Test Bank for Starting Out with Java From Control Structures through Objects 5th Edition Gaddis 0132855836 9780132855839.
Get immediate PDF access to the full Test Bank for Starting Out with Java From Control Structures through Objects 5th Edition Gaddis 0132855836 9780132855839.
com
http://testbankpack.com/download/test-bank-for-starting-out-
with-java-from-control-structures-through-objects-5th-
edition-gaddis-0132855836-9780132855839/
OR CLICK HERE
DOWLOAD NOW
Visit now to discover comprehensive test banks for all subjects at testbankpack.com
Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.
http://testbankpack.com/download/solution-manual-for-microeconomics-
canadian-15th-edition-ragan-0134378822-9780134378824/
testbankpack.com
http://testbankpack.com/download/test-bank-for-methods-in-behavioral-
research-12th-edition-cozby-bates-0077861892-9780077861896/
testbankpack.com
Test Bank for Marketing The Core 7th Edition Kerin Hartley
1259712362 9781259712364
http://testbankpack.com/download/test-bank-for-marketing-the-core-7th-
edition-kerin-hartley-1259712362-9781259712364/
testbankpack.com
Solution Manual for Optoelectronics and Photonics
Principles and Practices 2nd Edition Kasap 0132151499
9780132151498
http://testbankpack.com/download/solution-manual-for-optoelectronics-
and-photonics-principles-and-practices-2nd-edition-
kasap-0132151499-9780132151498/
testbankpack.com
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
Test Bank for Starting Out with Java From Control Structures
through Objects 5th Edition 0132855836 9780132855839
Full link download
Solution Manual
https://testbankpack.com/p/solution-manual-for-starting-out-with-java-from-
control-structures-through-objects-5th-edition-gaddis-0132855836-
9780132855839/
Test Bank
https://testbankpack.com/p/test-bank-for-starting-out-with-java-from-
control-structures-through-objects-5th-edition-gaddis-0132855836-
9780132855839/
Chapter 2
MULTIPLE CHOICE
1. Which one of the following would contain the translated Java byte code for a program named Demo?
a. Demo.java
b. Demo.code
c. Demo.class
d. Demo.byte
ANS: C
ANS: C
ANS: A
ANS: A
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
5. The term typically refers to the device that displays console output.
a. Standard output device
b. Central processing unit
c. Secondary storage device
d. Liquid crystal display
ANS: A
ANS: A
ANS: D
ANS: A
ANS: B
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
ANS: D
11. Which of the following is not a rule that must be followed when naming identifiers?
a. The first character must be one of the letters a-z, A-Z, and underscore or a dollar sign.
b. Identifiers can contain spaces.
c. Uppercase and lowercase characters are distinct.
d. After the first character, you may use the letters a-z, A-Z, the underscore, a dollar sign, or digits 0-
9.
ANS: B
ANS: C
ANS: A
ANS: D
b. float y;
double z;
z = 934.21;
y = z;
c. float w;
w = 1.0f;
d. float v;
v = 1.0;
ANS: C
16. The boolean data type may contain values in the following range of values
a. true or false
b. -128 to + 127
c. - 2,147,483,648 to +2,147,483,647
d. - 32,768 to +32,767
ANS: A
ANS: C
10 + 5 * 3 - 20
a. -5
b. 5
c. 25
d. -50
ANS: B
25 / 4 + 4 * 10 % 3
a. 19
b. 5.25
c. 3
d. 7
ANS: D
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
int x = 5, y = 20;
x += 32;
y /= 4;
System.out.println("x = " + x + ", y = " + y);
a. x = 32, y = 4
b. x = 9, y = 52
c. x = 37, y = 5
d. x = 160, y = 80
ANS: C
21. What will be the value of z as a result of executing the following code?
int x = 5, y = 28;
float z;
z = (float) (y / x);
a. 5.60
b. 5.6
c. 3.0
d. 5.0
ANS: D
22. What will be the displayed when the following code is executed?
a. x = 22, y = 4
b. x = 22, y = 26
c. x = 22, y = 88
d. Nothing, this is an error
ANS: D
23. In the following Java statement what value is stored in the variable name?
a. John Doe
b. The memory address where "John Doe" is located
c. name
d. The memory address where name is located
ANS: B
int x = 6;
String msg = "I am enjoying this class.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
char ltr = msg.charAt(x);
int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
ltr);
System.out.println("msg has " + strSize +
"characters.");
ANS: D
a. 9
45
16
b. 94516
c. 9 45 16
d. Nothing, this is an error
ANS: D
ANS: C
ANS: D
ANS: B
29. To print "Hello, world" on the monitor, use the following Java statement
a. SystemOutPrintln("Hello, world");
b. System.out.println{"Hello, world"}
c. System.out.println("Hello, world");
d. Print "Hello, world";
ANS: C
30. To display the output on the next line, you can use the println method or use this escape sequence in the
print method.
a. \n
b. \r
c. \t
d. \b
ANS: A
Visit https://testbankpack.com
now to explore a rich
collection of testbank or
solution manual and enjoy
exciting offers!
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
ANS: C
int x = 578;
System.out.print("There are " +
x + 5 + "\n" +
"hens in the hen house.");
ANS: D
ANS: B
34. The primitive data types only allow a(n) to hold a single value.
a. variable
b. object
c. class
d. literal
ANS: A
35. If x has been declared an int, which of the following statements is invalid?
a. x = 0;
b. x = -58932;
c. x = 1,000;
d. x = 592;
ANS: C
36. Given the declaration double r;, which of the following statements is invalid?
a. r = 326.75;
b. r = 9.4632e15;
c. r = 9.4632E15;
d. r = 2.9X106;
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
ANS: D
ANS: B
25 - 7 * 3 + 12 / 3
a. 6
b. 8
c. 10
d. 12
ANS: B
17 % 3 * 2 - 12 + 15
a. 7
b. 8
c. 12
d. 105
ANS: A
40. What will be displayed after the following statements have been executed?
a. x = 27, y = 3.333, z = 18
b. x = 27, y = 2, z = 18
c. x = 27, y = 3, z = 18
d. x = 37, y = 14, z = 4
ANS: C
41. What will be the value of z after the following statements have been executed?
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
int x = 4, y = 33;
double z;
z = (double) (y / x);
a. 8.25
b. 4
c. 8
d. 8.0
ANS: D
42. This is a variable whose content is read only and cannot be changed during the program's execution.
a. operator
b. literal
c. named constant
d. reserved word
ANS: C
43. What will be displayed after the following statements have been executed?
final double x;
x = 54.3;
System.out.println("x = " + x );
a. x = 54.3
b. x
c. x = 108.6
d. Nothing, this is an error.
ANS: D
ANS: D
int x = 8;
String msg = "I am enjoying java.";
String msg1 = msg.toUpperCase();
String msg2 = msg.toLowerCase();
char ltr = msg.charAt(x);
int strSize = msg.length();
System.out.println(msg);
System.out.println(msg1);
System.out.println(msg2);
System.out.println("Character at index x = " +
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
ltr);
System.out.println("msg has " + strSize +
" characters.");
a. I am enjoying java.
I AM ENJOYING JAVA.
i am enjoying java.
Character at index x = j
msg has 20 characters.
b. I am enjoying java.
I AM ENJOYING JAVA.
i am enjoying java.
Character at index x = o
msg has 20 characters.
c. I am enjoying java.
I AM ENJOYING JAVA.
i am enjoying java.
Character at index x = o
msg has 19 characters.
d. I am enjoying java.
I AM ENJOYING JAVA.
i am enjoying java.
Character at index x = y
msg has 19 characters.
ANS: C
46. Which of the following does not describe a valid comment in Java?
a. Single line comments, two forward slashes - //
b. Multi-line comments, start with /* and end with */
c. Multi-line comments, start with */ and end with /*
d. Documentation comments, any comments starting with /** and ending with */
ANS: C
47. Which of the following statements correctly creates a Scanner object for keyboard input?
b. Scanner keyboard(System.in);
ANS: C
a. readInt() c. getInt()
b. nextInt() d. read_int()
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
ANS: B
a. readString() c. getString()
b. nextString() d. nextLine()
ANS: D
50. Which one of the following methods would you use to convert a string to a double?
a. Byte.ParseByte c. Integer.ParseInt
b. Long.ParseLong d. Double.ParseDouble
ANS: D
TRUE/FALSE
1. A Java program will not compile unless it contains the correct line numbers.
ANS: F
ANS: F
ANS: F
4. Although the dollar sign is a legal identifier character, you should not use it because it is normally used for
special purposes.
ANS: T
5. Assuming that pay has been declared a double, the following statement is valid.
pay = 2,583.44;
ANS: F
6. Named constants are initialized with a value, that value cannot be changed during the execution of the program.
ANS: T
7. A variable's scope is the part of the program that has access to the variable.
ANS: T
8. In Java the variable named total is the same as the variable named Total.
ANS: F
ANS: F
10. Both character literals and string literals can be assigned to a char variable.
ANS: F
11. If the compiler encounters a statement that uses a variable before the variable is declared, an error will result.
ANS: T
12. Programming style includes techniques for consistently putting spaces and indentation in a program so visual
cues are created.
ANS: T
Another Random Document on
Scribd Without Any Related Topics
(Alethopteris decurrens, of Göppert.
Pecopteris heterophylla, Lindley and Hutton, tab. 38.
Filicites decurrens, of Artis.)
The drawing represents but a small portion of the specimen, which indicated a
plant of gigantic size.
"The leaf or frond of this fern is very large, tripinnate or quadripinnate; the
stipes is broad and undulated; the leaflets are sessile, linear-lanceolate; the ribs
pinnate, the secondary ribs perpendicular to the main rib; the first leaflet on the
superior side of the pinnule adheres by its side to the rachis."—Artis.
This fern, which closely resembles some recent species, (Pteris aurita,) occurs
in great abundance in the shale at Alverthorpe near Wakefield. Notwithstanding
the profusion with which the foliage of many kinds of ferns is distributed
throughout the coal formation, the undoubted stems of tree-ferns are so rare,
that it may admit of question whether some of the leaves which from the analogy
of their structure to recent forms have been referred to the ferns, may not have
belonged to the stems of unknown trees with which they are associated in the
strata; for as, in the animal kingdom, distinct types of living organisms are often
found blended in the extinct races, so in the vegetable, it is possible, that foliage
and stems, of apparently discordant types, may have belonged to the same
extinct species or genus of trees. This problem can only be solved by diligent and
continued research in the richest localities of coal-plants.
M. Brongniart remarks that every bed of coal is the product of a special
vegetation, often different from that which preceded, and that which followed it.
Each bed thus resulting from a distinct vegetation, is characterized by the
predominance of certain impressions of plants, and the experienced miners
distinguish in many cases the beds they are working, by their practical knowledge
of the plants that prevail.
The same beds of coal, and the deposits which cover it, ought therefore to
contain the different parts of the plants that were living at the period of its
formation; and by carefully studying the association of these different fossils,
forming thus little special floras, generally of but few species, we may hope to
acquire data by which we may advance the means of reconstructing the
anomalous vegetable forms of the ancient world. M. Brongniart strongly urges
attention to this circumstance in the examination of the coal strata, with the view
of determining the identity of the scattered leaves, stems, and fruits, in any
particular stratum. By such a procedure, much addition would be made to our
knowledge of the entire structures of many of the fossil plants of which we now
only know the fragments. Thus we may hope to ascertain the foliage of the
Sigillariæ, the roots of which, by a similar method, have but recently been
determined to be the fossils called Stigmariæ.
Plate XXXIII.
PLATE XXXIII.
PART II.
FOSSIL FAUNA.
Plates XXXIV. to LXXIV. inclusive.
Plate XXXIV.
PLATE XXXIV.
(Plates XXXIV. to LXXIV. inclusive, are from Parkinson's Organic
Remains.)
Some slabs of this fossil coral are of a dull red hue, which there is every
reason to conclude is due to the colour of the original; and not only are traces of
the natural tints of the living zoophyte preserved, but even the animal membrane
of the coral; and this may be exposed by immersing a fragment of the marble in
dilute muriatic (hydrochloric) acid. Mr. Parkinson thus describes the result of his
first experiment:—
"A fragment of the marble (Plate XXXIV. fig. 2) was exposed to the action of
muriatic acid in a very dilute state. As the calcareous earth was dissolved, and the
carbonic acid escaped, I was delighted to observe the membranaceous substance
appear, depending from the stone in light, flocculent, elastic flakes. Many of these
retained a deep red colour, and appeared in a beautiful and distinct manner,
although not absolutely retaining the form of the tubipore. A faithful
representation of this appearance is given in fig. 3."
This experiment of Mr. Parkinson was highly important, as proving the
previously almost incredible fact, that animal membrane, when hermetically
sealed, as it were, in the solid stone, was as indestructible as the rock itself. It
suggested, too, the probability that vestiges of other animal tissues might be
traced in organic remains, and encouraged subsequent observers to seek for
evidence of the soft parts of animal bodies entombed in the strata. It was the first
step in the right direction, and led to the detection of many highly interesting
phenomena. In Dr. Buckland's Bridgewater Essay will be found figures and
descriptions of the eyes of crustacea: of the wings, elytra or wing-covers, and the
integuments of the body of insects; of the skin of reptiles; and, in the "Wonders
of Geology," and "Medals of Creation," of the membranes of the air-bladder, and
of the capsule of the eye of fishes; of the soft parts of the animalcules called
foraminifera, &c. The bodies of mollusca, or shell-fish, converted into a dark
brown mass (mollushite), occur in such abundance in some deposits, as to yield a
rich manure from the quantity of phosphate of lime. The excrementitious
substances termed by Dr. Buckland "Coprolites," are also used for agricultural
purposes.
Plate XXXV.
PLATE XXXV.
Plate XXXVI.
PLATE XXXVI.
Plate XXXVII.
PLATE XXXVII.
Plate XXXVIII.
PLATE XXXVIII.
PLATE XXXIX.
Plate XL.
PLATE XL.
The origin of these fossils was first pointed out by the Rev. W. Conybeare.[29]
The fibrous shells of a fossil genus of bivalves named Inoceramus, of which
several species abound in the Chalk, appear to have been particularly subjected to
depredations of this kind. Hence among partially water-worn flints, specimens of
the siliceous casts are common; figs. 8, and 10, are examples from the Hackney
gravel-pits.
[29] See Medals of Creation, vol. i. p. 396, fig. 94.
Plate XLI.
PLATE XLI.
Plate XLII.
PLATE XLII.
Plate XLIII.
PLATE XLIII.
Plate XLIV.
PLATE XLIV.
Fossil Zoophytes.
Fig. 1. A spongite (Scyphia costata, of Goldfuss), from Switzerland. The
fossil spongeous bodies named Scyphia, are characterized by the
"mass or body being either cylindrical, simple or branched; fistulous,
and terminating in a rounded pit; entirely composed of a firm
reticulated tissue."[35] Like the other bodies comprised in the group
of Amorphozoa, the form in this genus is exceedingly diversified,
and as the structure is often but obscurely shown, the determination
of these fossils is oftentimes impossible. It is however convenient, in
the present state of our knowledge, to distinguish the principal kinds
by names which may be modified or abandoned, when the structure
and natural affinities of the original organisms are more accurately
determined.
[35] Medals of Creation, p. 237.