Chapter Three Quiz
1 #include < iostream > 2 using namespace std; 3 4 int main( ) 5 { 6 const int MY_VAL; 7 MY_VAL = 7; 8 cout << MY_VAL << endl; 9 return 0; 10 } What is the value of MY_VAL at line 7 in this program?
7
If you want to know the length of the string that is stored in a string object, you can call the object's size member function.
False
The fixed manipulator causes a number to be displayed in scientific notation.
False
What is the value of number after the following statements execute? int number = 2; number += 5; number -= 2; number *= 3;
30
Which is true about the following statement? cout << setw(4) << num4 << " ";
It allows four spaces for the value in the variable num4.
In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision.
True
This stream manipulator forces cout to print the digits in fixed-point notation.
fixed
This manipulator causes the field to be left-justified with padding spaces printed to the right.
left
Given string str; The statement cin >> setw(10) >> str; will read up to this many characters into str.
nine
Which statement is equivalent to the following? x = x * 2;
x *= 2;