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://testbankdeal.com/product/starting-out-with-java-from-
control-structures-through-objects-6th-edition-gaddis-test-bank/
https://testbankdeal.com/product/starting-out-with-java-from-control-
structures-through-objects-6th-edition-gaddis-solutions-manual/
https://testbankdeal.com/product/starting-out-with-java-from-control-
structures-through-objects-7th-edition-gaddis-test-bank/
https://testbankdeal.com/product/starting-out-with-java-from-control-
structures-through-objects-7th-edition-gaddis-solutions-manual/
https://testbankdeal.com/product/corporate-partnership-estate-and-
gift-taxation-2013-7th-edition-pratt-solutions-manual/
Macroeconomics 15th Edition McConnell Test Bank
https://testbankdeal.com/product/macroeconomics-15th-edition-
mcconnell-test-bank/
https://testbankdeal.com/product/college-accounting-a-contemporary-
approach-3rd-edition-haddock-solutions-manual/
https://testbankdeal.com/product/financial-accounting-canadian-5th-
edition-harrison-test-bank/
https://testbankdeal.com/product/business-law-in-canada-canadian-11th-
edition-yates-test-bank/
https://testbankdeal.com/product/personal-finance-canadian-3rd-
edition-madura-test-bank/
CISSP Guide to Security Essentials 2nd Edition Gregory
Solutions Manual
https://testbankdeal.com/product/cissp-guide-to-security-
essentials-2nd-edition-gregory-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.
Visit https://testbankdead.com
now to explore a rich
collection of testbank,
solution manual and enjoy
exciting offers!
Random documents with unrelated
content Scribd suggests to you:
— Kestää! Mutta maahan on jo alkanut laskea; te asetatte parruja
kahden metrin päähän toinen toisestaan, ei aina sitäkään. Oh, te
olette kaikki samallaisia. Te tahdotte mieluummin, että niskanne
vääntyisi nurin, mutta ette voi jättää hiiliä, pystyttääksenne riittävästi
kannattimia! Korjatkaa heti kaikki. Pankaa kannattimia kaksi kertaa
useampia, kuuletteko?
Kun hän oli mennyt, niin ei Maheukaan enää voinut hillitä itseään:
Tällä kertaa oli hevonen suurta kokoa, niin että sitoessa oli
täytynyt vetää sen pää sivulle, jottei se sattuisi seinään. Laskeminen
jatkui kolme minuuttia, sitä hidastutettiin tahalla. Mutta alhaalla
kasvoi levottomuus. Oliko se jätetty keskelle tietä sinne pimeyteen?
Vihdoin näyttäytyi se liikkumattomana kauhusta laajennetuin silmin.
Se oli kolmevuotias ruuna, nimeltä Trompette.
— Hiljaa! — sanoi Mouque. Hänen toimenaan oli ottaa hevonen
vastaan.
— Tuokaa se tänne, mutta älkää irroittako siteistä.
Sitä alettiin irroittaa, kun Bataille hitaasti saapui sen luo. Se oli
juuri riisuttu valjaista ja se jo etäältä kurotti kaulaansa,
haistellakseen tuota uutta toveria, joka äkkiä oli pudonnut maan
päältä. Työmiehet väistyivät hohottaen. No haisiko se hyvältä? Mutta
Bataille ei kuullut heidän pilkkasanojaan, se vilkastui yhä enemmän.
Uusi tulokas oli varmaankin tuonut mukanaan raittiin ilman tuoksua,
unohdetun auringon ja ruohon tuoksua. Äkkiä hirnahti se kuuluvasti
ja sen äänessä kuului iloa ja ikäänkuin tukahdutettua itkua. Se oli
tervehdys toverille, joka hetkeksi oli herättänyt kaikki nuo unohdetut
asiat ja se oli säälin ilmaisua uutta vankia kohtaan, joka vasta
kuolleena palaisi ylös.
Se oli tilava vaja, missä ilmassa oli aina mustan pölyn pilviä ja
jonka suurista ikkunoista veti alituisesti. Hiilirattaat ajettiin sinne
suoraan vastaanotto-osastosta. Siellä ne kaadettiin kumoon
suppiloihin, jotka olivat varustetut pitkillä uurroksilla. Uurrosten
kummallakin puolen seisoivat korokkeella naislajittelijat lapioineen ja
haravoineen, valitsivat kivet ja puhtaat hiilet työnsivät uurrosta
myöten vaunuihin, jotka seisoivat kiskoilla vajassa.
— Eipähän liene.
Uusi ryhmä työläisiä kulki heitä vastaan. Se oli kello kolmen vuoro.
Tällä kertaa kaivos nieli vielä suuremman joukon kivihiilenkaivajia,
joitten tehtävä oli rakentaa ja alottaa uusia murtopaikkoja. Työt
kaivoksessa eivät koskaan tauonneet: yöt päivät myyrästi siinä
ihmisiä kuudensadan metrin syvyydessä valkojuurikaspeltojen alla.
Tyttö kiersi hanaa ja vastasi, että hän pian palaa. Maheu joi
yhteen vetoon puolet tuoppia huuhtoakseen hiilipölyn, joka oli
tarttunut hänen kurkkuunsa. Hän ei tarjonnut mitään toverilleen.
Paitsi heitä oli ravintolassa vielä yksi vieras, samallainen likanen ja
hiestynyt hiilenkaivaja, joka joi oluensa äänettömänä ajatuksissaan.
Pistäysi vielä yksi työmies, joka joi tilaamansa oluen ja meni
sanomatta sanaakaan.
Hänestä tuntui, että jo oli kulunut vuosia siitä kun hän oli
saapunut tänne tuulen pauhatessa ja sitten ryöminyt nelinkontin
maanalaisissa käytävissä. Oli sietämätöntä ajatella, että täytyisi taas
alottaa kaikki uudelleen, se oli liian raskasta, se oli väärin. Hänen
inhimillinen itsetietoisuutensa kiihottui ajatellessa, että täytyisi
muuttua sokeaksi ja sorretuksi eläimeksi.
testbankdeal.com