C++ Early Objects, Ninth Edition - Chapter 3

C++ Early Objects, Ninth Edition - Chapter 3

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written? A) cin << length, width, height; B) cin.get(length, width, height); C) cin >> length >> width >> height; D) cin >> length, width, height; 7-10 E) cin << length; width; height;

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 1, 2020

Cards (26)

Section 1

(26 cards)

You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written? A) cin << length, width, height; B) cin.get(length, width, height); C) cin >> length >> width >> height; D) cin >> length, width, height; 7-10 E) cin << length; width; height;

Front

C) cin >> length >> width >> height;

Back

What is the value stored at x, given the statements:0 int x; x = 3 / (int)(4.5 + 6.5); A) .3 B) 0 C).275229 D) 3.3

Front

B) 0

Back

The ________ operator always follows the cin object, and the ________ operator follows the cout object. A) binary, unary B) conditional, binary C) >>, << D) <<, >>

Front

C) >>, <<

Back

Which is true about the following statement? cout << setw(4)<< num4 << " "; 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(4) to output the value in the variable num10. D) It inputs up to four characters stored in the variable num4.

Front

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

Back

When converting some algebraic expressions to C++, you may need to insert ________ that do not appear in the algebraic expression. A) Parentheses B) Exponents C) Calculations D) Coercions

Front

A) Parentheses

Back

When the final value of an expression is assigned to a variable, it will be converted to: 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

Front

C) The data type of the variable

Back

This manipulator is used to establish a field width for the value immediately following it. A) field_width B) set_field C) setw D) iomanip

Front

C) setw

Back

What is the value of number after the following statements execute? int number = 10; number += 5; number -= 2; number *= 3; A) 3 B) 30 C) 39 D) 2

Front

C) 39

Back

This stream manipulator forces cout to print the digits in fixed-point notation. A) setprecision(2) B) setw(2) C) fixed D) set fixed (2)

Front

C) fixed

Back

This function tells the cin object to skip one or more characters in the keyboard buffer. A) cin.ignore B) cin.jump C) cin.hop D) cin.skip;

Front

A) cin.ignore

Back

What is the value of average after the following code executes? double average = 1.0 + 2.0 + 3.0 / 3.0; A) 2.0 B) 4.0 C) 1.5 D) 6.0

Front

B) 4.0

Back

Which statement is equivalent to the following? number += 1; A) number = number + 1; B) number + 1; C) number = 1; D) None of these

Front

A) number = number + 1;

Back

The function, pow(x, 5.0), may require this header file. A) cstdlib B) cmath C) cstring D) iostream E) iomanip

Front

B) cmath

Back

In the following C++ statement, what will be executed first according to the order of precedence? result = 6 - 3 * 2 + 7 - 10 / 2 ; A) 6-3 B) 3*2 C) 2+7 D) 7-10 E) 10/2

Front

B) 3*2

Back

When this operator is used with string operands it concatenates them, or joins them together. A) & B) * C) % D) +

Front

D) +

Back

Associativity is either right to left or: A) Top to bottom B) Front to back C) Left or right D) Undeterminable

Front

C) Left or right

Back

This statement will pause the screen, until the [Enter] key is pressed. A) cin; B) cin.getline(); C) cin.get(); D) cin.ignore(); E) cin.input();

Front

C) cin.get();

Back

When using the sqrt function you must include this header file. A) cstdlib B) cmath C) cstring D) iostream E) iomanip

Front

B) cmath

Back

You can use these to override the rules of operator precedence in a mathematical expression. A) [Brackets] B) (Parentheses) C) {Braces} D) The escape character \

Front

B) (Parentheses)

Back

In any program that uses the cin object, you must include the ________. A) compiler B) iostream header file C) linker D) >> and << operators

Front

B) iostream header file

Back

Assume that x is an int variable. What value is assigned to x after the following assignment statement is executed? x = -3 + 4 % 6 / 5; A) 0 B) 1 C) 2 D) -3

Front

D) -3

Back

________ reads a line of input, including leading and embedded spaces, and stores it in a string object. A) cin.get B) getline C) cin.getline D) get

Front

B) getline

Back

The ________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed. A) Output stream B) cin object C) cout object D) Preprocessor

Front

B) cin object

Back

To use the rand() function, you must #include this header file in your program. A) iostream B) iomanip C) iorand D) cstdlib

Front

D) cstdlib

Back

Which statement is equivalent to the following? x = x * 2; A) x * 2; B) x *= 2; C) x = x * x; D) None of these;

Front

B) x *= 2;

Back

What will the value of x be after the following statements execute? int x = 0; int y = 5; int z = 4; x = y + z * 2; A) 13 B) 18 C) 0 D) unkown

Front

A) 13

Back