CS 150 Chapter 6

The standard header file for the abs(x)function is ____.
a. <cmath>
c. <cctype>
b. <ioinput>
d. <cstdlib>

A

To use the predefined function tolower, the program must include the header file ____.
a. <cctype> b. <iostream>
c. <cmath> d. <cstdlib>

A

The output of the statement:
cout << tolower('$') << endl; is ____.
a. '$'
b. '0'
c. '1'
d. An error, because you cannot use tolower with '$'.

A

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 ____. a. 65 c. 96
b. 67 d. 98

D

The output of the statement: cout << pow(3.0, 2.0) + 5 << endl; is ____.
a. 11.0 c. 13.0
b. 12.0 d. 14.0

D

The output of the statement:
cout << pow(2.0, pow(3.0, 1.0)) << endl;
is ____.
a. 6.0 c. 8.0
b. 7.0 d. 9.0

C

Functions that do not have a return type are called ____ functions.
a. zero c. void
b. null d. empty

C

The heading of the function is also called the ____.
a. title
c. function head
b. function signature
d. function header

D

A variable or expression listed in a call to a function is called the ____.
a. formal parameter
c. data type
b. actual parameter
d. type of the function

B

A variable listed in a header is known as a(n) ____ parameter.
a. actual b. local
c. formal d. function

C

Given the following function:
int next(int x)
{
return (x + 1);
}what is the output of the following statement?
cout << next(next(5)) << endl;
a. 5 c. 7
b. 6 d. 8

C

Which statement below about prototypes and headers is true?
a. Parameter names must be listed in the prototype, but not necessarily in the header.
b. Prototypes end with a semicolon, but headers do not.
c. Headers should come before prototypes.
d. Headers end with a semicolon, but prototypes do not.

B

Given the following function prototype: int test(float, char);, which of the following statements is valid?
a. cout << test(12,&);
b. cout << test("12.0", '&');
c. int u = test(5.0, '*');
d. cout << test('12', '&');

C

A function prototype is ____.
a. a definition, but not a declaration
b. a declaration and a definition
c. a declaration, but not a definition
d. a comment line

C

Given the following function prototype: double tryMe(double, double);, which of the following statements is valid? Assume that all variables are properly declared.
a. cin >> tryMe(x);
b. cout << tryMe(2.0, 3.0);
c. cout << tryMe(double,double), double);
d. cout << (tryMe(float, float), float);

B

Given the function prototype: double testAlpha(int u, char v, double t); which of the following statements is legal?
a. cout << testAlpha(5, 'A', 2);
b. cout << testAlpha( int 5, char 'A', int 2);
c. cout << testAlpha('5.0', 'A', '2.0'); d. cout << testAlpha(5.0, "65", 2.0);

A

Given the function prototype:
float test(int, int, int);
which of the following statements is legal?
a. cout << b. cout << c. cout << d. cout <<
test(7, test(14, 23));
test(test(7, 14), 23);
test(14, 23);
test(7, 14, 23);

D

Which of the following function prototypes is valid?
a. int funcTest(int x, int y, float z){} b. funcTest(int x, int y, float){};
c. int funcTest(int, int y, float z)
d. int funcTest(int, int, float);

D

Which of the following function prototypes is valid?
a. int funcExp(int x, float v);
b. funcExp(int x, float v){};
c. funcExp(void);
d. int funcExp(x);

A

Given the following function prototype: int myFunc(int, int);, which of the following statements is valid? Assume that all variables are properly declared.
a. cin >> myFunc(y);
b. cout << myFunc(myFunc(7, 8), 15);
c. cin >> myFunc('2', '3');
d. cout << myFunc(myFunc(7), 15);

B

Thestatement:return8,10;returnsthevalue ____.
a. 8 c. 18
b. 10 d. 80

B

Thestatement:return37,y,2*3;returnsthevalue ____.
a. 2
c. y
b. 3
d. 6

D

Thestatement:return2*3+1,1+5;returnsthevalue ____.
a. 2 b. 3
c. 6 d. 7

C

Given the following function:
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;
a. -1 c. 9
b. 1 d. 20

A

What value is returned by the following return statement? int x = 5;
return x + 1;
a. 0
b. 5
c. 6
d. 7

C

CS 150 Chapter 6 - Subjecto.com

CS 150 Chapter 6

Your page rank:

