Java Operators
Java Operators - Important Points
21. | What is the result of the expression 5 * 2 + 3? |
---|
A. 11
B. 13
C. 15
D. 16
View Answer Discuss Work SpaceAnswer: option b
Explanation:
In Java, multiplication and division have higher precedence than addition and subtraction. Therefore, 5 * 2 is evaluated first, resulting in 10. Then, 3 is added to 10 to get the final result of 13.
22. | Which of the following operators is used to perform a bitwise AND operation? |
---|
A. &
B. &&
C. |
D. ||
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The & operator is used to perform a bitwise AND operation in Java.
23. | What is the result of the expression true || false? |
---|
A. 1
B. 0
C. 1
D. 0
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The || operator is the logical OR operator. If either of the operands is true, the result is true.
24. | Which of the following operators is used to perform a bitwise left shift operation? |
---|
A. <<
B. >>
C. &
D. |
View Answer Discuss Work SpaceAnswer: option a
Explanation:
The << operator is used to perform a bitwise left shift operation in Java.
25. | What is the result of the expression 10 % 3? |
---|
A. 1
B. 2
C. 3
D. 4
View Answer Discuss Work SpaceAnswer: option b
Explanation:
The % operator is used for modulo division, which gives the remainder after division. In this case, 10 divided by 3 leaves a remainder of 1.