C++ Chapter 3
In any program that uses the cin object, you must include the ________.
iostream header file
When this operator is used with string operands it concatenates them, or joins them together.
+
The ________ operator always follows the cin object, and the ________ operator follows the cout object.
>>, <<
Arithmetic operators that share the same precedence have right to left associativity.
FALSE
If you want to know the length of the string that is stored in a string object, you can call the object's size member function.
FALSE
In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision.
FALSE
The fixed manipulator causes a number to be displayed in scientific notation.
FALSE
The following statement will output $5.00 to the screen: cout << setprecision(5) << dollars << endl;
FALSE
When a program uses the setw manipulator, the iosetwidth header file must be included in a preprocessor directive.
FALSE
You can use these to override the rules of operator precedence in a mathematical expression.
(Parentheses)
const variables must always be:
initialized. C++ will throw an error if you decide to declare it without initializing it.
This manipulator causes the field to be left-justified with padding spaces printed to the right.
left
When a variable is assigned a number that is too large for its data type, it:
overflows
This manipulator is used to establish a field width for the value immediately following it.
setw
When the fixed manipulator is used, the value specified by the setprecision manipulator will be the number of digits to appear after the decimal point.
TRUE
The ________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed
The ________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed
When the final value of an expression is assigned to a variable, it will be converted to:
The data type of the variable
The cin << statement will stop reading input when it encounters a newline character.
TRUE
The total number of digits that appear before and after the decimal point is sometimes referred to as
significant digits, precision
Which statement is equivalent to the following? x = x * 2;
x *= 2;
This statement will pause the screen, until the [Enter] key is pressed.
cin.get();
Associativity is either right to left or:
Left to right
The statement:cin >> setw(10) >> str;will read up to this many characters into str.
Nine
When converting some algebraic expressions to C++, you may need to insert ________ that do not appear in the algebraic expression.
Parentheses
The only difference between the get function and the >> operator is that get reads the first character typed, even if it is a space, tab, or the [Enter] key.
TRUE
When C++ is working with an operator, it strives to convert the operands to the same type.
TRUE
You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?
cin.get(length, width, height);
This function tells the cin object to skip one or more characters in the keyboard buffer.
cin.ignore
The function, pow(x, 5.0), requires this header file.
cmath
When using the sqrt function you must include this header file.
cmath
To use the rand() function, you must #include this header file in your program.
cstdlib
This stream manipulator forces cout to print the digits in fixed-point notation.
fixed
________ reads a line of input, including leading and embedded spaces, and stores it in a string object.
getline
Which statement will read an entire line of input into the following string object? string address;
getline(cin, address);
What is the value stored at x, given the statements: int x; x = 3 / static_cast<int>(4.5 + 6.4);
0