Chapter 9: Advanced Modularization Techniques
TRUE/FALSE
1. You can invoke or call a method from another program or method.
ANS: T PTS: 1 REF: 371
2. When methods must share data, you can pass the data into and return the data out of methods.
ANS: T PTS: 1 REF: 373
3. A method could be called using any numeric value as an argument, whether it is a variable, a
named constant, or a literal constant.
ANS: T PTS: 1 REF: 378
4. Most programmers consciously make decisions about cohesiveness for each method they write.
ANS: F PTS: 1 REF: 405
5. Programs that use recursion are error-prone but easy to debug.
ANS: F PTS: 1 REF: 410
MULTIPLE CHOICE
1. The last statement in the body is a(n) ____.
a. begin statement c. exit statement
b. return statement d. end statement
ANS: B PTS: 1 REF: 371
2. Variables and constants are ____ within, or local to, only the method in which they are declared.
a. in scope c. out of scope
b. out of bounds d. limited
ANS: A PTS: 1 REF: 371
3. A calling method sends a(n) ____ to a called method.
a. parameter c. object
b. interface d. argument
ANS: D PTS: 1 REF: 374
4. A called method accepts the value of an argument passed to it as its ____.
a. parameter c. baseline
b. reference d. argument
ANS: A PTS: 1 REF: 374
, 5. You can think of the ____ in a method declaration as a funnel into the method.
a. braces c. parentheses
b. brackets d. commas
ANS: C PTS: 1 REF: 377
6. A variable passed into a method is passed by ____.
a. reference c. insinuation
b. inference d. value
ANS: D PTS: 1 REF: 378
7. Each time a method executes, any parameter variables listed in the method header are ____.
a. examined c. referenced
b. redeclared d. copied
ANS: B PTS: 1 REF: 378
8. The variables in the method declaration that accept the values from the actual parameters are ____
parameters.
a. defined c. formal
b. proper d. actual
ANS: C PTS: 1 REF: 379
9. When multiple parameters appear in a method header, they comprise a(n) ____.
a. parameter list c. action list
b. input list d. variable list
ANS: A PTS: 1 REF: 381
10. A method’s name and parameter list constitute the method’s ____.
a. header c. contract
b. interface d. signature
ANS: D PTS: 1 REF: 381
11. A method can return nothing, in which case the method is a ____ method.
a. null c. nul
b. void d. nil
ANS: B PTS: 1 REF: 382
12. Programmers use the term ____ to describe any extra time and resources required by an operation.
a. excess c. elegance
b. overhead d. cohesion
ANS: B PTS: 1 REF: 384
13. Arrays, unlike simple built-in types, are ____.
a. passed by deference c. passed by reference
b. passed by value d. passed by configuration
ANS: C PTS: 1 REF: 391
14. ____ is the ability of a method to act appropriately depending on the context.
a. Cohesion c. Integrity