Learn the exam reference language, trace programs, and reason about selection and iteration.
6 lessons15 estimated blocksAP topics 3.1, 3.3–3.918 original exam questions
Unit overview
Use these lessons like the Algebra II and Physics pages: read the notes, learn the vocabulary, follow a worked example, attempt the quick checks before revealing solutions, and make a prediction before running the investigation.
15 blocks85-minute blocks, approximately 5–7 in the 16-week map
6 lessonsNotes, examples, vocabulary and quick checks
18 questionsFilterable exam-style bank
Success criteria
Translate between Python and AP pseudocode.
Evaluate AND, OR and NOT accurately.
Trace IF / ELSE IF / ELSE branching.
Trace counted and condition-controlled loops.
Create trace tables for multi-step programs.
Explain an algorithm in natural language.
Course model: CodeHS for targeted coding, this page for conceptual understanding, and AP Classroom for official aligned assessment. This is an original supplementary resource, not an official College Board publication.
Lesson map
Lesson numbering on this page is site-specific. CodeHS uses a different lesson numbering system.
4.12 Python Control Structures Quiz; 1.15 Debugging Strategies
Content notes, vocabulary & worked examples
Each lesson ends with two quick checks. Open each answer only after attempting the problem.
Lesson 3.1 · AP 3.1, 3.3–3.5 · 1–2 blocks
AP reference language and assignment
CodeHS: 3.4 Variables; 3.6 Basic Math in Python
Learning targets
Translate between Python and AP pseudocode.
Trace assignment and arithmetic updates.
Core notes
AP pseudocode uses ← for assignment and DISPLAY for output. Evaluation occurs before assignment: x ← x + 1 is meaningful. DIV and MOD represent integer quotient and remainder. Parentheses determine grouping. Refer to the official AP reference sheet rather than assuming Python syntax or behaviors.
Vocabulary
assignment store evaluated value
variable named stored value
MOD remainder operation
DISPLAY output instruction
Worked example
x ← 5; y ← x MOD 2; x ← x + y; DISPLAY(x) gives 6.
Try it · Check your understanding
1. What does x ← x + 3 do?Show solution
It evaluates the old value of x plus three, then stores the result in x.
Boolean values are true or false. AND requires both operands true; OR requires at least one; NOT negates a value. Use parentheses to avoid precedence confusion. A condition can be logically valid even if it is never satisfied for a particular set of inputs.
Vocabulary
Boolean true/false value
AND both conditions true
OR at least one condition true
NOT negation
comparison tests relation between values
Worked example
For x=7, (x>5) AND (x<10) is true; (x<3) OR (x=7) is also true.
Try it · Check your understanding
1. Is NOT (true AND false) true or false?Show solution
True: true AND false is false, then NOT makes it true.
2. Is (x<0) AND (x>10) possible for an ordinary number?Show solution
CodeHS: 4.4 If Statements; 1.11 If Statements; 1.12 If/Else Statements
Learning targets
Trace IF / ELSE IF / ELSE branching.
Choose boundary tests for decision logic.
Core notes
A conditional executes only the branch whose test is satisfied. Ordering matters: the first satisfied branch in an IF/ELSE IF chain wins. Nested decisions are evaluated only when their enclosing branch is entered. >= versus > is a common boundary error.
Vocabulary
selection conditional branch
branch path through a program
boundary case input at decision cutoff
Worked example
IF score≥90: A; ELSE IF score≥80: B; ELSE: C. Score 80 produces B and 90 produces A.
Try it · Check your understanding
1. Which grade appears for score 79?Show solution
C, because neither preceding condition is true.
2. Why test score 90 and 89?Show solution
They straddle the cutoff and can expose > versus ≥ mistakes.
CodeHS: 4.6 For Loops in Python; 4.10 While Loops; 1.13 While Loops in Karel
Learning targets
Trace counted and condition-controlled loops.
Detect nontermination and off-by-one errors.
Core notes
Iteration repeats a block of statements. REPEAT n TIMES runs a block n times. REPEAT UNTIL(condition) continues until its condition becomes true (the AP reference specifies its exact behavior). Always record variable changes after each iteration. An unchanged loop variable may prevent termination.
Vocabulary
iteration repeating instructions
loop guard condition controlling repetition
off-by-one one too many/few iterations
termination eventual stop
Worked example
x ← 0; REPEAT 4 TIMES { x ← x + 2 }; DISPLAY(x) gives 8.
Try it · Check your understanding
1. How many additions does REPEAT 5 TIMES perform?Show solution
Five if the addition occurs once within its repeated block.
CodeHS: 4.7 General For Loops; 4.8 For Loop Practice; 4.11 Loop and a Half
Learning targets
Create trace tables for multi-step programs.
Differentiate final state from intermediate output.
Core notes
Use one row per executed operation or iteration, not just one row per line of source code. Track multiple variables and any DISPLAY statement. Nested loops multiply executions; if an outer loop runs 3 times and its inner loop runs 4 times each time, the inner body executes 12 times.
Vocabulary
trace table record of state changes
state current stored values
nested loop loop inside another loop
Worked example
total ← 0; REPEAT 3 TIMES { REPEAT 2 TIMES { total ← total+1 } }; total becomes 6.
Try it · Check your understanding
1. How many times does the inner block run for 4 outer and 3 inner repeats?Show solution
12 times.
2. Why is recording only the final sum insufficient?Show solution
It conceals when variables changed and makes debugging harder.
CodeHS: 4.12 Python Control Structures Quiz; 1.15 Debugging Strategies
Learning targets
Explain an algorithm in natural language.
Choose inputs that expose specific incorrect behavior.
Core notes
A correct output on one input does not prove an algorithm correct for all inputs. Compare two algorithms using counterexamples. Design tests for zero, first/last values, branches, boundaries, and termination. Evaluate correctness before speed.
Vocabulary
counterexample input disproving claim
test case chosen input and expected result
correctness behavior matches specification
Worked example
To test an algorithm claiming to identify even numbers, use 0, 1, 2, -2, and an odd negative number if negatives are permitted.
Try it · Check your understanding
1. Can one successful test prove program correctness?Show solution
No; other inputs may reveal failures.
2. Why compare outputs of algorithms on boundary inputs?Show solution
Small differences often emerge at branch or loop boundaries.
Core video selection: The matching CodeHS lesson video and AP Daily topic video for each lesson. Direct AP Daily videos are accessed inside the school's AP Classroom enrollment and may not have public URLs.
Lesson 3.1: AP reference language and assignment. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.1, 3.3–3.5; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
Lesson 3.2: Boolean expressions. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.5–3.6; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
Lesson 3.3: Selection and nested conditionals. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.6; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
Lesson 3.4: Iteration: REPEAT and REPEAT UNTIL. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.8; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
Lesson 3.5: Trace tables and nested structures. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.5–3.9; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
Lesson 3.6: Testing and algorithm comparison. Watch the matched CodeHS lesson video and the corresponding AP Daily topic video for 3.7–3.9; pause to answer the notes prompt before the interactive lab. AP Daily requires student login.
Video selections are topic- and platform-matched. Teachers should check account availability and assign individual CodeHS/AP Daily clips from their course dashboards.
Make a prediction, manipulate the model, record observations, and explain whether your original thinking was correct.
Student lab record: Before you start, write your prediction and reasoning. Afterward, record at least two trials and an evidence-based conclusion. This model is illustrative and its limitations should be noted.
Investigation A · Pseudocode execution
Predict the final output before stepping. This sample uses official-style assignment, REPEAT and DISPLAY notation.
total ← 1
REPEAT 4 TIMES {
total ← total * 2
}
DISPLAY(total)
Completed iterations 0
Current total 1
Displayed output —
Initialization complete. Predict before stepping.
Investigation B · Boolean logic table
Choose a logical operator. Verify all four possible combinations of two Boolean values.
Investigation record
Lab responses stay in this page; they are not uploaded or stored on a server.
AP-style practice & self-check
Original multiple-choice questions focus on reasoning, not just coding. Filter by lesson and difficulty. Show explanations in practice mode or hide them in exam mode.
Mastery target: 80% on mixed original questions, plus a clear written explanation on one unfamiliar scenario. Treat the bank as practice, not a secure test.
Teacher lesson specifications & implementation
Teacher-facing scope, exact learning goals, CodeHS alignments, and assessment requirements. This section can be hidden or separated before student publishing.
Pacing and lesson allocation
15 × 85-minute blocks. Shorten or extend CodeHS programming time based on prior experience and how many blocks actually meet; all lessons are supplemental to the main CodeHS course.
Default block: 10 min retrieval · 20 min notes/video · 20 min inquiry · 25 min selected CodeHS/independent practice · 10 min quick assessment.
Lesson
AP
CodeHS
Measurable targets
Assessment specifications
3.1 AP reference language and assignment
3.1, 3.3–3.5
3.4 Variables; 3.6 Basic Math in Python
Translate between Python and AP pseudocode.; Trace assignment and arithmetic updates.
40 points: 20 original AP-style multiple-choice questions (1 point each), four short-answer reasoning prompts (3 points each), and one 8-point novel investigation/analysis. Mix current-unit and prior-unit topics. Use AP Classroom separately for official question practice.
Assessment and feedback strategy
Independent predictions precede each simulation.
Students justify one wrong multiple-choice distractor in writing.
Teacher verifies model limitations, not just numeric answers.
Repeat key pseudocode and binary ideas in later units.