CISP 360 Chapter 3 Quiz

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

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

5

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

It allows four spaces for the value in num4.

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 line in the following program will cause a compiler error?

line 7

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

number *= 2;

When a variable is assigned a number that is too large for its data type, it

overflows

Which of the following functions will return the value of x, rounded to the nearest whole number?

round(x)

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

setprecision

When the final value of an expression is assigned to a variable, it will be converted to

the data type of the variable

The ________ operator always follows the cin object, and the ________ operator follows the cout object.

>>, <<

Arithmetic operators that share the same precedence have right to left associativity.

False

The fixed manipulator causes a number to be displayed in scientific notation.

False

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

False

When a program uses the setw manipulator, the iosetwidth header file must be included in a preprocessor directive.

False

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

Which of the following statements will read an entire line of input from the keyboard into the string object, address?

getline(cin, address);

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

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

3 * 2

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.

True

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 functions tells the cin object to skip one or more characters in the keyboard buffer?

cin.ignore

The function pow(x, y), requires which header file?

cmath


Ensembles d'études connexes

Life Insurance Policy Riders, Provisions, Options, and Exclusions

View Set

Early American Literature (Washington Irving)

View Set

ba 市場營銷管理8 電子市場營銷策略

View Set

Chapter 8 Economics textbook questions

View Set