Java Operators
Java Operators - Important Points
11. | What is the result of the expression (2 + 3) * 4? |
---|
A. 20
B. 25
C. 14
D. 8
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The parentheses force the addition to be evaluated first, resulting in 5. Then, 5 * 4 is evaluated, resulting in 20.
12. | Which of the following is the correct operator for division? |
---|
A. +
B. -
C. *
D. /
View Answer Discuss Work SpaceAnswer: option d
Explanation:
The / operator is used for division in Java.
13. | What is the result of the expression true && false? |
---|
A. 1
B. 0
C. 1
D. 0
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The && operator is the logical AND operator. Both operands must be true for the result to be true, so the result of true && false is false.
14. | Which of the following operators is used to compare two values for inequality? |
---|
A. !=
B. ==
C. >=
D. <=
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The != operator is used to test for inequality in Java.
15. | What is the result of the expression 10 / 3.0? |
---|
A. 3.333333
B. 3
C. 4
D. 3
View Answer Discuss Work SpaceAnswer: option a
Explanation:
When at least one of the operands is a floating-point value, the division is performed as floating-point division, resulting in a floating-point value.