EOC STUDY GUIDE PT.2
Functions
1. A collection of statements that performs a specific task is a(n)
a. infinite loop
b. variable
c. constant
d. function
e. decision
2. A function __________ contains the statements that make up the function.
a. prototype
b. definition
c. call
d. expression
e. parameter list
3. A function can have no parameters, one parameter, or many parameters and can return
__________ value(s).
a. zero to many
b. no
c. only one
d. a maximum of ten
e. None of these
4. A function is executed when it is
a. defined
b. prototyped
c. declared
d. called
e. None of these
5. This type of variable is defined inside a function and is not accessible outside the
function.
a. global
b. reference
c. local
d. counter
, e. None of these
6. The value in this type of variable persists between function calls.
a. global
b. internal
c. static
d. dynamic
e. None of these
7. When used as parameters, these types of variables allow a function to access the
parameter's original argument:
a. reference
b. floating-point
c. counter
d. undeclared
e. None of these
8. __________ functions may have the same name as long as their parameter lists are
different.
a. Only two
b. Two or more
c. No
d. Un-prototyped
e. None of these
9. This statement causes a function to end.
a. end
b. terminate
c. return
d. release
e. None of these
10. A function _________ eliminates the need to place a function definition before all calls to
the function.
a. header
b. prototype
c. argument
d. parameter
e. None of these
, 11. If a function is called more than once in a program, the values stored in the function's
local variables do not _________ between function calls.
a. persist
b. execute
c. communicate
d. change
e. None of these
12. If a function does not have a prototype, default arguments may be specified in the
__________.
a. function call
b. function header
c. execution
d. return type
e. None of these
13. Given the following function:
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 segment that invokes calc():
int x = 1;
int y = 2;
int z = 3;
calc(x, y);
cout << x << " " << y << " " << z << endl;
a. 1 2 3
b. 1 6 3
c. 3 6 3
d. 1 14 9
e. 2 3 4 5
14. What will the following code display?
#include <iostream>
using namespace std;
void showDub(int);
int main()
{int x = 2;
Functions
1. A collection of statements that performs a specific task is a(n)
a. infinite loop
b. variable
c. constant
d. function
e. decision
2. A function __________ contains the statements that make up the function.
a. prototype
b. definition
c. call
d. expression
e. parameter list
3. A function can have no parameters, one parameter, or many parameters and can return
__________ value(s).
a. zero to many
b. no
c. only one
d. a maximum of ten
e. None of these
4. A function is executed when it is
a. defined
b. prototyped
c. declared
d. called
e. None of these
5. This type of variable is defined inside a function and is not accessible outside the
function.
a. global
b. reference
c. local
d. counter
, e. None of these
6. The value in this type of variable persists between function calls.
a. global
b. internal
c. static
d. dynamic
e. None of these
7. When used as parameters, these types of variables allow a function to access the
parameter's original argument:
a. reference
b. floating-point
c. counter
d. undeclared
e. None of these
8. __________ functions may have the same name as long as their parameter lists are
different.
a. Only two
b. Two or more
c. No
d. Un-prototyped
e. None of these
9. This statement causes a function to end.
a. end
b. terminate
c. return
d. release
e. None of these
10. A function _________ eliminates the need to place a function definition before all calls to
the function.
a. header
b. prototype
c. argument
d. parameter
e. None of these
, 11. If a function is called more than once in a program, the values stored in the function's
local variables do not _________ between function calls.
a. persist
b. execute
c. communicate
d. change
e. None of these
12. If a function does not have a prototype, default arguments may be specified in the
__________.
a. function call
b. function header
c. execution
d. return type
e. None of these
13. Given the following function:
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 segment that invokes calc():
int x = 1;
int y = 2;
int z = 3;
calc(x, y);
cout << x << " " << y << " " << z << endl;
a. 1 2 3
b. 1 6 3
c. 3 6 3
d. 1 14 9
e. 2 3 4 5
14. What will the following code display?
#include <iostream>
using namespace std;
void showDub(int);
int main()
{int x = 2;