Module 3 Self Test
Given the following pseudocode, what is the value of score after the call to the curveScore module?Module main() Declare Integer myGrade = 93 Call curveScore(myGrade) End ModuleModule curveScore(Integer score) Declare Integer newScore Set newScore = score + 5 Display newScore Set score = 0 End Module
0
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 ModuleModule 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 ModuleModule curveScore(Integer score) Declare Integer newScore Set newScore = score + 5 Display newScore End Module
82
Given the following pseudocode, which is the argument?Module main() Call curveScore(82) End ModuleModule curveScore(Integer score) Declare Integer newScore Set newScore = score + 5 Display newScore End Module
82
To create a module, you write its ________.
Definition
A module can have two or more variables with the same name because they are within the same scope.
False
In most languages a module definition has three parts: a header, body, and footer.
False
The scope of the parameter variables is the entire program and they are visible to any statement in the program.
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.
False
Which of the following is not a benefit of using modules when developing a program?
Programs which contain modules always run faster than programs without modules.
Given the following pseudocode, what, if anything, is an error?Module main() Declare Integer myGrade = 93 Call curveScore(myGrade) End ModuleModule curveScore(Integer score) Declare Integer newScore Set newScore = score + 5 Display newScore Set myGrade = 0 End Module
The variable myGrade is not available inside the curveScore module.
A hierarchy chart does not reveal details of the steps taken inside the module.
True
An attempt to pass a non-variable argument into a reference variable parameter will cause an error.
True
Modules can be written for commonly needed tasks, and those modules can be incorporated into each program that needs them.
True
The arguments in a module call and the parameters listed in the module header must be of compatible data types.
True
The scope of a variable is the segment of the program in which the variable can be accessed.
True
The top-down design process is sometimes referred to as stepwise refinement.
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.
True
Which of the following would a programmer use to visualize the relationship between modules?
a hierarchy chart
Modules may also be called ________.
any of thesehendri
A module definition consists of the module header and the module ________.
body
To execute a module, you must ________.
call it
Modules make it impossible for programmers to work in teams.
false
Another name for a module is a(n) ________.
function
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
The ________ is the first line of a module definition.
header
A ________ is a variable that receives an argument which is passed to a module.
parameter
In a flowchart, a module call is represented by a(n) ________ symbol with vertical bars at each side.
rectangle
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
Given the following pseudocode, which is the parameter?Module main() Call curveScore(82) End ModuleModule curveScore(Integer score) Declare Integer newScore Set newScore = score + 5 Display newScore End Module
score
An argument that is passed by ________ is not affected by a change to the content of the parameter variable.
value
When an argument is passed by ________, only a copy of the argument's value is passed into the parameter variable
value