Chapter 6 Quiz - Functions
A(n) _________ is information that is passed to a function, and a(n) _________ is information that is received by a function.
argument, parameter
A function is executed when it is
called
Here is the header for a function named computeValue: void computeValue(int value) Which of the following is a valid call to the function?
computeValue(10);
Look at the following function prototype. int myFunction(double); What is the data type of the funtion's return value?
int
Look at the following function prototype. int myFunction(double, double, double); How many parameter variables does this function have?
3
What is the output of the following program? #include <iostream> using namespace std; void showDub(int); int main() { int x = 2; showDub(x); cout << x << endl; return 0; } void showDub(int num) { cout << (num * 2) << endl; }
4 2
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's return data type must be the same as the function's parameter(s).
False
A parameter is a special-purpose variable that is declared inside the parentheses of a function definition.
True
One reason for using functions is to break programs into manageable units, or modules.
True