C++ Chapter 2 T/F
18.0 / 4
4.5
Suppose a = 5. After the statement ++a; executes, the value of a is still 5 because the value of the expression is not saved in another variable
False-- the value of a is 6 because the pre-increment operator incremented a to 6
The operands of the modulus operator must be integers.
True
25 / 3 =
8
3 - 5 % 7
-2
20 - 12 / 4 * 2 =
14
32 % 7
4
Suppose x=5. After the statement y = x++; executes, y is 5 and x is 6
True
An identifier can be any sequence of digits and letters.
FALSE - answer: an identifier consists of letters, digits, and the underscore character and must begin with a letter or underscore.
A C++ identifier can start with a digit.
FALSE - answer: must begin with a letter or underscore
In the statement cin>>y; y can only be an int or a double variable.
FALSE - can also be float, char, const, void, & return
In a mixed expression, all the operands are converted to floating-point numbers.
FALSE- answer: floating point and integer numbers
In C++, there is no difference between a reserved word and a predefined identifier.
False
If a=4; and b=3; then after the statement a=b; the value of b is still 3.
True
The following is a legal C++ program: TRUE int main() { return 0; }
True
In an output statement, the newline character may be a part of the string.
True