Deck 3: Assignment, Formatting, and Interactive

Full screen (f)
exit full mode
Question
When the ++ operator appears before a variable it s called a(n) ____ increment operator.

A) suffix
B) infix
C) postfix
D) prefix
Use Space or
up arrow
down arrow
to flip the card.
Question
To control the format of numbers displayed by cout , you can include field width ____ in an output stream.

A) separators
B) manipulators
C) dividers
D) escape sequences
Question
Using a mathematical library function without including the preprocessor statement #include is a common programming error in C++.
Question
In C++, all functions, by definition, can directly return at most one value.
Question
Numbers sent to cout are normally displayed left-justified in the display field.
Question
Program execution begins with the first statement in the body of the main() function.
Question
Because of ____, the value assigned to the variable on the left side of the assignment operator is forced into the data type of the variable to which it s assigned.

A) right-to-left associability
B) left-to-right associability
C) coercion
D) operator precedence
Question
In C++, the ____ symbol is called the assignment operator.

A) ->
B) >>
C) ==
D) =
Question
The stream manipulator ____ displays Boolean values as true and false rather than 1 and 0 .

A) booltext
B) bool
C) boolalpha
D) showbool
Question
The stream manipulator ____ sets the floating-point precision to n places.

A) setprecision(n)
B) setw(n)
C) setfill( x )
D) showbase
Question
A common programming error in C++ consists of separating all variables passed to cin with an extraction symbol, >> .
Question
Assignment statements can be used to perform arithmetic computations.
Question
The display of integer values in one of the three possible number systems (decimal, octal, and hexadecimal) doesn t affect how the number is stored in a computer.
Question
The ostream class method setf(ios::fixed) is equivalent to the stream manipulator setiosflags(fixed) .
Question
The stream manipulator lowercase displays hexadecimal digits and the exponent in scientific notation in lowercase.
Question
A(n) ____ statement is the most basic C++ statement for assigning values to variables and performing computations.

A) initialization
B) assignment
C) declaration
D) arithmetic
Question
In addition to outputting integers in decimal notation, the oct and hex manipulators are used for conversions to octal and hexadecimal.
Question
In C++, the expression sum = sum + 10 can be written as ____.

A) sum =+ 10
B) +sum = 10
C) sum += 10
D) sum = 10+
Question
A(n) ____ is any combination of constants, variables, and function calls that can be evaluated to yield a result.

A) expression
B) identifier
C) class
D) object
Question
A(n) ____ can have a value assigned to it.

A) lvalue
B) rvalue
C) uvalue
D) dvalue
Question
In C++, the mathematical function ____ calculates a number s square root.

A) square()
B) sqrt()
C) squareRoot()
D) sqroot()
Question
In C++, accessing mathematical functions in a program requires including the mathematical header file ____.

A) number
B) cnumber
C) cmath
D) math
Question
The term ____ refers to an item, such as a variable or argument, that sets a condition usually considered active or nonactive.

A) expression
B) variable
C) flag
D) constant
Question
Another name for a manipulator uses format flags is a ____ manipulator.

A) complex
B) parameterized
C) format
D) customizable
Question
The ____ declaration qualifier specifies that the declared identifier is read-only after it s initialized.

A) fixed
B) const
C) fix
D) unchanged
Question
This type of statement: sum = sum + 10; is called a(n) ____________________ statement.
Question
A(n) ____ expression consists of operators and constants only.

A) constant
B) declaration
C) initialization
D) arithmetic
Question
In this statement: totalWeight = factor * weight; the arithmetic expression factor * weight is evaluated first to yield a number, which is then stored in the variable ____________________.
Question
In C++, the default precision is set to ____ decimal places.

A) five
B) six
C) seven
D) eight
Question
In C++, the = symbol is called the ____________________ operator.
Question
The ostream class method setf(ios::flush) is equivalent to the stream manipulator ____.

A) left
B) setiosflag(ios::flush)
C) right
D) endl
Question
Identifiers created with const are commonly referred to as symbolic constants or ____ constants.

