Multiple Choice Identify the
choice that best completes the statement or answers the question.
|
|
|
1.
|
Which term below describes the C++ operators used to perform calculations in a
program?
a. | logical | c. | arithmetic | b. | mathematical | d. | all of the
above |
|
|
|
2.
|
Which of the following statements could be used in a C++ program to initialize
three variables to the same value in one statement?
a. | i, j, k = 25; | c. | i = j = k = 25; | b. | i j k = 25; | d. | none of the
above |
|
|
|
3.
|
Which of the following symbols represents the C++ assignment
operator?
|
|
|
4.
|
Which of the following items has the highest order of operations?
a. | division | c. | addition | b. | multiplication | d. | negation |
|
|
|
5.
|
Which statement below could be used in a C++ program to display a message and
the result of a calculation to the user without requiring a variable to store the result?
a. | cout << "Result = x/y" << endl; | c. | cout << "result = x/y
endl; << | b. | cout << "Result = " x/y << endl; | d. | cout << "Result = " <<
x/y << endl; |
|
|
|
6.
|
Which C++ operator is used to determine the integer remainder value of a
division operation?
a. | balance | c. | modulus | b. | left | d. | remainder |
|
|
|
7.
|
For the expression: x = 13 % 5; What would be the result stored in
x
|
Completion Complete each
statement.
|
|
|
8.
|
The C++ ____________________ operator is used to initialize a variable to some
specific value.
|
|
|
9.
|
The modulus operator can only be used for ____________________
division.
|
|
|
10.
|
The _________________________ determines which portion of an expression is
evaluated before some other portion of the expression.
|
|
|
11.
|
The C++ ____________________ operator can be used to reduce a variable by a
value of one.
|
True/False Indicate whether the
statement is true or false.
|
|
|
12.
|
The assignment operator can be used in a variable declaration statement
to declare and initialize the variable in one statement.
|
|
|
13.
|
In the statement, x = --y; the value assigned to x will be one
less than the current value of y.
|
|
|
14.
|
Including arithmetic operations in output statements can save memory and result
in fewer programming statements being written.
|
|
|
15.
|
Programs that will perform divide operations do not need to include code to
check for division by zero since it is always trapped and corrected by the compiler.
|
|
|
16.
|
The C++ assignment operator functions the same way the equal sign
functions in algebra.
|
|
|
17.
|
C++ allows variables of different data types to be initialized in a single
program statement.
|
|
|
18.
|
The minus sign (-) can be used to change the sign of a variable or value.
|