Chapter 6 quiz c++
Which line in the following program contains a call to the showDub function? #include <iostream> using namespace std; 3 void showDub (int) ; int main () 5 int x = 2: showDub (x): cout << x << endl; return 0; 10 11 void showDub (int num) 12 13 cout << (num * 2) << endl; 14
Iine 7
These types of arguments are passed to parameters automatically if no argument is provided in the function call.
O default
variable is declared outside all functions.
global
What is the data type of the following function prototype's return value? int myFunction (double); ect!
int
A function eliminates the need to place a function definition before all calls to the function.
prototype
This is a dummy function that is called instead of the actual function it represents:
stub
Given the following function: void calc (int a, int& b) int c; C = a + 2; à = a * 3; b = c + a; What is the output of the following code segment that invokes calc(): int x = 1; int y 2: int z = 3; calc(x, y): cout << x << " " << y << " 11 << z << endl;
1 63
What will the following code display? #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 will the following code display? #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
Which line in the following program contains the prototype showDub function? #include <iostream> 2 using namespace std; void showDub (int) ; int main () int x = 2; showDub (x): cout << x << endl; 9. return 0: 10 11 void showDub (int num) 12 { 13 cout << (num * 2) < endl: 14
Ilne 3
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
Select all that apply. Which of the following statement(s) about global variables is(are) TRUE?
Aglobal variable can have the same name as a variable that is declared locally within a function.
A function's return data type must be the same as the function's parameters.
False
functions may have the same name as long as their parameter lists are different.
O Two or more
Given the following header for a function named computeValue, which of the following is a valid call to the function? void computeValue (int value)
O computeValue (10);
A function. contains the statements that make up the function.
definition
A value returning function can have no parameters, one parameter, or many parameters and can return value(s).
only one
The value in this type of variable persists between function calls.
static
The value in a. variable persists between function calls.
static local