Chapter 3 C++

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

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;

13

what will the value of the result be after the following statement executes? Result= 6-3*2+ 7-10/2;

2

Which is true about the following statement? Cout << setw(4) << num4 <<" ";

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

When converting some algebraic expressions to C++, you may need to insert ________ that do not appear in the algebraic expression.

Parenthesis

This manipulator is used to establish a field width for the value immediately following it.

Setw

You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?

cin >> length >> width >> height;

This function tells the cin object to skip one or more characters in the keyboard buffer.

cin.ignore

When using the sqrt function you must include this header file.

cmath

The total number of digits that appear before and after the decimal point is sometimes referred to as

significant digits and precision

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

the data type of the variable

What is the value of number after the following statements execute? int number = 10; number += 5; number -= 2; number *= 3;

39

What is the value of average after the following code executes? double average; average = 1.0 + 2.0 + 3.0 / 3.0;

4.0

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 const int MY_VAL = 99; 7 MY_VAL = 77; 8 cout << MY_VAL << endl; 9 return 0; 10 }

7

this statement will pause the screen, until the [enter] key is pressed.

Cin.get();

When this operator is used with string operands it concatenates them, or joins them together.

+

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;

-3

This stream manipulator forces cout to print the digits in fixed-point notation.

Fixed

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

Getline

in any program that uses the cin object, you must include in____.

Iostream header file

Which statement will read an entire line of input into the following string object? string address;

getline(cin, address);

This manipulator causes the field to be left-justified with padding spaces printed to the right.

left

the statement cin>>setw(10)>>str; will read up to this many characters into str.

nine


Ensembles d'études connexes

Chap 3. Organization: Structure + Culture

View Set

ACCT_311/S.Ward/FINAL_EXAM [Ch.6 &23?]

View Set

CM 1070 Module quiz answers for midterm

View Set