AP Computer Science Unit 1 – Test Review Practice Questions

Access More Questions
Consider this code segment: int x = 10, y = 0; while (x > 5) { y = 3; while (y < x) { y *= 2; if (y % x == 1) y += x; } x -= 3; } System.out.println(x + " " + y); What will be output after execution of this code segment?
Correct Answer:
7 12
Explanation:
Correct answer: 7 12

Access more questions from this quiz

Continue to AP Computer Science Unit 1 – Test Review Practice Questions for more practice questions and the full quiz experience.

Access More Questions