Deck 6: Using Methods

Full screen (f)
exit full mode
Question
Programmers often say that a method's implementation details are hidden in a(n)____.

A) black box
B) secret box
C) trap door
D) invisible box
Use Space or
up arrow
down arrow
to flip the card.
Question
____ is the feature of programs that assures you a module has been tested and proven to function correctly.

A) Reusability
B) Consistency
C) Reliability
D) Credibility
Question
____ means paying attention to important properties while ignoring nonessential details.

A) Abstraction
B) Hiding
C) Oversight
D) Complicating
Question
The modular nature of structured programs means that work can be divided among many programmers.
Question
____ is the encapsulation of method details.

A) Abstraction
B) Templating
C) Implementation hiding
D) Generalization
Question
A declaration for a method that receives two or more arguments can list the type for each parameter together if they are the same type.
Question
With implementation hiding,when you make a request to a method,you only know the details of how the method is executed.
Question
Creating submethods makes the calling method's logic more concise,easier to read,and somewhat easier to identify as structured.
Question
A method's return statement can return one value at most.
Question
The calling method needs to understand only the ____ to the method that is called.

A) input
B) connection
C) border
D) interface
Question
A method's ____ includes the method identifier and possibly other identifying information.

A) header
B) body
C) declaration
D) return
Question
To execute a method,you invoke it or ____ it from another program or method.

A) call
B) translate to
C) command
D) transfer to
Question
Visual Basic programmers use the term "methods" to name their modules.
Question
In daily life,using a low-level,abstract list of chores makes your day manageable.
Question
C++ programmers use "____" to name their modules.

A) subroutine
B) function
C) procedure
D) method
Question
A method's return type is part of its signature.
Question
A program that calls methods might take slightly longer to execute because it takes time for a program to store the locations to which the logic must return when each method is finished.
Question
In most circumstances,you should not declare global variables and constants.
Question
The process of breaking down a large program into modules is called ____.

A) decomposition
B) isolation
C) modularization
D) compartmentalization
Question
The feature of modular programs that allows individual modules to be used in a variety of applications is known as ____.

A) reusability
B) readability
C) reliability
D) consistency
Question
When you place a value in a(n)____ statement,the value is sent from the called method back to the calling method.

A) return
B) expel
C) send
D) value
Question
When a method returns nothing it is known as a(n)____ method.

A) empty
B) void
C) blank
D) null
Question
Along with an identifier and parameter list,a return type is part of a method's ____.

A) profile
B) header
C) signature
D) declaration
Question
Programmers use the term ____ to describe any extra time and resources required by an operation.

A) overage
B) overhead
C) overburden
D) excess
Question
A method's ____ contains all the statements in the method.

A) header
B) body
C) declaration
D) return
Question
The computer keeps track of the correct memory address to which it should return after executing a method by recording the memory address in a location known as the ____.

A) queue
B) stack
C) heap
D) accumulator
Question
When two or more methods in a program require access to the same data,you ___ the data from one method to another.

A) text
B) manage
C) define
D) pass
Question
The variables in the method declaration that accept the values from the actual parameters are the ____ parameters.

A) formal
B) declared
C) instantiated
D) real
Question
Methods are considered ____,that is,they can more easily be transported to and reused by multiple programs when variables and constants are declared within the methods that use them.

A) efficient
B) moveable
C) reliable
D) portable
Question
A method's name and parameter list constitute the method's ____.

A) header
B) profile
C) signature
D) outline
Question
Variables and constants declared within a method are ____ only within that method.

A) in vision
B) in range
C) in scope
D) in group
Question
The scope of a variable or constant is ____ to the method or program in which it is declared.

A) global
B) local
C) public
D) private
Question
The more the statements in a method contribute to the same job,the greater the ____ of the method.

A) strength
B) functional adhesion
C) functional coupling
D) functional cohesion
Question
All modern programming languages contain many built-in,prewritten ____ to save time and effort.

A) routines
B) variable
C) methods
D) programs
Question
Programmers say the data items are ____ only within the method or program in which they are declared.

A) visible
B) public
C) readable
D) available
Question
The arguments sent to a method in a method call are often referred to as ____ parameters.

A) formal
B) declared
C) instantiated
D) actual
Question
When multiple parameters appear in a method header,they compose a(n)____ list.

A) input
B) method
C) informal
D) parameter
Question
In many environments,collections of pre-written methods are called ____.

A) templates
B) libraries
C) foundations
D) packages
Question
In a program,when you send a value to a method,you send a(n)____ to the method.

