Quiz 2 Flashcards
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
13
Which of the following is a legal identifier?
A) program!
B) program_1
C) 1program
D) program 1
Program_1
An example of a floating point data type is ____.
Question options:
A) int
B) char
C) double
D) short
double
Which of the following is a reserved word in C++?
A) char
B) Char
C) CHAR
D) character
char
The expression static_cast<int>(9.9) evaluates to \_\_\_\_.</int>
A) 9
B) 10
C) 9.9
D) 9.0
9
The escape sequence \r moves the insertion point to the beginning of the next line.
A) True
B) False
False
The value of the expression 17 % 7 is ____.
A) 1
B) 2
C) 3
D) 4
3
The maximum number of significant digits in float values is up to 6 or 7.
A) True B) False
True
____ is a valid int value.
A) 46,259
B) 46259
C) 462.59
D) -32.00
B
A mixed arithmetic expression contains all operands of the same type.
A) True B) False
False
A comma is also called a statement terminator.
A) True B) False
False
A(n) ____ is simply a name the programmer assigns to refer to computer storage locations.
A) constant
B) expression
C) variable
D) identifier
variable
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
keyword
A ____ contains both data and functions appropriate for manipulating the data.
A) segment
B) block
C) class
D) function
class
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()
D
____ are explanatory remarks made in a program.
A) Classes
B) Strings
C) Escape sequences
D) Comments
D
____ programs are easier to develop, correct, and modify than programs constructed in some other manner.
A) Handwritten
B) Low-level
C) Modular
D) Sequential
Modular
C++ is a case-sensitive language.
A) True B) False
True
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
line comment
If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
A) True
B) False
False
If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.
A) True
B) False
False
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
3
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;
int a,b,c;
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
C
The maximum number of significant digits in values of the double type is 15.
A) True
B) False
True
In C++, reserved words are the same as predefined identifiers.
A) True B) False
False
____ is a valid char value.
A) “-129”
B) ‘A’
C) “A”
D) 129
B
____ in C++ are any combination of letters, numbers, and special characters enclosed in quotation marks.
A) Enums
B) Arrays
C) Strings
D) Objects
Strings
Modular programs are easier to develop, correct, and modify than programs constructed in some other manner.
A) True B) False
True
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
Driver
In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin»_space; one»_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
B
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;
B
The length of the string “computer science” is ____.
A) 14
B) 15
C) 16
D) 18
16
Which of the following is the newline character?
Question options:
A)\r
B) \n
C) \l
D) \b
|n
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
B
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
floating-point
Preprocessor commands end with a semicolon.
A) True B) False
False
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
bool
Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.
A) True B) False
True