Quiz 2 Flashcards

1
Q

The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to \_\_\_\_.</int></int>

A) 13
B) 14
C) 14.8
D) 15

A

13

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following is a legal identifier?

A) program!

B) program_1

C) 1program

D) program 1

A

Program_1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

An example of a floating point data type is ____.
Question options:

A) int

B) char

C) double

D) short

A

double

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following is a reserved word in C++?

A) char

B) Char

C) CHAR

D) character

A

char

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The expression static_cast<int>(9.9) evaluates to \_\_\_\_.</int>

A) 9

B) 10

C) 9.9

D) 9.0

A

9

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The escape sequence \r moves the insertion point to the beginning of the next line.
A) True
B) False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The value of the expression 17 % 7 is ____.

A) 1

B) 2

C) 3

D) 4

A

3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The maximum number of significant digits in float values is up to 6 or 7.

A) True
B) False
A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

____ is a valid int value.

A) 46,259

B) 46259

C) 462.59

D) -32.00

A

B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A mixed arithmetic expression contains all operands of the same type.

A) True
B) False
A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A comma is also called a statement terminator.

A) True
B) False
A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A(n) ____ is simply a name the programmer assigns to refer to computer storage locations.

A) constant

B) expression

C) variable

D) identifier

A

variable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

A(n) ____ is a word the language sets aside for a special purpose and can be used only in a specified manner.

A) codeword

B) keyword

C) identifier

D) classname

A

keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

A ____ contains both data and functions appropriate for manipulating the data.

A) segment

B) block

C) class

D) function

A

class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The C++ operator ____ provides the number of bytes used to store values for any data type named in the operator’s parentheses.

A) length()

B) size()

C) lengthof()

D) sizeof()

A

D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

____ are explanatory remarks made in a program.

A) Classes

B) Strings

C) Escape sequences

D) Comments

17
Q

____ programs are easier to develop, correct, and modify than programs constructed in some other manner.

A) Handwritten

B) Low-level

C) Modular

D) Sequential

18
Q

C++ is a case-sensitive language.

A) True
B) False
19
Q

A ____ begins with two slashes (//) and continues to the end of the line.

A) block comment

B) function comment

C) line comment

D) program comment

A

line comment

20
Q

If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
A) True
B) False

21
Q

If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
A) True
B) False

22
Q

The value of the expression 33/10, assuming both values are integral data types, is ____.

A) 0.3

B) 3

C) 3.0

D) 3.3

23
Q

The declaration int a, b, c; is equivalent to which of the following?

A) inta , b, c;

B) int a,b,c;

C) int abc;

D) int a b c;

A

int a,b,c;

24
Q

The ____ rules of a programming language tell you which statements are legal, or accepted, by the programming language.

A) semantic

B) logical

C) syntax

D) grammatical

25
Q

The maximum number of significant digits in values of the double type is 15.
A) True
B) False

26
Q

In C++, reserved words are the same as predefined identifiers.

A) True
B) False
27
Q

____ is a valid char value.

A) “-129”

B) ‘A’

C) “A”

D) 129

28
Q

____ in C++ are any combination of letters, numbers, and special characters enclosed in quotation marks.

A) Enums

B) Arrays

C) Strings

D) Objects

29
Q

Modular programs are easier to develop, correct, and modify than programs constructed in some other manner.

A) True
B) False
30
Q

The main() function is referred to as a(n) ____ function because it tells other functions the sequence in which they execute.

A) logical

B) class

C) driver

D) auxiliary

31
Q

In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin&raquo_space; one&raquo_space; two; executes, ____.

A) one = 10.5, two = 10.5

B) one = 10.5, two = 30.6

C) one = 30.6, two = 30.6

D) one = 11, two = 31

32
Q

The declaration int a, b, c; is equivalent to which of the following?

A) inta , b, c;

B) int a,b,c;

C) int abc;

D) int a b c;

33
Q

The length of the string “computer science” is ____.

A) 14

B) 15

C) 16

D) 18

34
Q

Which of the following is the newline character?
Question options:

A)\r

B) \n

C) \l

D) \b

35
Q

A(n) ____ is an item used to change how the output stream of characters is displayed.

A) escape sequence

B) manipulator

C) char object

D) string

36
Q

A(n) ____ number, more commonly known as a real number, can be the number zero or any positive or negative number that contains a decimal point.

A) boolean

B) integer

C) long int

D) floating-point

A

floating-point

37
Q

Preprocessor commands end with a semicolon.

A) True
B) False
38
Q

The three most important and common integer types used in most applications are int, char, and ____.

A) long int

B) bool

C) unsigned char

D) long

39
Q

Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.

A) True
B) False