Skip to content
Sharp

Core Java · interview question

What does this code if the cart total is 250 and free shipping is given for totals over 200 evaluate to?

Multiple choiceMediumchapter-1-curatedpremiumcore-javaconditions-and-branching
java
int cartTotal = 250;
if (cartTotal > 200) { System.out.println("free shipping applied"); }
Choose one answer
Answer and explanation

Correct answer

A. Free shipping applied

Why

The code checks if the cart total is greater than the threshold for free shipping. Since 250 is greater than 200, the condition is satisfied, and free shipping is applied.

Test yourself on Core Java

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

Start free test
All Core Java questions →