cop2000 quiz 3

Ace your homework & exams now with Quizwiz!

What is the value of result after the following statement executes? result = (3 * 5) % 4 + 24 / (15 - (7 - 4) );

5

how many characters will the following statement read into the variable myString? cin >> setw(10) >> myString;

9

what is TRUE about the following statement? cout << setw(4) << num4 << " ";

It allows four spaces for the value in num4.

you can control the number of significant digits in your output with the ________ manipulator.

setprecision

this manipulator is used to establish a field width for the value that follows it:

setw

which of the following must be included in any program that uses the cin object?

the header file iostream

when C++ is working with an operator, it strives to convert operands to the same type. This is known as

type coercion

What is the value of x after the following code executes? int x; x = 3/ static_cast<int>(4.5 + 6.4);

0

What is the value of cube after the following code executes? double cube, side; side = 5.0; cube = pow(side, 3.0);

125.0

what is the value of cube after the following code executes? double cube, side; side = 5.0; cube = pow(side, 3.0);

125.0

What is the value of x after the following code executes? int x = 0; int y = 5; int z = 4; x = x + y + z * 2;

13

which of the following will allow the user to input the values 15 and 20 and have them stored in variables named base and height, respectively?

cin >> base >> height;

the ________ causes a program to wait until information is typed at the keyboard and the [Enter] key is pressed.

cin object

which of the following statements will allow the user to enter three values to be stored in variables length, width, and height, in that order?

cin.get(length, width, height);

to use the rand()function, you must include the ________ header file?

cstdlib

________ reads a line of input, including leading and embedded spaces, and stores it in a string object.

getline

a debugging process where you, the programmer, pretend you are a computer and step through each statement while recording the value of each variable at each step is known as

hand tracing

which statement is equivalent to the following? number = number * 2;

number *= 2;


Related study sets

Prep U for Brunner and Suddarth's Textbook of Medical Surgical Nursing, 13th Edition Chapter 65: Assessment of Neurologic Function

View Set

Pharmacology Chapter 9 Antibiotics

View Set

Personal Finance Exam 2 (Ch.5-8)

View Set

Econ 488: International Trade & Finance

View Set

Chapter 3: Protein Structure and Function

View Set

1.3-Vectors and Vector Operations

View Set