CSC 150 Quiz 2
If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right. True or false?
true
The ____ rules of a programming language tell you which statements are legal, or accepted, by the programming language.
syntax
Suppose we declare a variable sum as an int. The statement " sum += 7; " is equivalent to the statement " sum = sum + 7; " . True or false?
true
Suppose that alpha and beta are int variables. The statement alpha = beta--; is equivalent to the statement(s) ____. a. alpha = beta; beta = beta - 1; b. alpha = beta; beta = beta + 1; c. beta = beta - 1; alpha = beta; d. beta = beta + 1; alpha = beta;
a
____ is a valid char value. a. -129 c. 128 b. 'A' d. 129
b
Choose the output of the following C++ statement: cout << "Sunny " << '\n' << "Day " << endl; a. Sunny \nDay b. Sunny \nDay endl c. Sunny Day d. Sunny \n Day
c
In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin >> one >> two; executes, ____. a. one = 10.5, two = 10.5 b. one = 30.6, two = 30.6 c. one = 10.5, two = 30.6 d. one = 11, two = 31
c
Which of the following is a legal identifier? a. program! b. 1program c. program_1 d. program
c
Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, sum=?.
15
The value of the expression 17 % 7 is ____.
3
The value of the expression 33/10, assuming both values are integral data types, is ____.
3
Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, alpha = __.
50
____ is a valid int value. a. 45.9 b. 0.732 c. 89 d. 52.06
89
The expression static_cast<int>(9.9) evaluates to ____.
9
What is the newline character?
\n
Which of the following is a reserved word in C++? a. Char b. char c. taco d. Double
char
An example of a floating point data type is ____. a. int b. char c. double d. short
double
A comma is also called a statement terminator. True or false?
false
A mixed arithmetic expression contains all operands of the same type. True or false?
false
An operator that has only one operand is called a unique operator. True or false?
false