1. When is a variable declared inside a function body in scope?
a) within the body of that function
b) within that body of that function and all the functions it calls
c) from the variable declaration to the end of the source code file
d) everywhere in the source code file
2. Any subset of function parameters in any order may be given default arguments. (True or False)
3. Which of the following details is not used to distinguish the parameter lists of an overloaded function identifier?
a) parameter names (identifiers)
b) parameter number
c) parameter type(s)
d) parameter order
4. A stub is a function whose signature matches a "real" function but whose definition is trivial or incomplete; this lets a stub stand in for the actual function during development or testing. (True or False)
5. A driver is a program which replaces "real" program logic with pre-determined actions that invokes specific functions during development or testing. (True or False)
1.
a) within the body of that function
If a variable is declared inside a function , its scope is only inside that function.
2.
False
If a parameter is declared default, its subsequent parameters must have default arguments.
3.
a) parameter names (identifiers)
parameter names can be different. Example:
int x,y,m,n;
x = 5;
y = 4;
m = 3;
n = 8;
add(x,y);
add(m,n);
Both the above function calls will call the same function add() with two int arguments.
4.
True
5.
True
Do ask if any doubt.
Get Answers For Free
Most questions answered within 1 hours.