Starting Out with Java From Control Structures through Objects 6th Edition Gaddis Test Bank download
Starting Out with Java From Control Structures through Objects 6th Edition Gaddis Test Bank download
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-6th-edition-gaddis-solutions-manual/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-objects-7th-edition-gaddis-test-bank/
https://testbankfan.com/product/starting-out-with-java-from-control-
structures-through-objects-7th-edition-gaddis-solutions-manual/
https://testbankfan.com/product/intermediate-algebra-functions-and-
authentic-applications-5th-edition-jay-lehmann-test-bank/
Microeconomics 19th Edition Samuelson Test Bank
https://testbankfan.com/product/microeconomics-19th-edition-samuelson-
test-bank/
https://testbankfan.com/product/personal-finance-canadian-5th-edition-
kapoor-solutions-manual/
https://testbankfan.com/product/human-genetics-and-society-2nd-
edition-yashon-test-bank/
https://testbankfan.com/product/astronomy-today-7th-edition-chaisson-
test-bank/
https://testbankfan.com/product/economics-of-strategy-6th-edition-
besanko-test-bank/
Nutrition Through the Life Cycle 6th Edition Brown Test
Bank
https://testbankfan.com/product/nutrition-through-the-life-cycle-6th-
edition-brown-test-bank/
Starting Out with Java: From Control Structures through Objects, 6e (Gaddis)
Chapter 5 Methods
2) Which of the following is NOT a benefit derived from using methods in programming?
A) Pproblems are more easily solved.
B) simplifies programs
C) code reuse
D) All of the above are benefits.
Answer: D
3) This type of method performs a task and sends a value back to the code that called it.
A) value-returning
B) void
C) complex
D) local
Answer: A
1
Copyright © 2016 Pearson Education, Inc.
6) In the header, the method name is always followed by this:
A) parentheses
B) return type
C) data type
D) braces
Answer: A
7) This part of a method is a collection of statements that are performed when the method is executed.
A) method header
B) return type
C) method body
D) method modifier
Answer: C
9) If method A calls method B, and method B calls method C, and method C calls method D, when
method D finishes, what happens?
A) Control is returned to method A.
B) Control is returned to method B.
C) Control is returned to method C.
D) The program terminates.
Answer: C
2
Copyright © 2016 Pearson Education, Inc.
12) What is wrong with the following method call?
13) Given the following method header, which of the method calls would be an error?
14) Which of the following would be a valid method call for the following method?
3
Copyright © 2016 Pearson Education, Inc.
17) A special variable that holds a value being passed into a method is called what?
A) Modifier
B) Parameter
C) Alias
D) Argument
Answer: B
18) When you pass an argument to a method, be sure that the argument's data type is compatible with:
A) the parameter variable's data type
B) the method's return type
C) the version of Java currently being used
D) IEEE standards
Answer: A
22) Which of the following values can be passed to a method that has an int parameter variable?
A) float
B) double
C) long
D) All of the above
E) None of the above
Answer: E
4
Copyright © 2016 Pearson Education, Inc.
23) The header of a value-returning method must specify this.
A) The method's local variable names
B) The name of the variable in the calling program that will receive the returned value
C) The data type of the return value
D) All of the above
Answer: C
26) When a method tests an argument and returns a true or false value, it should return:
A) a zero for true and a one for false
B) a boolean value
C) a zero for false and a non-zero for true
D) a method should not be used for this type test
Answer: B
5
Copyright © 2016 Pearson Education, Inc.
29) Breaking a program down into small manageable methods:
A) makes problems more easily solved
B) allows for code reuse
C) simplifies programs
D) all of the above
Answer: D
int num;
string str = "555";
num = Integer.parseInt(str) + 5;
A) a value-returning method
B) a void method
C) a local variable
D) a complex method
Answer: A
34) You should always document a method by writing comments that appear:
A) just before the method's definition
B) just after the method's definition
C) at the end of the file
D) only if the method is more than five lines long
Answer: A
6
Copyright © 2016 Pearson Education, Inc.
35) When an argument value is passed to a method, the receiving parameter variable is:
A) declared within the body of the method
B) declared in the method header inside the parentheses
C) declared in the calling method
D) uses the declaration of the argument
Answer: B
36) If you attempt to use a local variable before it has been given a value:
A) a compiler error will occur
B) the local variable will always contain the value 0
C) the results will be unpredictable
D) the local variable will be ignored
Answer: A
int num;
string str = "555";
num = Integer.parseInt(string str) + 5;
A) num will be set to 560.
B) str will have a value of "560".
C) The last line of code will cause an error.
D) Neither num or str will be changed.
Answer: C
38) Given the following method header, which of the method calls would be an error?
39) Which of the following would be a valid method call for the following method?
7
Copyright © 2016 Pearson Education, Inc.
40) When writing the documentation comments for a method, you can provide a description of each
parameter by using a:
A) @comment tag
B) @doc tag
C) @param tag
D) @return tag
Answer: C
43) A value-returning method must specify this as its return type in the method header.
A) an int
B) a double
C) a boolean
D) any valid data type
Answer: D
45) To document the return value of a method, use this in a documentation comment.
A) The @param tag
B) The @comment tag
C) The @return tag
D) The @returnValue tag
Answer: C
8
Copyright © 2016 Pearson Education, Inc.
46) The process of breaking a problem down into smaller pieces is sometimes called:
A) divide and conquer
B) scientific method
C) top-down programming
D) whole-into-part
Answer: A
47) Any method that calls a method with a throws clause in its header must:
A) handle the potential exception
B) have the same throws clause
C) both of the above
D) do nothing, the called program will take care of the throws clause
Answer: C
48) Assume that the following method header is for a method in class A.
Assume that the following code segments appear in another method, also in class A. Which contains a
legal call to the displayValue method?
A) int x = 7;
void displayValue(x);
B) int x = 7;
displayValue(x);
C) int x = 7;
displayValue(int x);
D) int x = 7;
displayValue(x)
Answer: B
1) Methods are commonly used to break a problem into small manageable pieces.
Answer: TRUE
2) Two general categories of methods are void methods and value returning methods.
Answer: TRUE
3) In the method header, the method modifier public means that the method belongs to the class, not a
specific object.
Answer: FALSE
4) Constants, variables, and the values of expressions may be passed as arguments to a method.
Answer: TRUE
9
Copyright © 2016 Pearson Education, Inc.
6) You must have a return statement in a value-returning method.
Answer: TRUE
7) Any method that calls a method with a throws clause in its header must either handle the potential
exception or have the same throws clause.
Answer: TRUE
8) In the method header the static method modifier means the method is available to code outside the
class.
Answer: FALSE
10) No statement outside the method in which a parameter variable is declared can access the parameter
by its name.
Answer: TRUE
11) The expression in a return statement can be any expression that has a value.
Answer: TRUE
10
Copyright © 2016 Pearson Education, Inc.
Visit https://testbankbell.com
now to explore a rich
collection of testbank,
solution manual and enjoy
exciting offers!
Other documents randomly have
different content
“Hold on!” Brad stopped him. “These houses are
supposed to be locked. I had permission to take discs—
not to lead a mob through any of the buildings.”
Before Brad could stop him, the boy shoved open the [84]
door.
[85]
CHAPTER 9
A “Deserted” House
“Who was he, Brad?” Midge asked the Den Chief. “Not
the contractor?”
Mr. Hatfield noted a nearby sign which bore the name [87]
and telephone number of the contractor who had built
the dwellings.
“We?”
The land near the old house was ragged with frosted
stubble growth. Some distance away ran a tiny creek,
screened by reeds and rushes.
“It’s not the well that turns on a crank, bright boy!” Red [91]
laughed.
CHAPTER 10
Widow Jones
The other Cubs also were embarrassed, for they had not
intended to investigate an occupied dwelling.
“Since you live here alone, it might be well to lock your [95]
doors at night,” the Cub leader advised. “While the
fellow probably is harmless, one never knows.”
“Now you boys just come here whenever you like,” she
invited cordially. “Next time maybe I’ll have some
cookies handy in my jar. Growing boys always are
hungry. I know, because I had three of ’em. They’re
grown men now.”
The Cubs had spent more time than they had intended
exploring the countryside. With a glance at his watch,
Mr. Hatfield warned that they would have to walk briskly
if they were to reach home in time for supper.
Midge, Dan and Mr. Hatfield sat in the front with the
Den Dad. The others crowded into the rear, stowing
their collection of roofing discs at their feet.
[100]
CHAPTER 11
“Do Your Best”
“I can see that,” Mr. Holloway said dryly. “But you don’t
seem too happy. This is the time of your life when you
should be having a good time—playing football, ice
skating, all the sports.”
“No, Jack.”
“That’s a laugh!”
“Oh, sure!”
“New evidence?”
“Aren’t you the boy who found the box at the church?”
Captain Eggleston asked him.
“Yes, sir.”
[111]
CHAPTER 12
A Pair of Legs
“Absolutely nothing.”
“That is correct.”
“The first discovery that the box was gone was when
police arrived here?”
“That is correct.”
“My wife was here, of course. I don’t recall anyone else, [113]
unless one of the Cubs dropped in.”
“No woman?”
“You think the box may have been taken by a woman?” [114]
Mr. Hatfield asked in amazement.
“It was my fault for finding the box in the first place.”
“We ought to have the best Round Table of any of the [116]
Dens,” Dan declared, his enthusiasm at high pitch.
Mr. Merrimac, they both knew, was no fresh air fiend. [120]
Furthermore, the weather was far too cold for one
comfortably to keep a window wide open.
[121]
CHAPTER 13
Hot Biscuits
“Not a chance to catch him now,” Brad puffed. “Let’s call [122]
the police, and then go back to Merrimac’s place. He
may have slugged that old man.”
“Brad, didn’t you think that fellow looked like the tramp
we saw out near the marsh?”
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
testbankfan.com