When a function is defined after the main function
When a function is defined inside
the main function
When a function is defined before
the main function
When a function is defined in an external library
12. What is needed, if anything, to make this function correct?
double calculateArea()
{
const double PI = 3.141593;
double area = 0.0;
area = PI * pow(radius, 2);
return area;
}
Nothing is wrong with the function
the returnDataType is missing
The return statement requires parentheses
A variable in the parameterList is needed
13. In the following code, what is the scope and lifetime of the num1 variable?
int num2 = 100;
int main()
{
for (int num1=1; num1 < num2; num1+=1)
{
…………. more code here ………..
}
}
global, until the for loop ends
local, until the program ends
local, until the for loop ends
global, until the program ends
14. What is (are) the argument(s) passed to the pow function?
15. What property of a variable indicates where in the program the variable an be used?
16. What is the data type of the value returned by the sqrt function?
17. What value is returned by the time function?
seconds elapsed since midnight, 1/1/1970
minutes elapsed since midnight, 1/1/1970
hours elapsed since midnight, 1/1/1970
days elapsed since midnight, 1/1/1970
18. If you want to send the value contained in a variable to a function, which method should you use?