AP CSA Unit 2 Day 18: Iteration For Loop Count
Share
Unit 2, Selection & Iteration • Cycle 2
Day 18 Advanced Practice • Harder Difficulty
Focus: Loop Step Count
Hard
Iteration (for-loop count)
Advanced Practice Question
Format: Iteration (for-loop count)
What is printed?
What is printed?
int count = 0;
for (int i = 0; i < 5; i++) {
count++;
}
System.out.println(count);
Difficulty: Hard |
Topic: Iteration (for-loop count) |
Cycle: 2 (Advanced)
Why This Answer?
`i` values are 1, 3, 5, 7, 9 (five iterations). So c is 5.
Common Mistake
Watch Out!
Including 11 or assuming `<= 10` means 10 is visited (it's not with step 2 from 1).
AP Exam Strategy
List the i-values for stepped loops; endpoints aren't always hit.
Master This Topic
This Cycle 2 HARD question tests loop step count. Review Unit 2 concepts to build mastery of selection and iteration.
- Understanding loop step count
- 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