C++ Quiz 3 Grade A question with answer
________ 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 - (correct answer)b.(getline)
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 - (correct answer)d. (+)
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 - (correct answer)b. (cin object)
, 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 - (correct answer)a. (cin.ignore)
The function, pow(x, 5.0), requires this header file.
Select one:
a. cstdlib
b. iostream
c. cstring
d. cmath
e. iomanip - (correct answer)d.(cmath)
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; - (correct answer)e. (cin >> length >> width >>
height;)
You can use these to override the rules of operator precedence in a mathematical
expression.
________ 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 - (correct answer)b.(getline)
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 - (correct answer)d. (+)
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 - (correct answer)b. (cin object)
, 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 - (correct answer)a. (cin.ignore)
The function, pow(x, 5.0), requires this header file.
Select one:
a. cstdlib
b. iostream
c. cstring
d. cmath
e. iomanip - (correct answer)d.(cmath)
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; - (correct answer)e. (cin >> length >> width >>
height;)
You can use these to override the rules of operator precedence in a mathematical
expression.