C++ Quiz 3

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

True/False: Arithmetic operators that share the same precedence have right to left associativity. Select one: True False

False

True/False: The cin << statement will stop reading input when it encounters a newline character. Select one: True False

False

True/False: The fixed manipulator causes a number to be displayed in scientific notation. Select one: True False

False

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

c. (Left to right)

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

d. (cstdlib)

The function, pow(x, 5.0), requires this header file. Select one: a. cstdlib b. iostream c. cstring d. cmath e. iomanip

d.(cmath)

True/False: The following statement will output $5.00 to the screen: cout << setprecision(5)<< dollars << endl; Select one: True False

False

When using the sqrt function you must include this header file. Select one: a. cmath b. cstdlib c. cstring d. iostream e. iomanip

a. (cmath)

Which statement is equivalent to the following? number +=1 Select one: a. number = number + 1; b. number + 1; c. number = 1; d. None of these

a. (number = number + 1;)

Which statement is equivalent to the following? x = x * 2 Select one: a. x * 2; b. x *= 2; c. x = x * x; d. None of these

b. (x *= 2;)

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

c. (setw)

Which is true about the following statement? cout << setw(4) << num4 << " "; Select one: a. It allows four spaces for the value in the variable num4. b. It outputs "setw(4)" before the value in the variable num4. c. It should use setw(10) to output the value in the variable num10. d. It inputs up to four characters stored in the variable num4. e. None of these

a. (It allows four spaces for the value in the variable num4.)

will read up to this many characters into str. cin >> setw(10) >> str; Select one: a. Nine b. Ten c. Eleven d. Eight e. None of these

a. (Nine)

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 Feedback

b. (Parentheses)

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

b. (cin object)

This statement will pause the screen, until the [Enter] key is pressed. Select one: a. cin.getline(); b. cin.get(); c. cin.ignore(); d. cin.input(); e. cin;

b. (cin.get();)

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

b. (overflows)

________ 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

b.(getline)

Which statement will read an entire line of input into the following string object? Select one: a. cin << address; b. cin address; c. getline(cin, address); d. cin.get(address); e. None of these

c. (getline(cin, address);)

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. (left)

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

c.(fixed)

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

d. (+)

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.get(length, width, height); e. cin >> length >> width >> height;

e. (cin >> length >> width >> height;)

True/False: When C++ is working with an operator, it strives to convert the operands to the same type. 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

True

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

a. (cin.ignore)

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

c. (The data type of the variable)

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 Feedback

d. (significant digits and precision)


संबंधित स्टडी सेट्स

Module 8 energy balance, weight management, and eating disorders notes

View Set

Intermediate accounting 2, chapter 21: accounting for changes and errors

View Set

Positive Psychology and Well-being

View Set

Psychology of Creativity Quiz # 5 (Chapter 12)

View Set