Finals are here and stuck on a couple of questions....take a look??


To use a predefined function, the program must include the appropriate header file.

TF 2.
To use the predefined function abs, the program must include the header file ctype.

TF 3.
To use the predefined function exp, the program must include the header file cmath.

TF 4.
The output of the statement

cout << toupper('8') << endl;

is undefined since there is no upper case letter corresponding to '8'.

TF 5.
The output of the statement

cout << static_cast<int>(tolower('B')) << endl;

is 98.

TF 6.
The output of the statement

cout << static_cast<int>('b') << endl;

is 66.

TF 7.
Parameters allow the programmer to use different values each time the function is called.

TF 8.
To use a predefined value-returning function in a program, the programmer only needs to know the appropriate header file, the name of the function, and the type of the value returned by the function.

TF 9.
A function definition consists of the function heading and the body of the function.

TF 10.
A value-returning function returns only floating-point values.

TF 11.
A value-returning function with more than 10 parameters will result in a compile-time error.

TF 12.
A user-defined value-returning function with four parameters can only be called four times in a program.

TF 13.
The following function heading in a C++ program is valid:


TF 2.
I think you have to include cstdlib for the integer version of abs and cmath for the floating point version.

TF 4.
If there is no upper case the same value will be returned so in this case '8' will be returned.

TF 5 and TF 6.
I think you have swapped the answer for these two. You are assuming that the character encoding is ASCII compatible.

TF 10.
You can return any other kind of type by value from a function, not just floating point types.

TF 11.
I don't know if the standard mentions a minimum number of parameters that compilers have to support but most compilers can handle functions with way more than 10 parameters.

TF 12.
Does this make sense to you?

TF 13.
I don't see a "function heading".

The rest I think is correct.
Last edited on
Topic archived. No new replies allowed.