A) variable
B) parameter
C) argument
D) key
Question
____ variables and constants are those that are known to the entire program.

A) Global
B) Local
C) Universal
D) Portable
Question
There is a method with the header: void printData(num x,string y).There is a declared numeric variable: test.Which of the following is a correct method call?

A) printData(test)
B) printData(test,"Good")
C) printData("Good",test)
D) printData("Good","Best")
Question
When a method accepts multiple arguments,does it matter what order the arguments are passed in?
Question
List two occasions when you might consider declaring variables and constants globally.
Question
The following pseudocode is not working correctly.The code should multiply price and tax,and display the result.What code needs to be corrected? computeArea(num width,num length)
Declarations
Num result
Width * length
Output "The area is " result
Return

A) Change the return statement to
Return result
B) Change the result initialization to
Num result = width * length
C) Change the return statement to
Return output
D) Change the output line to
Output = width * length
Question
The following pseudocode is not working correctly. What code needs to be corrected? This is the call to the method: displayName()
And this is the method:
DisplayName(string name)
Output "My name is " name
Return

A) Change the method call to
DisplayName("Sean")
B) Change the method call to
DisplayName(Sean)
C) Change the return statement to
Return output
D) Change the return statement to
Return name
Question
The following pseudocode is not working correctly.The code should add price and tax.What code needs to be corrected? num computeSum(num price,num tax)
Declarations
Num result
Result = price + tax
Return

A) Change the result calculation to
Result = tax + price
B) Change the result calculation to
Result = (price + tax)
C) Change the return statement to
Return num
D) Change the return statement to
Return result
Question
There is a method with the header: void printData(num x,string y). There is a declared a numeric variable: test. What does this method return?

A) a numeric and a string variable
B) test
C) nothing
D) it depends on the parameters
Question
Write the pseudocode for the method named computeSum.The method should return a numeric value: result.The method should have two numeric parameters: amount1 and amount2. result is equal to the sum of amount1 and amount2.
Question
What is the difference between an argument and a parameter variable?
Question
Write the pseudocode for the method named computeArea.The method should display "The area is " and numeric value: result.It should have two numeric parameters: width and length.width multiplied by length is equal to result.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/50
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 6: Using Methods
1
Programmers often say that a method's implementation details are hidden in a(n)____.

A) black box
B) secret box
C) trap door
D) invisible box
A
2
____ is the feature of programs that assures you a module has been tested and proven to function correctly.

A) Reusability
B) Consistency
C) Reliability
D) Credibility
C
3
____ means paying attention to important properties while ignoring nonessential details.

A) Abstraction
B) Hiding
C) Oversight
D) Complicating
A
4
The modular nature of structured programs means that work can be divided among many programmers.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
5
____ is the encapsulation of method details.

A) Abstraction
B) Templating
C) Implementation hiding
D) Generalization
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
6
A declaration for a method that receives two or more arguments can list the type for each parameter together if they are the same type.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
7
With implementation hiding,when you make a request to a method,you only know the details of how the method is executed.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
8
Creating submethods makes the calling method's logic more concise,easier to read,and somewhat easier to identify as structured.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
9
A method's return statement can return one value at most.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
10
The calling method needs to understand only the ____ to the method that is called.

A) input
B) connection
C) border
D) interface
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
11
A method's ____ includes the method identifier and possibly other identifying information.

A) header
B) body
C) declaration
D) return
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
12
To execute a method,you invoke it or ____ it from another program or method.

A) call
B) translate to
C) command
D) transfer to
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
13
Visual Basic programmers use the term "methods" to name their modules.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
14
In daily life,using a low-level,abstract list of chores makes your day manageable.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
15
C++ programmers use "____" to name their modules.

A) subroutine
B) function
C) procedure
D) method
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
16
A method's return type is part of its signature.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
17
A program that calls methods might take slightly longer to execute because it takes time for a program to store the locations to which the logic must return when each method is finished.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
18
In most circumstances,you should not declare global variables and constants.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
19
The process of breaking down a large program into modules is called ____.

A) decomposition
B) isolation
C) modularization
D) compartmentalization
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
20
The feature of modular programs that allows individual modules to be used in a variety of applications is known as ____.

A) reusability
B) readability
C) reliability
D) consistency
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
21
When you place a value in a(n)____ statement,the value is sent from the called method back to the calling method.

A) return
B) expel
C) send
D) value
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
22
When a method returns nothing it is known as a(n)____ method.

