Deck 6: Using Methods
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
Play
Full screen (f)
Deck 6: Using Methods
1
____ variables and constants are those that are known to an entire class.
A)Global
C)Universal
B)Local
D)Comprehensive
A)Global
C)Universal
B)Local
D)Comprehensive
A
2
In a flowchart, you draw the main() method and every other method separately with its own sentinel symbols.
True
3
A method's ____ includes the method identifier and possibly other necessary identifying information.
A)title
C)header
B)space
D)opener
A)title
C)header
B)space
D)opener
C
4
The three parts of a method are the method's header, the method's body, and the method's return statement.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
A method's ____ consists of the method's statements.
A)body
C)space
B)space
D)group
A)body
C)space
B)space
D)group
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
In every object-oriented programming language, the variables and constants declared in any method are usable anywhere within the program.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
Overloading a method is a good idea because it eliminates some programming work compared to writing separate methods.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
A method cannot be used more than once within a program or in other programs.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
Modularization provides ____.
A)ambiguity
C)detail focus
B)complexity
D)abstraction
A)ambiguity
C)detail focus
B)complexity
D)abstraction
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
Methods are sometimes called ____.
A)segments
C)classes
B)modules
D)routines
A)segments
C)classes
B)modules
D)routines
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
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
A)available
C)visible
B)identified
D)useable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
Most programming languages contain a variety of mathematical methods, such as those that compute a square root or the absolute value of a number.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
The more the statements contribute to the same job, the less the functional cohesion of the method.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
An argument can be passed into a method in two ways: by value and by reference.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
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
A)in line
C)out of scope
B)useable
D)in scope
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
You can pass an entire array to a method, or individual array element values.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
____ 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
A)Modularization
C)Portability
B)Reliability
D)Reusability
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
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
A)signature
C)formal
B)actual
D)recognized
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
One advantage of modularization is that it simplifies the ____.
A)functions
C)logic
B)arguments
D)subroutines
A)functions
C)logic
B)arguments
D)subroutines
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
You should avoid overloading a method with the same argument data types because this will create an ambiguous method that will not compile.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
An advantage of ____________________ is that multiple programmers can work on a large problem.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
The feature of modular programs that allows individual methods to be used in a variety of applications is known as ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
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
A)a place holder
C)parentheses
B)square brackets
D)curly brackets
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
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
A)local parameter name
C)parameter's client
B)global parameter name
D)return data structure
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
A method's name and parameter list constitute the method's ____.
A)identity
C)fingerprint
B)autograph
D)signature
A)identity
C)fingerprint
B)autograph
D)signature
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
Arrays are passed to a method by ____.
A)type
C)reference
B)class
D)value
A)type
C)reference
B)class
D)value
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
____________________ is the process of paying attention to important properties while ignoring nonessential details.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
If you declare variables and constants within the methods that use them, the methods are more ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
When you ____ a method, you write multiple methods with a shared name but different parameter lists.
A)redo
C)reload
B)repurpose
D)overload
A)redo
C)reload
B)repurpose
D)overload
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
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
A)ambiguous
C)vague
B)uncertain
D)unclear
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
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
A)return
C)case
B)data
D)variable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
Programmers refer to hidden implementation details as existing in a ____.
A)white box
C)black box
B)white hole
D)black hole
A)white box
C)black box
B)white hole
D)black hole
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
When a method returns a value, you usually want to use it in the ____ method.
A)working
C)return
B)current
D)calling
A)working
C)return
B)current
D)calling
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
A(n) ____________________ is a reasonable unit of programming, designed to tackle one small task at a time.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
The arguments sent to a method in a method call are often referred to as ____ parameters.
A)signature
C)formal
B)actual
D)recognized
A)signature
C)formal
B)actual
D)recognized
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
Simple non-array variables are usually passed to methods by ____.
A)value
C)type
B)reference
D)class
A)value
C)type
B)reference
D)class
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
Methods can be ____ correctly by providing different parameter lists for methods with the same name.
A)updated
C)overloaded
B)tested
D)passed
A)updated
C)overloaded
B)tested
D)passed
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
In most programming languages, you are allowed to include multiple ____ statements in a method.
A)return
C)back
B)end
D)depart
A)return
C)back
B)end
D)depart
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
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
A)implementation masking
C)method hiding
B)method masking
D)implementation hiding
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
A method can return nothing, which makes it a(n) ____ method.
A)empty
C)open
B)void
D)valid
A)empty
C)open
B)void
D)valid
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
When a method needs to use another method, it ____________________ that other method.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
____________________ variables are known to the entire class.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
Overloading a method is an example of ____________________, the ability of a method to act appropriately according to the context.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
When a method returns nothing, it is known as a(n) ____________________ method.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
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.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
When you pass an argument by ____________________, the method receives its own copy of the value.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
The method name and parameter list taken together form the ____________________ of the method.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
When a method receives an argument, it is stored as a(n) ____________________ in the method header.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
When a method's local variables go ____________________, they cease to exist, or die.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
When you create methods with the same name but with different parameter lists, those methods are known as ____________________.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck