Quickly download Starting Out with Java From Control Structures through Objects 5th Edition Tony Gaddis Test Bank in PDF with every chapter.
Quickly download Starting Out with Java From Control Structures through Objects 5th Edition Tony Gaddis Test Bank in PDF with every chapter.
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-objects-5th-edition-tony-gaddis-solutions-manual/
https://testbankfan.com/product/starting-out-with-c-from-control-
structures-through-objects-7th-edition-tony-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-objects-6th-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-objects-7th-edition-gaddis-test-bank/
Starting Out with Java From Control Structures through
Objects 7th Edition Gaddis Solutions Manual
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-objects-7th-edition-gaddis-solutions-manual/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-objects-6th-edition-gaddis-solutions-manual/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-data-structures-3rd-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-data-structures-2nd-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-data-structures-3rd-edition-gaddis-solutions-
manual/
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
Chapter 6
MULTIPLE CHOICE
ANS: B
2. Class objects normally have __________ that perform useful operations on their data, but primitive variables do
not.
a. fields
b. instances
c. methods
d. relationships
ANS: C
3. In the cookie cutter metaphor, think of the ________ as a cookie cutter and ________ as the cookies.
a. object; classes
b. class; objects
c. class; fields
d. attribute; methods
ANS: B
ANS: D
5. When you are working with a ____________, you are using a storage location that holds a piece of data.
a. primitive variable
b. reference variable
c. numeric literal
d. binary number
ANS: A
ANS: B
ANS: C
8. Java allows you to create objects of this class in the same way you would create primitive variables.
a. Random
b. String
c. PrintWriter
d. Scanner
ANS: B
ANS: D
10. Data hiding, which means that critical data stored inside the object is protected from code outside the object, is
accomplished in Java by:
a. using the public access specifier on the class methods
b. using the private access specifier on the class methods
c. using the private access specifier on the class definition
d. using the private access specifier on the class fields
ANS: D
ANS: D
12. You should not define a class field that is dependent upon the values of other class fields:
a. in order to avoid having stale data
b. because it is redundant
c. because it should be defined in another class
d. in order to keep it current
ANS: A
ANS: D
ANS: B
ANS: A
16. A constructor:
a. always accepts two arguments
b. has return type of void
c. has the same name as the class
d. always has an access specifier of private
ANS: C
17. Which of the following statements will create a reference, str, to the String, “Hello, World”?
a. String str = "Hello, World";
b. string str = "Hello, World";
c. String str = new "Hello, World";
d. str = "Hello, World";
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
ANS: A
18. Two or more methods in a class may have the same name as long as:
a. they have different return types
b. they have different parameter lists
c. they have different return types, but the same parameter list
d. you cannot have two methods with the same name
ANS: B
19. Given the following code, what will be the value of finalAmount when it is displayed?
ANS: D
20. A class specifies the ________ and ________ that a particular type of object has.
a. relationships; methods
b. fields; object names
c. fields; methods
d. relationships; object names
ANS: C
21. This refers to the combining of data and code into a single object.
a. Data hiding
b. Abstraction
c. Object
d. Encapsulation
ANS: D
ANS: B
23. In your textbook the general layout of a UML diagram is a box that is divided into three sections. The top
section has the _______; the middle section holds _______; the bottom section holds _______.
a. class name; attributes or fields; methods
b. class name; object name; methods
c. object name; attributes or fields; methods
d. object name; methods; attributes or fields
ANS: A
ANS: D
a. methods private
b. fields private
c. fields public
d. fields and methods public
ANS: B
26. After the header, the body of the method appears inside a set of:
a. brackets, []
b. parentheses, ()
c. braces, {}
d. double quotes, ""
ANS: C
ANS: C
a. /
b. @
c. -
d. +
ANS: D
ANS: B
30. When an object is created, the attributes associated with the object are called:
a. instance fields
b. instance methods
c. fixed attributes
d. class instances
ANS: A
31. When an object is passed as an argument to a method, what is passed into the method’s parameter variable?
a. the class name
b. the object’s memory address
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
ANS: B
ANS: D
ANS: D
34. Which of the following statements will create a reference, str, to the string, “Hello, world”?
a. 1
b. 2
c. 1 and 2
d. Neither 1 or 2
ANS: C
ANS: C
36. Given the following code, what will be the value of finalAmount when it is displayed?
orderNum = orderNumber;
orderAmount = orderAmt;
orderDiscount = orderDisc;
}
ANS: C
ANS: C
38. Instance methods do not have this key word in their headers:
a. public
b. static
c. private
d. protected
ANS: B
39. Which of the following is not involved in finding the classes when developing an object-oriented application?
ANS: C
a. archive c. collection
b. package d. attachment
ANS: B
41. Quite often you have to use this statement to make a group of classes available to a program.
a. import c. link
b. use d. assume
ANS: A
import java.util.Scanner;
This is an example of
ANS: B
import java.util.*;
ANS: A
44. The following package is automatically imported into all Java programs.
a. java.java c. java.util
b. java.default d. java.lang
ANS: D
TRUE/FALSE
ANS: T
Gaddis: Starting Out with Java: From Control Structures through Objects, 5/e © 2012 Pearson Education
ANS: T
ANS: T
4. A method that stores a value in a class's field or in some other way changes the value of a field is known as a
mutator method.
ANS: T
ANS: F
ANS: T
7. Shadowing is the term used to describe where the field name is hidden by the name of a local or parameter
variable.
ANS: T
8. The public access specifier for a field indicates that the attribute may not be accessed by statements outside
the class.
ANS: F
9. A method that gets a value from a class's field but does not change it is known as a mutator method.
ANS: F
10. Instance methods do not have the key word static in their headers.
ANS: T
11. The term "default constructor" is applied to the first constructor written by the author of a class.
ANS: F
12. When a local variable in an instance method has the same name as an instance field, the instance field hides the
local variable.
ANS: F
13. The term "no-arg constructor" is applied to any constructor that does not accept arguments.
ANS: T
14. The java.lang package is automatically imported into all Java programs.
ANS: T
Exploring the Variety of Random
Documents with Different Content
entreaty, than the most eloquent appeal in words,—Marion
withdrew; as the light of the returning lantern flashed into the room.
“All still and peaceable. Nobody there. Fancy, I suppose,” said Mr.
Britain, as he locked and barred the door. “One of the effects of
having a lively imagination. Halloa! Why, what’s the matter?”
Clemency, who could not conceal the effects of her surprise and
concern, was sitting in a chair: pale, and trembling from head to
foot.
“Matter!” she repeated, chafing her hands and elbows, nervously,
and looking anywhere but at him. “That’s good in you, Britain, that
is! After going and frightening one out of one’s life with noises, and
lanterns, and I don’t know what all. Matter! Oh, yes.”
“If you’re frightened out of your life by a lantern, Clemmy,” said Mr.
Britain, composedly blowing it out and hanging it up again, “that
apparition’s very soon got rid of. But you’re as bold as brass in
general,” he said, stopping to observe her; “and were, after the
noise and the lantern too. What have you taken into your head? Not
an idea, eh?”
But as Clemency bade him good night very much after her usual
fashion, and began to bustle about with a show of going to bed
herself immediately, Little Britain, after giving utterance to the
original remark that it was impossible to account for a woman’s
whims, bade her good night in return, and taking up his candle
strolled drowsily away to bed.
When all was quiet, Marion returned.
“Open the door,” she said; “and stand there close beside me, while I
speak to him, outside.”
Timid as her manner was, it still evinced a resolute and settled
purpose, such as Clemency could not resist. She softly unbarred the
door: but before turning the key, looked round on the young
creature waiting to issue forth when she should open it.
The face was not averted or cast down, but looking full upon her, in
its pride of youth and beauty. Some simple sense of the slightness of
the barrier that interposed itself between the happy home and
honoured love of the fair girl, and what might be the desolation of
that home, and shipwreck of its dearest treasure, smote so keenly
on the tender heart of Clemency, and so filled it to overflowing with
sorrow and compassion, that, bursting into tears, she threw her
arms round Marion’s neck.
“It’s little that I know, my dear,” cried Clemency, “very little; but I
know that this should not be. Think of what you do!”
“I have thought of it many times,” said Marion, gently.
“Once more,” urged Clemency. “Till to-morrow.”
Marion shook her head.
“For Mr. Alfred’s sake,” said Clemency, with homely earnestness.
“Him that you used to love so dearly, once!”
She hid her face, upon the instant, in her hands, repeating “Once!”
as if it rent her heart.
“Let me go out,” said Clemency, soothing her. “I’ll tell him what you
like. Don’t cross the door-step to-night. I’m sure no good will come
of it. Oh, it was an unhappy day when Mr. Warden was ever brought
here! Think of your good father, darling: of your sister.”
“I have,” said Marion, hastily raising her head. “You don’t know what
I do. You don’t know what I do. I must speak to him. You are the
best and truest friend in all the world for what you have said to me,
but I must take this step. Will you go with me, Clemency,” she kissed
her on her friendly face, “or shall I go alone?”
Sorrowing and wondering, Clemency turned
the key, and opened the door. Into the dark
and doubtful night that lay beyond the
threshhold, Marion passed quickly,
holding by her hand.
In the dark night he joined her, and
they spoke together
earnestly and long: and the
hand that held so fast by
Clemency’s, now trembled,
now turned deadly cold, now
clasped and closed on hers,
in the strong feeling of the
speech it emphasized
unconsciously. When they
returned, he followed to the
door; and pausing there a
moment, seized the other
hand, and pressed it to his
lips. Then stealthily
withdrew.
The door was barred and
locked again, and once again she stood beneath her father’s roof.
Not bowed down by the secret that she brought there, though so
young; but with that same expression on her face, for which I had
no name before, and shining through her tears.
Again she thanked and thanked her humble friend, and trusted to
her, as she said, with confidence, implicitly. Her chamber safely
reached, she fell upon her knees; and with her secret weighing on
her heart, could pray!
Could rise up from her prayers, so tranquil and serene, and bending
over her fond sister in her slumber, look upon her face and smile:
though sadly: murmuring as she kissed her forehead, how that
Grace had been a mother to her, ever, and she loved her as a child!
Could draw the passive arm about her neck when lying down to rest
—it seemed to cling there, of its own will, protectingly and tenderly
even in sleep—and breathe upon the parted lips, God bless her!
Could sink into a peaceful sleep, herself; but for one dream, in which
she cried out, in her innocent and touching voice, that she was quite
alone, and they had all forgotten her.