CS 150 final quiz 6 - 10

Ace your homework & exams now with Quizwiz!

If the formal parameter list of a function is empty, the parentheses after the function name are not needed

False

The following return statement returns the value 10. return 10, 16;

False

int strange(int x, int y) { if (x > y) return x + y; else return x - y; } what is the output of the following statement? cout << strange(4, 5) << endl;

-1

Given the following function: int next(int x) { return (x + 1); } what is the output of the following statement? cout << next(next(5)) << endl;

. 7

A variable or expression listed in a call to a function is called the ____.

. actual parameter

A variable listed in a header is known as a(n) ____ parameter.

. formal

Given the following function prototype: ​ int test(float, char); ​ which of the following statements is valid?

. int u = test(5.0, '*');

The output of the statement: cout << pow(3.0, 2.0) + 5 << endl; is ____.

14.0

The statement: return 2 * 3 + 1, 1 + 5; returns the value ____.

6

To use the predefined function tolower, the program must include the header file ____.

<cctype>

The standard header file for the abs(x)function is ____.

<cmath>

Which of the following function prototypes is valid?

int funcExp(int x, float v);

Functions that do not have a return type are called ____ functions.

void

Which statement below about prototypes and headers is true?

Prototypes end with a semicolon, but headers do not

Assume that all variables are properly declared. The following statement in a value-returning function is legal. if (x % 2 == 0) return x; else return x + 1;

True

In C++, a function prototype is the function heading without the body of the function.

True

Once you write and properly debug a function, you can use it in the program (or different programs) again and again without having to rewrite the same code repeatedly.

True

The data type of a variable in a return statement must match the function type.

True

Using functions greatly enhances a program's readability because it reduces the complexity of the function main.

True

A function prototype is ____.

a declaration, but not a definition


Related study sets

Pass Point Q's Gastrointestinal/Integumentary Disorders

View Set

Western Civilization - Ch. 5 & 6

View Set

Managerial Accounting- Chapter 17

View Set

N355 Chapter 22: Management of Patients with Upper Respiratory Tract Disorders

View Set

Final Exam - Pennsylvania Life Only

View Set