Operators MCQ
Operators MCQ
✅ Answer: A) true
💡 Explanation:
✅ Answer: A) true
💡 Explanation:
✅ Answer: B) false
💡 Explanation:
10 != 10.0 becomes false since both values are equal since 10 (int) is being
widened to double before comparision.
✅ Answer: B) 50
💡 Explanation:
a *= 2 + 3 → a = a * (2 + 3) → 10 * 5 = 50.
✅ Answer: B) ArithmeticException
💡 Explanation:
✅ Answer: A) true
💡 Explanation:
10 > 9 → true
9 < 10 → true
true == true → true
✅ Answer: A) true
💡 Explanation:
✅ Answer: C) 9 5 9
💡 Explanation:
✅ Answer: A) Yes
💡 Explanation:
Since 3 > 2 is true, the second ternary expression (2 > 1 ? "Yes" : "No") executes.
Since 2 > 1 is also true, "Yes" is printed.
b * 2 results in int.
✅ Answer: A) -15
💡 Explanation:
a -= a * a → 5 - (5 * 5) = 5 - 25 = -20
a += -20 → -20 + 5 = -15
Associativity is from Right -> Left
✅ Answer: C) 14
💡 Explanation:
++x → x = 4
x++ → 4 (but x becomes 5)
--x → 4
x-- → 4 (but x becomes 3)
4 + 4 + 4 + 2 = 14
✅ Answer: B) 25
💡 Explanation: