AP CSA Unit 2 Day 19: Iteration While Loop Growth

Unit 2, Selection & Iteration • Cycle 2
Day 19 Advanced Practice • Harder Difficulty
Focus: Exponential Growth Hard Iteration (while-loop growth)

Advanced Practice Question

Format: Iteration (while-loop growth)

What is printed?
int x = 1;
while (x < 100) {
    System.out.print(x + " ");
    x = x * 3;
}
Difficulty: Hard | Topic: Iteration (while-loop growth) | Cycle: 2 (Advanced)
Why This Answer?

x goes 1→2→4→8→16→32, which is 5 updates, so steps is 5.

Common Mistake
Watch Out!

Stopping at 16 because it "looks close" to 20; the loop continues until x is no longer < 20.

AP Exam Strategy

For multiplicative loops, simulate each update; don't approximate.

Master This Topic

This Cycle 2 HARD question tests exponential growth. Review Unit 2 concepts to build mastery of selection and iteration.

  • Understanding exponential growth
  • Tracing code execution accurately
  • Avoiding common pitfalls
View Unit 2 Study Guide

Ready for More Challenges?

Cycle 2 questions prepare you for the hardest AP CSA exam questions.

Study Games Practice FRQs
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.