AP CSA Unit 2 Day 22: Iteration Continue
Share
Unit 2, Selection & Iteration • Cycle 2
Day 22 Advanced Practice • Harder Difficulty
Focus: Continue Statement
Hard
Iteration (continue)
Advanced Practice Question
Format: Iteration (continue)
What is printed?
What is printed?
for (int i = 0; i < 5; i++) {
if (i == 2) {
continue;
}
System.out.print(i + " ");
}
Difficulty: Hard |
Topic: Iteration (continue) |
Cycle: 2 (Advanced)
Why This Answer?
When i is 3, `continue` skips `sum += i` for that iteration. The sum is 1 + 2 + 4 + 5 = 12.
Common Mistake
Watch Out!
Thinking `continue` ends the entire loop (it only skips to the next iteration).
AP Exam Strategy
`continue` skips the rest of the loop body for that iteration, then the loop continues.
Master This Topic
This Cycle 2 HARD question tests continue statement. Review Unit 2 concepts to build mastery of selection and iteration.
- Understanding continue statement
- Tracing code execution accurately
- Avoiding common pitfalls
Ready for More Challenges?
Cycle 2 questions prepare you for the hardest AP CSA exam questions.
Study Games Practice FRQs