Question: 1. Assume a program contains a function named displayGross(). When the computer processes the displayGross() functions return statement, _____. A. it removes the functions local
1. Assume a program contains a function named displayGross(). When the computer processes the displayGross() functions return statement, _____.
| A. | it removes the functions local variables (if any) from memory, then continues program execution with the statement immediately following the one that called the function | |
| B. | it removes the functions local variables(if any) from memory, then continues program execution with the statement that called the function | |
| C. | it removes the functions global variables (if any) from memory, then continues program execution with the statement immediately following the one that called the function | |
| D. | it removes the functions global variables (if any) from memory, then continues program execution with the statement that called the function |
2. Assume a variable named beginBalance appears in a functions parameterList. Which of the following statements is true?
| The beginBalance variable remains in memory until the computer processes the functions return statement. | ||
| The beginBalance variable is called a functional variable. | ||
| The beginBalance variable can be used anywhere in the program. | ||
| both A and B |
3. Assume a program contains three functions named main(), calcGross(), and displayGross(). Both the main() and calcGross() functions declare a variable named pay. The pay variable name also appears in the displayGross() function header. When the computer processes the statement pay = hours * rate; in the calcGross() function, it multiplies the contents of the hours variable by the contents of the rate variable, then _____.
| stores the result in the calcGross() functions pay variable | ||
| stores the result in the displayGross() functions pay variable | ||
| stores the result in the main() functions pay variable | ||
| displays an error message because you cant have three memory locations with the same name |
4. You use the _____ statement to initialize the random number generator in C++.
| init(int(time(0))); | ||
| rand(int(time(0))); | ||
| srand(int(time(0))); | ||
| none of the above |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
