Advertisements
Advertisements
Question
Assertion (A): The result of the Java expression 3 + 7/2 is 6.
Reason (R): According to the hierarchy of operators in Java, addition is done first, followed by division.
Options
(A) is true and (R) is false.
(A) is false and (R) is true.
Both (A) and (R) are true and (R) is the correct explanation of (A).
Both (A) and (R) are true, but (R) is not the correct explanation of (A).
MCQ
Assertion and Reasoning
Advertisements
Solution
(A) is true and (R) is false.
Explanation:
Division has higher precedence than addition, so 7/2 is evaluated first. In Java, integer division 7/2 = 3; then 3 + 3 = 6. The reason’s claim that addition is done before division is incorrect.
shaalaa.com
Is there an error in this question or solution?
2025-2026 (March) Official Board Paper