A) empty
B) void
C) blank
D) null
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
23
Along with an identifier and parameter list,a return type is part of a method's ____.

A) profile
B) header
C) signature
D) declaration
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
24
Programmers use the term ____ to describe any extra time and resources required by an operation.

A) overage
B) overhead
C) overburden
D) excess
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
25
A method's ____ contains all the statements in the method.

A) header
B) body
C) declaration
D) return
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
26
The computer keeps track of the correct memory address to which it should return after executing a method by recording the memory address in a location known as the ____.

A) queue
B) stack
C) heap
D) accumulator
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
27
When two or more methods in a program require access to the same data,you ___ the data from one method to another.

A) text
B) manage
C) define
D) pass
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
28
The variables in the method declaration that accept the values from the actual parameters are the ____ parameters.

A) formal
B) declared
C) instantiated
D) real
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
29
Methods are considered ____,that is,they can more easily be transported to and reused by multiple programs when variables and constants are declared within the methods that use them.

A) efficient
B) moveable
C) reliable
D) portable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
30
A method's name and parameter list constitute the method's ____.

A) header
B) profile
C) signature
D) outline
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
31
Variables and constants declared within a method are ____ only within that method.

A) in vision
B) in range
C) in scope
D) in group
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
32
The scope of a variable or constant is ____ to the method or program in which it is declared.

A) global
B) local
C) public
D) private
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
33
The more the statements in a method contribute to the same job,the greater the ____ of the method.

A) strength
B) functional adhesion
C) functional coupling
D) functional cohesion
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
34
All modern programming languages contain many built-in,prewritten ____ to save time and effort.

A) routines
B) variable
C) methods
D) programs
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
35
Programmers say the data items are ____ only within the method or program in which they are declared.

A) visible
B) public
C) readable
D) available
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
36
The arguments sent to a method in a method call are often referred to as ____ parameters.

A) formal
B) declared
C) instantiated
D) actual
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
37
When multiple parameters appear in a method header,they compose a(n)____ list.

A) input
B) method
C) informal
D) parameter
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
38
In many environments,collections of pre-written methods are called ____.

A) templates
B) libraries
C) foundations
D) packages
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
39
In a program,when you send a value to a method,you send a(n)____ to the method.

A) variable
B) parameter
C) argument
D) key
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
40
____ variables and constants are those that are known to the entire program.

A) Global
B) Local
C) Universal
D) Portable
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
41
There is a method with the header: void printData(num x,string y).There is a declared numeric variable: test.Which of the following is a correct method call?

A) printData(test)
B) printData(test,"Good")
C) printData("Good",test)
D) printData("Good","Best")
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
42
When a method accepts multiple arguments,does it matter what order the arguments are passed in?
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
43
List two occasions when you might consider declaring variables and constants globally.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
44
The following pseudocode is not working correctly.The code should multiply price and tax,and display the result.What code needs to be corrected? computeArea(num width,num length)
Declarations
Num result
Width * length
Output "The area is " result
Return

A) Change the return statement to
Return result
B) Change the result initialization to
Num result = width * length
C) Change the return statement to
Return output
D) Change the output line to
Output = width * length
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
45
The following pseudocode is not working correctly. What code needs to be corrected? This is the call to the method: displayName()
And this is the method:
DisplayName(string name)
Output "My name is " name
Return

A) Change the method call to
DisplayName("Sean")
B) Change the method call to
DisplayName(Sean)
C) Change the return statement to
Return output
D) Change the return statement to
Return name
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
46
The following pseudocode is not working correctly.The code should add price and tax.What code needs to be corrected? num computeSum(num price,num tax)
Declarations
Num result
Result = price + tax
Return

A) Change the result calculation to
Result = tax + price
B) Change the result calculation to
Result = (price + tax)
C) Change the return statement to
Return num
D) Change the return statement to
Return result
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
47
There is a method with the header: void printData(num x,string y). There is a declared a numeric variable: test. What does this method return?

A) a numeric and a string variable
B) test
C) nothing
D) it depends on the parameters
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
48
Write the pseudocode for the method named computeSum.The method should return a numeric value: result.The method should have two numeric parameters: amount1 and amount2. result is equal to the sum of amount1 and amount2.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
49
What is the difference between an argument and a parameter variable?
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
50
Write the pseudocode for the method named computeArea.The method should display "The area is " and numeric value: result.It should have two numeric parameters: width and length.width multiplied by length is equal to result.
Unlock Deck
Unlock for access to all 50 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 50 flashcards in this deck.