A) general
B) global
C) named
D) valid
Question
The operator used to force converting a value to another type is the ____ operator.

A) cast
B) logical
C) binary
D) single
Question
The ostream class method precision(n) is equivalent to the stream manipulator ____.

A) precision()
B) setfill()
C) setprecision()
D) setw()
Question
To alter the default justification for a stream of data, you use the ____ manipulator.

A) setiosflags
B) setw
C) setpos
D) setjust
Question
The number 023 is a(n) ____ number in C++.

A) octal
B) hexadecimal
C) decimal
D) binary
Question
When a manipulator requiring an argument is used, the ____ header file must be included as part of the program.

A) istream
B) ostream
C) iostream
D) iomanip
Question
The simplest expression in C++ is a single ____________________.
Question
A variable can store only ____________________ value(s) at a time.
Question
The ____ statement is used to enter data in a program while it s running.

A) input
B) data
C) cout
D) cin
Question
A parameterized manipulator takes ____________________ flags as input.
Question
In this statement: int (a * b); , int is a(n) ____________________ operator.
Question
In C++, the assignment operator has a(n) ____________________ precedence than any other arithmetic operator.
Question
To alter the default justification for a stream of data, you use the ____________________ manipulator.
Question
Function ____________________ permits using the same function name for different arguments of different data types.
Question
In C++, arguments of all trigonometric functions ( sin() , cos() , and so forth) must be in ____________________.
Question
The ____________________ statement puts the computer in a temporary pause (or wait) state while the user types a value.
Question
In C++, a variable or symbolic constant must be ____________________ before it has been used.
Question
In C++, the cmath function named ____________________ is used to raise a number to a power.
Question
Programs that detect and respond effectively to unexpected user input are formally referred to as ____________________ programs.
Question
If n = 25 and this statement is executed: n--; , then the new value of n is ____________________.
Question
The ____________________ manipulator must be included for each occurrence of a number inserted in the data stream sent to cout .
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/52
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 3: Assignment, Formatting, and Interactive
1
When the ++ operator appears before a variable it s called a(n) ____ increment operator.

A) suffix
B) infix
C) postfix
D) prefix
D
2
To control the format of numbers displayed by cout , you can include field width ____ in an output stream.

A) separators
B) manipulators
C) dividers
D) escape sequences
B
3
Using a mathematical library function without including the preprocessor statement #include is a common programming error in C++.
True
4
In C++, all functions, by definition, can directly return at most one value.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
5
Numbers sent to cout are normally displayed left-justified in the display field.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
6
Program execution begins with the first statement in the body of the main() function.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
7
Because of ____, the value assigned to the variable on the left side of the assignment operator is forced into the data type of the variable to which it s assigned.

A) right-to-left associability
B) left-to-right associability
C) coercion
D) operator precedence
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
8
In C++, the ____ symbol is called the assignment operator.

A) ->
B) >>
C) ==
D) =
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
9
The stream manipulator ____ displays Boolean values as true and false rather than 1 and 0 .

A) booltext
B) bool
C) boolalpha
D) showbool
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
10
The stream manipulator ____ sets the floating-point precision to n places.

A) setprecision(n)
B) setw(n)
C) setfill( x )
D) showbase
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
11
A common programming error in C++ consists of separating all variables passed to cin with an extraction symbol, >> .
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
12
Assignment statements can be used to perform arithmetic computations.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
13
The display of integer values in one of the three possible number systems (decimal, octal, and hexadecimal) doesn t affect how the number is stored in a computer.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
14
The ostream class method setf(ios::fixed) is equivalent to the stream manipulator setiosflags(fixed) .
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
15
The stream manipulator lowercase displays hexadecimal digits and the exponent in scientific notation in lowercase.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
16
A(n) ____ statement is the most basic C++ statement for assigning values to variables and performing computations.

A) initialization
B) assignment
C) declaration
D) arithmetic
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
17
In addition to outputting integers in decimal notation, the oct and hex manipulators are used for conversions to octal and hexadecimal.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
18
In C++, the expression sum = sum + 10 can be written as ____.

