COSC TEST Chapter 6 Practice

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

True

Assume the following.

static_cast<int>('a') = 97
static_cast<int>('A') = 65

The output of the statement:

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

...

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

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

Actual Parameter

The heading of the function is also called the ____.

Function Header

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

True

It is not necessary to specify the names of formal parameters in a function prototype.

True

Given the function prototype: double testAlpha(int u, char v, double t); which of the following statements is legal?

cout << testAlpha(5, 'A', 2);

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

A value-returning function returns only floating-point values

False

Given the following function:

int next(int x)
{
return (x + 1);
}

what is the output of the following statement?

cout &lt;&lt; next(next(5)) &lt;&lt; endl;

7

When writing a function prototype, you do not have to specify the data type of each parameter.

False

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

actual ; formal

The following return statement returns the value 10.

return 10, 16;

False

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

<cmath>

Given the following function prototype: double tryMe(double, double);, which of the following statements is valid? Assume that all variables are properly declared.

cout << tryMe(2.0,3.00);

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

<cctype>

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

False

The statement: return 8, 10; returns the value ____.

10

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

...

The function main is always compiled first, regardless of where in the program the function main is placed.

False

The statement: return 37, y, 2 * 3; returns the value ____.

6

The execution of a return statement in a user-defined function terminates the program.

False

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

True

Given the following function prototype: int myFunc(int, int); which of the following statements is valid? Assume that all variables are properly declared.

...

The function heading

int funcAlpha(float u, char v, int g)

in a C++ program will cause a syntax error because the function return type is int and so the first parameter, u, must be of type int.

False

A function prototype ends with a semicolon.

True

A function definition consists of the function heading and the body of the function

True

The output of the statement

cout &lt;&lt; toupper('8') &lt;&lt; endl;

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

False

The output of the statement:

cout &lt;&lt; tolower('$') &lt;&lt; endl;

is ____.

...

A function's formal parameter list cannot be empty.

False

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

6

Which of the following function prototypes is valid?

...

The return statement return x + 1; first returns the value of x and then increments the value of x

False

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

True

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

int funcExp(int u, char v, float g)

True

Given the following function:

int strange(int x, int y)
{
if (x &gt; y)
return x + y;
else
return x - y;
}

what is the output of the following statement?

cout &lt;&lt; strange(4, 5) &lt;&lt; endl;

-1

Which statement below about prototypes and headers is true?

prototypes end with a semicolon but headers do not

Which of the following function prototypes is valid?

int funcExp(intx, floatv);

The output of the statement:

cout &lt;&lt; pow(2.0, pow(3.0, 1.0)) &lt;&lt; endl;

is ____.

8.0

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

void

The statement return static_cast&lt;char&gt;(x + 5); where x is an int variable, returns a char value in a value-returning function.

True

Given the function prototype:

float test(int, int, int);

which of the following statements is legal?

cout << test(7,14,23);

What value is returned by the following return statement?

int x = 5;

return x + 1;

6

The execution of a C++ program always begins with the function main.

True

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

False

A value-returning function can return two values via the return statement.

False

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

False

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

14

A function prototype is ____.

...

COSC TEST Chapter 6 Practice - Subjecto.com

COSC TEST Chapter 6 Practice

Your page rank:

Total word count: 912
Pages: 3

Calculate the Price

- -
275 words
Looking for Expert Opinion?
Let us have a look at your work and suggest how to improve it!
Get a Consultant

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

True

Assume the following.

static_cast&lt;int&gt;(‘a’) = 97
static_cast&lt;int&gt;(‘A’) = 65

The output of the statement:

cout &lt;&lt; static_cast&lt;int&gt;(tolower(‘B’)) &lt;&lt; endl; is ____.

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

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

Actual Parameter

The heading of the function is also called the ____.

Function Header

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

True

It is not necessary to specify the names of formal parameters in a function prototype.

True

Given the function prototype: double testAlpha(int u, char v, double t); which of the following statements is legal?

cout << testAlpha(5, ‘A’, 2);

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

A value-returning function returns only floating-point values

False

Given the following function:

int next(int x)
{
return (x + 1);
}

what is the output of the following statement?

cout &lt;&lt; next(next(5)) &lt;&lt; endl;

7

When writing a function prototype, you do not have to specify the data type of each parameter.

False

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

actual ; formal

The following return statement returns the value 10.

return 10, 16;

False

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

<cmath>

Given the following function prototype: double tryMe(double, double);, which of the following statements is valid? Assume that all variables are properly declared.

cout << tryMe(2.0,3.00);

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

<cctype>

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

False

The statement: return 8, 10; returns the value ____.

10

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

The function main is always compiled first, regardless of where in the program the function main is placed.

False

The statement: return 37, y, 2 * 3; returns the value ____.

6

The execution of a return statement in a user-defined function terminates the program.

False

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

True

Given the following function prototype: int myFunc(int, int); which of the following statements is valid? Assume that all variables are properly declared.

The function heading

int funcAlpha(float u, char v, int g)

in a C++ program will cause a syntax error because the function return type is int and so the first parameter, u, must be of type int.

False

A function prototype ends with a semicolon.

True

A function definition consists of the function heading and the body of the function

True

The output of the statement

cout &lt;&lt; toupper(‘8’) &lt;&lt; endl;

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

False

The output of the statement:

cout &lt;&lt; tolower(‘$’) &lt;&lt; endl;

is ____.

A function’s formal parameter list cannot be empty.

False

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

6

Which of the following function prototypes is valid?

The return statement return x + 1; first returns the value of x and then increments the value of x

False

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

True

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

int funcExp(int u, char v, float g)

True

Given the following function:

int strange(int x, int y)
{
if (x &gt; y)
return x + y;
else
return x – y;
}

what is the output of the following statement?

cout &lt;&lt; strange(4, 5) &lt;&lt; endl;

-1

Which statement below about prototypes and headers is true?

prototypes end with a semicolon but headers do not

Which of the following function prototypes is valid?

int funcExp(intx, floatv);

The output of the statement:

cout &lt;&lt; pow(2.0, pow(3.0, 1.0)) &lt;&lt; endl;

is ____.

8.0

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

void

The statement return static_cast&lt;char&gt;(x + 5); where x is an int variable, returns a char value in a value-returning function.

True

Given the function prototype:

float test(int, int, int);

which of the following statements is legal?

cout << test(7,14,23);

What value is returned by the following return statement?

int x = 5;

return x + 1;

6

The execution of a C++ program always begins with the function main.

True

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

False

A value-returning function can return two values via the return statement.

False

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

False

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

14

A function prototype is ____.

Share This
Flashcard

More flashcards like this

NCLEX 10000 Integumentary Disorders

When assessing a client with partial-thickness burns over 60% of the body, which finding should the nurse report immediately? a) ...

Read more

NCLEX 300-NEURO

A client with amyotrophic lateral sclerosis (ALS) tells the nurse, "Sometimes I feel so frustrated. I can’t do anything without ...

Read more

NASM Flashcards

Which of the following is the process of getting oxygen from the environment to the tissues of the body? Diffusion ...

Read more

Unfinished tasks keep piling up?

Let us complete them for you. Quickly and professionally.

Check Price

Successful message
sending