AP Computer Science Principles Unit 3, Algorithms and Programming, covers algorithms, sequencing, selection, iteration, and abstraction across 18 topics, making it one of the most hands-on units on the exam. You'll work through variables, Boolean expressions, conditionals, lists, and binary search as concrete tools for solving problems. AP CSP also introduces procedures, both calling and developing them, plus libraries, simulations, and the limits of computation like undecidable problems.
AP Computer Science Principles Unit 3 covers how programs actually work, from variables and conditionals to procedures, simulations, and the limits of what computers can solve. The single biggest idea is that every algorithm, no matter how complicated, is built from just three structures: sequencing, selection, and iteration. This is the largest unit in the course and where you learn the AP pseudocode that shows up all over the exam.
a ← 5 stores 5 in a, and the value in a variable is always the most recent assignment.a ← 1, b ← a, a ← 2, the variable b still holds 1, because b got a copy of a's value, not a live link to it.+, -, *, /, and MOD. The MOD operator gives the remainder, so 17 MOD 5 evaluates to 2. Use x MOD 2 = 0 to test if a number is even.aList[1] is the first element, and you can read with x ← aList[i] or write with aList[i] ← x.=, ≠, >, <, ≥, ≤) and logical operators (NOT, AND, OR).IF (condition) runs a block only when the condition is true, and IF...ELSE picks between two paths. Nested conditionals put if-statements inside if-statements to handle multiple cases.REPEAT n TIMES runs a block a fixed number of times, REPEAT UNTIL (condition) runs until the condition becomes true, and FOR EACH item IN aList visits every element of a list in order.RANDOM(a, b) returns a random integer from a to b, inclusive, with each value equally likely. RANDOM(1, 3) can return 1, 2, or 3. Programs with randomness can produce different output each run.| Concept | What it is | AP pseudocode | The one thing to remember |
|---|---|---|---|
| Variables and assignment | Named storage for one value | a ← expression | Variables hold the most recent assignment; copies don't update |
| Mathematical expressions | Arithmetic on values and variables | +, -, *, /, MOD | a MOD b is the remainder; 17 MOD 5 is 2 |
| Boolean expressions | True/false tests | =, ≠, <, >, NOT, AND, OR | Relational comparisons evaluate to a Boolean value |
| Conditionals | Selection between code paths | IF (condition) { } ELSE { } | Only the matching branch runs; trace nested ifs carefully |
| Iteration | Repeating code | REPEAT n TIMES, REPEAT UNTIL (condition) | REPEAT UNTIL stops when the condition becomes true |
| Lists | Ordered collections of elements | aList[i], FOR EACH item IN aList | Indexing starts at 1 on the AP exam |
| Procedures | Named, reusable blocks of code | PROCEDURE name(p1, p2) { } | Use them knowing what they do, not how they work |
| Random values | Equally likely integer generation | RANDOM(a, b) | Inclusive on both ends; output varies per run |
| Binary search | Halving a sorted data set | Concept only, no implementation | Requires sorted data; eliminates half each step |
| Efficiency and decidability | Limits of algorithms | Concept only | Heuristics for unreasonable time; undecidable means no algorithm exists |
This unit is the core of the Algorithms and Programming big idea, the most heavily weighted big idea in the course. Nearly everything else in AP CSP either feeds into it or builds on it, and the AP pseudocode you learn here is the language of the multiple-choice exam.
a ← expression: evaluates the expression and assigns a copy of the result to variable a.a MOD b: the remainder when a is divided by b; the go-to tool for divisibility and even/odd checks.IF (condition) { } ELSE { }: runs the first block if the condition is true, the second otherwise.REPEAT n TIMES { }: runs the block exactly n times.REPEAT UNTIL (condition) { }: runs the block repeatedly, stopping once the condition is true (it may run zero times if the condition starts true).aList[i]: accesses the element at index i, where the first element is at index 1.INSERT, APPEND, REMOVE, LENGTH: the reference-sheet list procedures for adding, removing, and counting elements.FOR EACH item IN aList { }: traverses the list, assigning each element to item in order.PROCEDURE procName(parameter1, parameter2) { }: defines a procedure; call it with procName(arg1, arg2) or capture a returned value with result ← procName(arg1, arg2).RANDOM(a, b): returns a random integer from a to b, inclusive, each equally likely.This content shows up everywhere on the multiple-choice exam, almost always written in the AP pseudocode from the reference sheet (text version, block version, or robot grid). The most common task is code tracing. You're given a segment and asked what it displays, what value a variable holds at the end, or how many times a loop body executes. A close second is code comparison, where you decide which of several segments produce the same result, or which equivalent Boolean expression matches a given conditional. Robot questions test selection and iteration visually, asking which sequence of MOVE_FORWARD, ROTATE_LEFT, and ROTATE_RIGHT commands gets the robot to the goal. Conceptual questions cover binary search requirements and iteration counts, reasonable versus unreasonable time, when a heuristic is appropriate, and what makes a problem undecidable. Outside the exam, this unit is the backbone of the Create performance task, where you write and explain your own list, procedure, selection, and iteration.
A few exam-specific habits pay off. Always read list indices as starting at 1. Check whether REPEAT UNTIL conditions are ever reached (infinite loops are a favorite distractor). And when two code segments look identical, trace both with a concrete input before assuming they match.
aList[1] is the first element. Mixing these up is the most common list error.b ← a copies the current value of a into b. If a changes later, b does not change with it.REPEAT UNTIL (condition) stops when the condition is TRUE, which feels backwards if you're used to while loops, which run while a condition is true.AP CSP Unit 3 covers 18 topics across algorithms and programming: Variables and Assignments, Data Abstraction, Mathematical Expressions, Strings, Boolean Expressions, Conditionals, Nested Conditionals, Iteration, Developing Algorithms, Lists, Binary Search, Calling and Developing Procedures, Libraries, Random Values, Simulations, Algorithmic Efficiency, and Undecidable Problems. These topics build on each other, starting with basic variables and expressions, then moving into control flow (conditionals and iteration), and finally tackling more advanced ideas like procedural abstraction and the limits of computation. See the full breakdown at /ap-comp-sci-p/unit-3.
The AP CSP Unit 3 progress check includes both MCQ and FRQ parts drawn from the unit's 18 topics. The MCQ section tests concepts like Boolean expressions, conditionals, iteration, lists, and binary search. The FRQ part typically asks you to trace or write code segments involving procedures, variables, and algorithms. The progress check is College Board's built-in checkpoint in AP Classroom, so it closely mirrors the language and format of the actual AP exam. Topics like Developing Algorithms (3.9), Calling Procedures (3.12), and Algorithmic Efficiency (3.17) are especially common targets. Practicing with matched questions at /ap-comp-sci-p/unit-3 is a solid way to prepare before you take the progress check.
AP CSP Unit 3 FRQs most often pull from topics like Developing Procedures (3.13), Developing Algorithms (3.9), Lists (3.10), and Simulations (3.16). These questions ask you to write or trace code, explain what a procedure does, or describe how an algorithm handles specific inputs. To practice effectively, try writing short code segments by hand for each of those topics, then explain your logic out loud as if you're answering a written-response prompt. Focus on being precise about sequencing, selection, and iteration since graders look for correct use of those structures. You can find FRQ-style practice questions at /ap-comp-sci-p/unit-3.
You can find AP CSP Unit 3 multiple-choice and practice test questions at /ap-comp-sci-p/unit-3. That page has resources covering all 18 topics in the unit, from Variables and Boolean Expressions to Binary Search and Undecidable Problems. For the best MCQ prep, look for questions that test conditionals, iteration, and list operations since those show up most on the exam. Mixing topic-specific practice with full unit practice tests helps you spot which concepts still need work before exam day.
Start AP CSP Unit 3 by building a strong foundation in variables, expressions, and Boolean logic before moving to conditionals and iteration, since every later topic depends on those. Then work through lists, procedures, and algorithms in order, writing small code examples for each concept rather than just reading about them. Here's a practical study approach: - **Trace code by hand.** For topics like Binary Search (3.11) and Nested Conditionals (3.7), manually step through examples to see exactly what happens at each line. - **Write your own procedures.** Developing Procedures (3.13) and Developing Algorithms (3.9) are high-value topics. Writing short programs from scratch builds the skill faster than reviewing notes. - **Connect simulations to randomness.** Topics 3.15 and 3.16 (Random Values and Simulations) are often tested together, so study them as a pair. - **Tackle efficiency and limits last.** Algorithmic Efficiency (3.17) and Undecidable Problems (3.18) are conceptual, so save them for after you're comfortable with the coding topics. Visit /ap-comp-sci-p/unit-3 for topic guides and practice questions to check your understanding along the way.
