Object Oriented Approach To Programming Logic and Design 4th Edition Joyce Farrell Test Bank
Object Oriented Approach To Programming Logic and Design 4th Edition Joyce Farrell Test Bank
TRUE/FALSE
1. A method cannot be used more than once within a program or in other programs.
2. The three parts of a method are the method’s header, the method’s body, and the method’s return
statement.
3. In a flowchart, you draw the main() method and every other method separately with its own sentinel
symbols.
4. The more the statements contribute to the same job, the less the functional cohesion of the method.
5. In every object-oriented programming language, the variables and constants declared in any method
are usable anywhere within the program.
6. An argument can be passed into a method in two ways: by value and by reference.
7. You can pass an entire array to a method, or individual array element values.
8. Overloading a method is a good idea because it eliminates some programming work compared to
writing separate methods.
9. You should avoid overloading a method with the same argument data types because this will create an
ambiguous method that will not compile.
10. Most programming languages contain a variety of mathematical methods, such as those that compute a
square root or the absolute value of a number.
MULTIPLE CHOICE
1. One advantage of modularization is that it simplifies the ____.
a. functions c. logic
b. arguments d. subroutines
ANS: C PTS: 1 REF: 205
4. ____ is the feature of programs and methods that assures you each has been tested and proven to
function correctly.
a. Modularization c. Portability
b. Reliability d. Reusability
ANS: B PTS: 1 REF: 207
5. A method’s ____ includes the method identifier and possibly other necessary identifying information.
a. title c. header
b. space d. opener
ANS: C PTS: 1 REF: 207
7. Programmers say that data items are ____ only after they have been declared and within the method in
which they are declared.
a. available c. visible
b. identified d. useable
ANS: C PTS: 1 REF: 213
8. Programmers say that variables and constants declared within a method are ____ only after declaration
within that method.
a. in line c. out of scope
b. useable d. in scope
ANS: D PTS: 1 REF: 213
9. ____ variables and constants are those that are known to an entire class.
a. Global c. Universal
b. Local d. Comprehensive
ANS: A PTS: 1 REF: 214
10. The variables in the method declaration that accept the values from the actual parameters are the ____
parameters.
a. signature c. formal
b. actual d. recognized
ANS: C PTS: 1 REF: 214
11. What is one item that must be included in a method’s header if it can receive a parameter?
a. local parameter name c. parameter’s client
b. global parameter name d. return data structure
ANS: A PTS: 1 REF: 218
12. With ____, you make a request to a method without knowing the details of how the method works.
a. implementation masking c. method hiding
b. method masking d. implementation hiding
ANS: D PTS: 1 REF: 220
14. The arguments sent to a method in a method call are often referred to as ____ parameters.
a. signature c. formal
b. actual d. recognized
ANS: B PTS: 1 REF: 214
15. A method’s name and parameter list constitute the method’s ____.
a. identity c. fingerprint
b. autograph d. signature
ANS: D PTS: 1 REF: 220
16. The ____ type for a method can be any type, which includes numeric, character, and string, as well as
other more specific types that exist in the programming language you are using.
a. return c. case
b. data d. variable
ANS: A PTS: 1 REF: 222
17. A method can return nothing, which makes it a(n) ____ method.
a. empty c. open
b. void d. valid
ANS: B PTS: 1 REF: 222
18. When a method returns a value, you usually want to use it in the ____ method.
a. working c. return
b. current d. calling
ANS: D PTS: 1 REF: 223
19. In most programming languages, you are allowed to include multiple ____ statements in a method.
a. return c. back
b. end d. depart
ANS: A PTS: 1 REF: 227
22. You can indicate that a method parameter must be an array by placing ____ after the data type in the
method’s parameter list.
a. a place holder c. parentheses
b. square brackets d. curly brackets
ANS: B PTS: 1 REF: 229
23. When you ____ a method, you write multiple methods with a shared name but different parameter
lists.
a. redo c. reload
b. repurpose d. overload
ANS: D PTS: 1 REF: 232
24. When you overload a method, you run the risk of creating ____ methods—a situation in which the
compiler cannot determine which method to use.
a. ambiguous c. vague
b. uncertain d. unclear
ANS: A PTS: 1 REF: 235
25. Methods can be ____ correctly by providing different parameter lists for methods with the same name.
a. updated c. overloaded
b. tested d. passed
ANS: C PTS: 1 REF: 237
COMPLETION
ANS: Abstraction
3. A(n) ____________________ is a reasonable unit of programming, designed to tackle one small task
at a time.
ANS:
module
procedure
subprocedure
function
subroutine
4. The feature of modular programs that allows individual methods to be used in a variety of applications
is known as ____________________.
ANS: reusability
5. If you declare variables and constants within the methods that use them, the methods are more
____________________.
ANS: portable
ANS: parameter
7. When you pass an argument by ____________________, the method receives its own copy of the
value.
ANS: value
ANS:
out of scope
out-of-scope
ANS: signature
10. The ____________________ type of a method indicates the data type of the value that the method will
send back to the location where the method call was made.
ANS: return
11. When a method needs to use another method, it ____________________ that other method.
ANS:
calls
invokes
ANS: Global
ANS: void
14. When you create methods with the same name but with different parameter lists, those methods are
known as ____________________.
ANS:
overloaded
overloaded methods
ANS: polymorphism