Ch 3 Quiz
b. cin object
The ________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed. Select one: a. Output stream b. cin object c. cout object d. Preprocessor e. None of these
c. >>, <<
The ________ operator always follows the cin object, and the ________ operator follows the cout object. Select one: a. binary, unary b. conditional, binary c. >>, << d. <<, >> e. None of these
False
The fixed manipulator causes a number to be displayed in scientific notation. Select one: True False
d. cmath
The function, pow(x, 5.0), requires this header file. Select one: a. iomanip b. cstdlib c. iostream d. cmath e. cstring
d. significant digits and precision
The total number of digits that appear before and after the decimal point is sometimes referred to as: Select one: a. floating points b. significant digits c. precision d. significant digits and precision e. None of these
a. cin.ignore
This function tells the cin object to skip one or more characters in the keyboard buffer. Select one: a. cin.ignore b. cin.jump c. cin.hop d. cin.skip; e. None of these
c. left
This manipulator causes the field to be left-justified with padding spaces printed to the right. Select one: a. left_justify b. right c. left d. left_pad e. None of these
c. setw
This manipulator is used to establish a field width for the value immediately following it. Select one: a. field_width b. set_field c. setw d. iomanip e. None of these
d. cin.get();
This statement will pause the screen, until the [Enter] key is pressed. Select one: a. cin.ignore(); b. cin.input(); c. cin.getline(); d. cin.get(); e. cin;
c. fixed
This stream manipulator forces cout to print the digits in fixed-point notation. Select one: a. setprecision(2) b. setw(2) c. fixed d. setfixed(2) e. None of these
d. cstdlib
To use the rand() function, you must #include this header file in your program. Select one: a. iostream b. iomanip c. iorand d. cstdlib e. None of these
c. Left to right
Associativity is either right to left or: Select one: a. Top to bottom b. Front to back c. Left to right d. Undeterminable e. None of these
False
True/False: Arithmetic operators that share the same precedence have right to left associativity. Select one: True False
False
True/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. Select one: True False
False
True/False: In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision. Select one: True False
False
True/False: The cin << statement will stop reading input when it encounters a newline character. Select one: True False
True
True/False: 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. Select one: True False
True
True/False: When C++ is working with an operator, it strives to convert the operands to the same type. Select one: True False
False
True/False: When a program uses the setw manipulator, the iosetwidth header file must be included in a preprocessor directive. Select one: True False
True
True/False: 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. Select one: True False
b. overflows
When a variable is assigned a number that is too large for its data type, it: Select one: a. underflows b. overflows c. reverses polarity d. exceeds expectations e. None of these
a. Parentheses
When converting some algebraic expressions to C++, you may need to insert ________ that do not appear in the algebraic expression. Select one: a. Parentheses b. Exponents c. Calculations d. Coercions e. None of these
c. The data type of the variable
When the final value of an expression is assigned to a variable, it will be converted to: Select one: a. The smallest C++ data type b. The largest C++ data type c. The data type of the variable d. The data type of the expression e. None of these
d. +
When this operator is used with string operands it concatenates them, or joins them together. Select one: a. & b. * c. % d. + e. None of these
c. cmath
When using the sqrt function you must include this header file. Select one: a. cstdlib b. cstring c. cmath d. iostream e. iomanip
b. (Parentheses)
You can use these to override the rules of operator precedence in a mathematical expression. Select one: a. [Brackets] b. (Parentheses) c. {Braces} d. The escape character \ e. None of these
b. iostream header file
In any program that uses the cin object, you must include the ________. Select one: a. compiler b. iostream header file c. linker d. >> and << operators e. None of these
d. cin >> length >> width >> height;
You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written? Select one: a. cin << length; width; height; b. cin << length, width, height; c. cin >> length, width, height; d. cin >> length >> width >> height; e. cin.get(length, width, height);
b. getline
________ reads a line of input, including leading and embedded spaces, and stores it in a string object. Select one: a. cin.get b. getline c. cin.getline d. get e. None of these