
Function questions
1. A function parameter is local to the entire block that is the body of the function. True
or False?
2. It's a good idea to use global variables whenever you can. True or False?
3. A function prototype must specify the name of the function and the name and type of
each of its parameters. True or False?
4. When and where does control return from a void function?
5. When and where does control return from a value-returning function?
6. In the following function heading, which parameters are value parameters and which
are reference parameters?
void ExamPrep( string& name, int age, float & salary, char level)
7. What, if anything, is wrong with the following function?
void Square( int & x)
{
x = x * x;
return x;
}
8. What, if anything, is wrong with the following function?
void Power( int x, int y)
{
int result;
result = 1;
while ( y > 0 )
{
result = result * x;
y--;
}
}
9. Functions can be called form other functions in addition to main. True or False?
10. A value-returning function can have just one return statement. True or False?