Give your programs the power to decide and repeat. Write Boolean expressions, branch with if/else and nested conditions, combine tests with &&, ||, and !, and loop with while and for — then apply them to string and standard algorithms.
Six ways to master Unit 2 — pick whichever fits how you like to study.
All 12 topics from the College Board CED, in order.
Algorithms are built from three pieces: sequencing (Unit 1), selection, and iteration — and Unit 2 is all about the last two. Selection lets a program make decisions: you write Boolean expressions with relational operators (<, >, ==, !=), branch with if and if/else, nest conditions, and combine them with the logical operators && (and), || (or), and ! (not). You’ll compare equivalent conditions using truth tables and De Morgan’s laws.
Iteration repeats code. A while loop runs as long as its condition is true; a for loop packages initialization, condition, and update for counting. You’ll apply these to standard algorithms and String traversals, write nested loops for grids and combinations, and do informal run-time analysis by counting how many times statements execute. Watch for infinite loops and off-by-one errors — the most common bugs in this unit.
On the exam this unit is 25–35% of the multiple-choice section — one of the largest — and takes about 29–31 class periods. The five computational thinking practices below run through every topic: