Full Download Starting Out With Java From Control Structures Through Objects 6th Edition Gaddis Test Bank All Chapter 2024 PDF
Full Download Starting Out With Java From Control Structures Through Objects 6th Edition Gaddis Test Bank All Chapter 2024 PDF
Full Download Starting Out With Java From Control Structures Through Objects 6th Edition Gaddis Test Bank All Chapter 2024 PDF
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/starting-out-with-java-from-
control-structures-through-objects-5th-edition-tony-gaddis-test-
bank/
Starting Out with Java From Control Structures through
Objects 5th Edition Tony Gaddis Solutions Manual
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-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/
https://testbankfan.com/product/starting-out-with-java-from-
control-structures-through-data-structures-2nd-edition-gaddis-
solutions-manual/
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.
Another random document with
no related content on Scribd:
Molemmat ovat he sinisilmäisiä ja solakoita, ja mies näyttää naiselle
Kautisen ja Kulhian, jonka puistokujaa jo on ruvettu harventamaan.
*****
"Mitä isäntä siinä. Kyllä minä osaan tämän asian itsekin huoltaa."
"En minä hönössä ole… tuota… Niin että avaahan nyt ja aika
kyytiä."
"Mitä te täältä keskellä yötä haette. Piruko teitä ajattaa?"
*****
Siinä oli Kulhian kartanon uusi vaihe, joka ensin herätti puheita,
mutta joka lopultakin, hiljaa ja varmasti syöpyi ihmisten tajuntaan.
Uusi aika, uudet meiningit. Ja mikäli tarina Kulhian tyttärestä ja
Kautisten pojasta unohtuu, sikäli kasvaa tarina Kulhian uudesta
isännästä ja emännästä, jotka, niinkuin heistä varmaankin kerran
kirjoitetaan "työllä ja vaivalla olivat saavuttaneet yleisen
kunnioituksen ja varman taloudellisen aseman".
*** END OF THE PROJECT GUTENBERG EBOOK SYKSYÄ JA
RAKKAUTTA ***
Updated editions will replace the previous one—the old editions will
be renamed.
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.
1.F.4. Except for the limited right of replacement or refund set forth in
paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.
Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.
Most people start at our website which has the main PG search
facility: www.gutenberg.org.