Quiz 6
Given the following function definition void calc (int a, int& b) { int c; c = a + 2; a = a * 3; b = c + a; } What is the output of the following code fragment that invokes calc? (All variables are of type int) x = 1; y = 2; z = 3; calc(x, y); cout << x << " " << y << " " << z << endl;
1 6 3
What is the output of the following program? #include <iostream> using namespace std; int getValue(int); int main() { int x = 2; cout << getValue(x) << endl; return 0; } int getValue(int num) { return num + 5; }
7
A function __________ contains the statements that make up the function
definition
This is a collection of statements that performs a specific task.
function
This type of variable is defined inside a function and is not accessible outside the function.
local
A function can have zero to many parameters, and it can return this many values.
only one
A function __________ eliminates the need to place a function definition before all calls to the function.
prototype
When used as parameters, these types of variables allow a function to access the parameter's original argument.
reference
This statement causes a function to end.
return
The value in this type of local variable persists between function calls.
static