Total word count: 856
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

The standard header file for the abs(x)function is ____.
a. <cmath>
c. <cctype>
b. <ioinput>
d. <cstdlib>

A

To use the predefined function tolower, the program must include the header file ____.
a. <cctype> b. <iostream>
c. <cmath> d. <cstdlib>

A

The output of the statement:
cout << tolower(‘$’) << endl; is ____.
a. ‘$’
b. ‘0’
c. ‘1’
d. An error, because you cannot use tolower with ‘$’.

A

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 ____. a. 65 c. 96
b. 67 d. 98

D

The output of the statement: cout << pow(3.0, 2.0) + 5 << endl; is ____.
a. 11.0 c. 13.0
b. 12.0 d. 14.0

D

The output of the statement:
cout << pow(2.0, pow(3.0, 1.0)) << endl;
is ____.
a. 6.0 c. 8.0
b. 7.0 d. 9.0

C

Functions that do not have a return type are called ____ functions.
a. zero c. void
b. null d. empty

C

The heading of the function is also called the ____.
a. title
c. function head
b. function signature
d. function header

D

A variable or expression listed in a call to a function is called the ____.
a. formal parameter
c. data type
b. actual parameter
d. type of the function

B

A variable listed in a header is known as a(n) ____ parameter.
a. actual b. local
c. formal d. function

C

Given the following function:
int next(int x)
{
return (x + 1);
}what is the output of the following statement?
cout << next(next(5)) << endl;
a. 5 c. 7
b. 6 d. 8

C

Which statement below about prototypes and headers is true?
a. Parameter names must be listed in the prototype, but not necessarily in the header.
b. Prototypes end with a semicolon, but headers do not.
c. Headers should come before prototypes.
d. Headers end with a semicolon, but prototypes do not.

B

Given the following function prototype: int test(float, char);, which of the following statements is valid?
a. cout << test(12,&);
b. cout << test("12.0", ‘&’);
c. int u = test(5.0, ‘*’);
d. cout << test(’12’, ‘&’);

C

A function prototype is ____.
a. a definition, but not a declaration
b. a declaration and a definition
c. a declaration, but not a definition
d. a comment line

C

Given the following function prototype: double tryMe(double, double);, which of the following statements is valid? Assume that all variables are properly declared.
a. cin >> tryMe(x);
b. cout << tryMe(2.0, 3.0);
c. cout << tryMe(double,double), double);
d. cout << (tryMe(float, float), float);

B

Given the function prototype: double testAlpha(int u, char v, double t); which of the following statements is legal?
a. cout << testAlpha(5, ‘A’, 2);
b. cout << testAlpha( int 5, char ‘A’, int 2);
c. cout << testAlpha(‘5.0’, ‘A’, ‘2.0’); d. cout << testAlpha(5.0, "65", 2.0);

A

Given the function prototype:
float test(int, int, int);
which of the following statements is legal?
a. cout << b. cout << c. cout << d. cout <<
test(7, test(14, 23));
test(test(7, 14), 23);
test(14, 23);
test(7, 14, 23);

D

Which of the following function prototypes is valid?
a. int funcTest(int x, int y, float z){} b. funcTest(int x, int y, float){};
c. int funcTest(int, int y, float z)
d. int funcTest(int, int, float);

D

Which of the following function prototypes is valid?
a. int funcExp(int x, float v);
b. funcExp(int x, float v){};
c. funcExp(void);
d. int funcExp(x);

A

Given the following function prototype: int myFunc(int, int);, which of the following statements is valid? Assume that all variables are properly declared.
a. cin >> myFunc(y);
b. cout << myFunc(myFunc(7, 8), 15);
c. cin >> myFunc(‘2’, ‘3’);
d. cout << myFunc(myFunc(7), 15);

B

Thestatement:return8,10;returnsthevalue ____.
a. 8 c. 18
b. 10 d. 80

B

Thestatement:return37,y,2*3;returnsthevalue ____.
a. 2
c. y
b. 3
d. 6

D

Thestatement:return2*3+1,1+5;returnsthevalue ____.
a. 2 b. 3
c. 6 d. 7

C

Given the following function:
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;
a. -1 c. 9
b. 1 d. 20

A

What value is returned by the following return statement? int x = 5;
return x + 1;
a. 0
b. 5
c. 6
d. 7

C

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