AP CSA Unit 2: Selection and Iteration

AP CSA · Unit 2 · 12 Lessons

Unit 2: Selection and Iteration

Master conditional statements and loops. Understand the control structures that form the foundation of every algorithm you’ll write in AP CSA and beyond.

12 Lessons
~30% AP Exam Weight
96+ Practice Questions

All 12 Lessons

Coding Exercises

Write real Java in the browser and submit it. Every exercise is graded against hidden test cases, and your score reports to your teacher automatically. 12 of 12 are open so far; the rest unlock as they are built.

2.1Algorithms with Selection and RepetitionExercise 1 →🔒 Exercise 2
2.2Boolean ExpressionsExercise 1 →🔒 Exercise 2
2.3if StatementsExercise 1 →🔒 Exercise 2
2.4Nested if StatementsExercise 1 →🔒 Exercise 2
2.5Compound Boolean ExpressionsExercise 1 →🔒 Exercise 2
2.6Comparing Boolean ExpressionsExercise 1 →🔒 Exercise 2
2.7while LoopsExercise 1 →🔒 Exercise 2
2.8for LoopsExercise 1 →🔒 Exercise 2
2.9Implementing Selection and Iteration AlgorithmsExercise 1 →🔒 Exercise 2
2.10Implementing String AlgorithmsExercise 1 →🔒 Exercise 2
2.11Nested IterationExercise 1 →🔒 Exercise 2
2.12Informal Run-Time AnalysisExercise 1 →🔒 Exercise 2
What you’ll learn in Unit 2
  • Write boolean expressions using relational and logical operators
  • Use if, if-else, and if-else-if statements to control program flow
  • Build while and for loops to repeat code efficiently
  • Implement selection and iteration algorithms (accumulator, counter, sentinel)
  • Trace and debug complex control flow including nested structures

Ready to test yourself?

Build a custom Unit 2 practice exam or review all AP CSA study tools.

Build a Practice Exam →

Get in Touch

Whether you're a student, parent, or teacher — I'd love to hear from you.

Just want free AP CS resources?

Enter your email below and check the subscribe box — no message needed. Students get daily practice questions and study tips. Teachers get curriculum resources and teaching strategies.

Typically responds within 24 hours

Message Sent!

Thanks for reaching out. I'll get back to you within 24 hours.

🏫 Welcome, fellow educator!

I offer curriculum resources, practice materials, and study guides designed for AP CS teachers. Let me know what you're looking for — whether it's classroom materials, a guest speaker, or Teachers Pay Teachers resources.

Email

[email protected]

📚

Courses

AP CSA, CSP, & Cybersecurity

Response Time

Within 24 hours

Prefer email? Reach me directly at [email protected]