A) sum =+ 10
B) +sum = 10
C) sum += 10
D) sum = 10+
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
19
A(n) ____ is any combination of constants, variables, and function calls that can be evaluated to yield a result.

A) expression
B) identifier
C) class
D) object
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
20
A(n) ____ can have a value assigned to it.

A) lvalue
B) rvalue
C) uvalue
D) dvalue
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
21
In C++, the mathematical function ____ calculates a number s square root.

A) square()
B) sqrt()
C) squareRoot()
D) sqroot()
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
22
In C++, accessing mathematical functions in a program requires including the mathematical header file ____.

A) number
B) cnumber
C) cmath
D) math
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
23
The term ____ refers to an item, such as a variable or argument, that sets a condition usually considered active or nonactive.

A) expression
B) variable
C) flag
D) constant
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
24
Another name for a manipulator uses format flags is a ____ manipulator.

A) complex
B) parameterized
C) format
D) customizable
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
25
The ____ declaration qualifier specifies that the declared identifier is read-only after it s initialized.

A) fixed
B) const
C) fix
D) unchanged
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
26
This type of statement: sum = sum + 10; is called a(n) ____________________ statement.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
27
A(n) ____ expression consists of operators and constants only.

A) constant
B) declaration
C) initialization
D) arithmetic
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
28
In this statement: totalWeight = factor * weight; the arithmetic expression factor * weight is evaluated first to yield a number, which is then stored in the variable ____________________.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
29
In C++, the default precision is set to ____ decimal places.

A) five
B) six
C) seven
D) eight
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
30
In C++, the = symbol is called the ____________________ operator.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
31
The ostream class method setf(ios::flush) is equivalent to the stream manipulator ____.

A) left
B) setiosflag(ios::flush)
C) right
D) endl
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
32
Identifiers created with const are commonly referred to as symbolic constants or ____ constants.

A) general
B) global
C) named
D) valid
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
33
The operator used to force converting a value to another type is the ____ operator.

A) cast
B) logical
C) binary
D) single
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
34
The ostream class method precision(n) is equivalent to the stream manipulator ____.

A) precision()
B) setfill()
C) setprecision()
D) setw()
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
35
To alter the default justification for a stream of data, you use the ____ manipulator.

A) setiosflags
B) setw
C) setpos
D) setjust
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
36
The number 023 is a(n) ____ number in C++.

A) octal
B) hexadecimal
C) decimal
D) binary
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
37
When a manipulator requiring an argument is used, the ____ header file must be included as part of the program.

A) istream
B) ostream
C) iostream
D) iomanip
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
38
The simplest expression in C++ is a single ____________________.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
39
A variable can store only ____________________ value(s) at a time.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
40
The ____ statement is used to enter data in a program while it s running.

A) input
B) data
C) cout
D) cin
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
41
A parameterized manipulator takes ____________________ flags as input.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
42
In this statement: int (a * b); , int is a(n) ____________________ operator.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
43
In C++, the assignment operator has a(n) ____________________ precedence than any other arithmetic operator.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
44
To alter the default justification for a stream of data, you use the ____________________ manipulator.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
45
Function ____________________ permits using the same function name for different arguments of different data types.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
46
In C++, arguments of all trigonometric functions ( sin() , cos() , and so forth) must be in ____________________.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
47
The ____________________ statement puts the computer in a temporary pause (or wait) state while the user types a value.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
48
In C++, a variable or symbolic constant must be ____________________ before it has been used.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
49
In C++, the cmath function named ____________________ is used to raise a number to a power.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
50
Programs that detect and respond effectively to unexpected user input are formally referred to as ____________________ programs.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
51
If n = 25 and this statement is executed: n--; , then the new value of n is ____________________.
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
52
The ____________________ manipulator must be included for each occurrence of a number inserted in the data stream sent to cout .
Unlock Deck
Unlock for access to all 52 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 52 flashcards in this deck.