Quiz5-Modules Flashcards
Modules make it impossible for programmers to work in teams: (T/F)
False
The “Top-Down” design process is sometimes referred to as “Stepwise Refinement.” (T/F)
True
A module can have two or more variables with the SAME name because they are within the same scope. (T/F)
False
The scope of a variable is the segment of the program in which the variable can be accessed. (T/F)
True
The arguments in a module call and the parameters listed in the module header must be of a compatible data type. (T/F)
True
The scope of the parameter variables is the entire program and they are visible to any statement in the program. (T/F)
False
When a variable is passed by value, changes to that argument made within the module also affect the value of the variable in the part of the program that made the call to that module.(T/F)
False
A hierarchy chart does not reveal details of the steps taken inside the module.(T/F)
True
When a variable is passed by reference to a module, changes to the value of the argument in the module will also affect the variable in the part of the program that sent that argument.(T/F)
True
An attempt to pass a non-variable argument into a reference variable parameter will cause an error.(T/F)
True
Modules can be written for commonly needed tasks, and those modules can be incorporated into each program that needs them.(T/F)
True
In most languages, a module definition has three parts: a header, body, & footer.(T/F)
False: (header & body)
Which of the following is NOT a benefit of using modules when developing a program?
A) They make program development faster
B) Module code can be reused
C) They make Programs easier to debug
D) Programs which contain modules always run faster than programs without modules
D) Programs which contain modules always run faster than programs without modules: not necessarily true while A,B,C are always true
A module definition consists of the module header and the module….
Body
In a flowchart, a module call is repersented by a(n)__________ symbol with vertical bars at each side.
Rectangle
What would a programmer use to visualize the relationship between modules?
a hierarchy chart
A _________ is a variable that RECIEVES AN ARGUMENT which is passed to a module
parameter
When an argument is passed by ________, only a COPY of the argument’s VALUE is passed into the parameter variable.
value
When an argument is passed by __________, the parameter receives the address of the argument so BOTH THE ARGUMENT AND THE PARAMETER point to the same memory location.
reference
A _______ variable is visible to every module AND the entire program.
global
the use of ___________ variables MAY make programs hard to understand and debug.
global
An argument that is passed by _________ is NOT affected by a change to the content of the parameter variable.
value: (bc its a copy i’m assuming)
Another name for a module is a(n)__________.
function
Modules may also be called…..
A) Procedures
B) Subroutines
C) Subprograms
D) Methods
E) None of These
F) Any of These
F) Any of These:
Procedures, subroutines, subprograms, and methods
To create a module, you write its ______________.
definition: a module definition is a statement “Define” or “def” and “Call” in pseudocode
To execute a module, you must ___________.
Call it
The __________ is the first line of a module definition.
header
Given the following pseudocode, which is the argument?
Module main()
Call curveScore(82)
End Module
Module curveScore(Integer score)
Declare Integer newScore
Set newScore= score + 5
Display newScore
End Module
82: bc arguments are always passed as a variable thru the call
Given the following pseudocode, which is the parameter?
Module main()
Call curveScore(82)
End Module
Module curveScore(Integer score)
Declare Integer newScore
Set newScore= score + 5
Display newScore
End Module
score: bc module curvescore is being defined using a variable named score
Given the following pseudocode, what is the value of myGrade after the call to the curveScore module?
Module main()
Declare Integer myGrade
Set myGrade = 82
Call curveScore(myGrade)
End Module
Module curveScore(Integer score)
Declare Integer newScore
Set newScore= score + 5
Display newScore
End Module
82
Given the following pseudocode, what is the value of the score after the call to the curveScore module?
Module main()
Declare Integer myGrade
Set myGrade = 82
Call curveScore(myGrade)
End Module
Module curveScore(Integer score)
Declare Integer newScore
Set newScore= score + 5
Display newScore
End Module
82
Given the following pseudocode, what is the value of score after the call to the curveScore module?
Module main()
Declare Integer myGrade
Set myGrade = 82
Call curveScore(myGrade)
End Module
Module curveScore(Integer score)
Declare Integer newScore
Set newScore= score + 5
Display newScore
Set score = 0
End Module
0
Given the following pseudocode, what if anything, as an error?
Module main()
Declare Integer myGrade = 93
Call curveScore(myGrade)
End Module
Module curveScore(Integer score)
Declare Integer newScore
Set newScore = score + 5
Display newScore
Set myGrade = 0
End Module
A) The variable score has not been intialized
B) The variable myGrade is not available inside the curveScore module
C) The curveScore module should recieve a variable named score, not MyGrade
D) There are no errors
B) The variable myGrade is not available inside the curveScore module