Skip to content
Sharp

Core Java · interview question

How will the expression '5 * (3 + 2) - 8 / 4' be evaluated?

Multiple choiceHardchapter-1-curatedpremiumcore-javaoperators-and-expressions
Choose one answer
Answer and explanation

Correct answer

A. 24

Why

The parentheses make the addition execute first, so '3 + 2' becomes 5. The expression then becomes '5 * 5 - 8 / 4'. Multiplication and division are next, so it evaluates to '25 - 2', resulting in 23.

Test yourself on Core Java

A free test with instant, explained results. No account needed.

Start free test
All Core Java questions →