Choosing how to earn college credit? CLEP vs AP guide
| preferred AP College board partner for AP classes
medium Solved by 5 students

While Loop Bounds

Mark
< Prev
Next >

A program evaluates a while loop condition and updates an integer variable until the condition is no longer met.

What is printed when the following Java program is compiled and run?

public class QuestionTrace {

    public static void main(String[] args) {
        int x = 2;
        while (x < 10) {
            x += 3;
        }
        System.out.println(x);
    }
}
A

8

B

10

C

9

D

11

Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Instagram: @_apfive_|Privacy Policy|