WELCH TEACHING & COACHINGComputer Science · AP CSP
← Main site
AP COMPUTER SCIENCE PRINCIPLES • UNIT 1

Computational Thinking
& Program Foundations

A complete concept-first unit with lesson notes, vocabulary, worked examples, immediate answer checks, interactive investigations, and AP-style practice. Learn the reasoning behind programs—not just the Python syntax.

10 × 85-minute blocks7 lessons30 original AP-style practice questionsInteractive investigationsAP CSP 2026–27

Start here — how this unit works

The same visual learning cycle, lesson numbering and assignments appear in the student and teacher packets. The website, not the order inside CodeHS or AP Classroom, determines what to do next.

Unit 1 Student Workbook · 36 printable pages

Guided STRIDES notes, pseudocode, flowcharts, test records and project pages.

Download student workbook (PDF)

Model: use one lesson across three platforms

  1. Website 1.3: learn top-down design.
  2. CodeHS 1.6: watch decomposition lesson and complete The Two Towers.
  3. AP Classroom 1.3: review Program Design and Development.
  4. Workbook pages 14–16: define, diagram, plan and reflect.

Sample videos listed by topic. Access assigned AP Daily materials through your AP Classroom account.

What belongs in the workbook?

STRIDES: Subject, Topic, Rules, Illustrations, Definitions, Example, Steps.

Predict first: a guess with a reason becomes a testable claim.

After coding: give the actual outcome, a bug or insight, and evidence.

Do not: copy all of the CodeHS code into the notebook.

Flowchart: what should I do next?

1. START ON THE COURSE WEBSITEOpen today’s numbered lesson. Read the examples and learning target.
↓
2. WATCH YOUR ASSIGNED CODEHS AND AP DAILY VIDEOSUse the assignment box; providers use different unit orders.
↓
3. COMPLETE WORKBOOK NOTES AND THE VISUAL MODELSTRIDES → vocabulary → flowchart → pseudocode → prediction
↓
4. RUN THE CODEHS ACTIVITY OR WEBSITE LABRecord observed behavior. Compare with your prediction.
↓
Did the result match what you expected?
NO ↓
Trace → debug → retest
Loop back to the prediction.
YES ↓
Explain why, reflect and check tracker.
Practice with the instructions: If the robot does not reach the expected square, follow the NO branch. Which step do you repeat, and what would count as evidence that your revision works?

Eight-unit AP CSP course roadmap

Website sequence for a 16–18-week block course. Efficiency here is an introduction; detailed algorithms return in Unit 5. Create development starts early and culminates in Unit 8.

UNIT 1 · Weeks 1–2Computational Thinking & Foundations
UNIT 2 · Weeks 3–4Digital Information & Encoding
UNIT 3 · Weeks 5–7Pseudocode, Logic & Control
UNIT 4 · Weeks 8–9Lists, Procedures & Abstraction
UNIT 5 · Weeks 10–11Algorithms, Efficiency & Simulation
UNIT 6 · Week 12Systems, Networks & Security
UNIT 7 · Weeks 13–14Data, Society & Impacts
UNIT 8 · Weeks 15–16+Creative Development & Create

Open the full AP CSP course hub. This roadmap is planning guidance, not College Board’s official AP unit ordering.

Unit 1 workbook page map and completion

Website lessonWorkbookAP topic referencesDone
1.1 Precise Algorithmspp. 8-101.2 / 1.3; preview 3.9
1.2 Program Purpose & Iterative Designpp. 11-131.1 / 1.2 / 1.3
1.3 Decomposition & Top-Down Designpp. 14-161.3; preview 3.12
1.4 Abstraction & Reusable Procedurespp. 17-191.3; preview 3.12 / 3.13
1.5 Errors, Debugging & Correctionspp. 20-221.4
1.6 Testing, Tracing & Counterexamplespp. 23-251.4; preview 3.5 / 3.9
1.7 Efficiency, Heuristics & Limits (Preview)pp. 26-283.17 / 3.18 preview; revisit Unit 5

These checkmarks are local to this open page; use the PDF’s tracker for the record you turn in.

Unit overview

Read the lesson notes, work through examples, check your own understanding, and then apply the ideas in interactive investigations. The revised 36-page workbook matches each website lesson and the assigned CodeHS/AP topic references. A separate teacher packet contains the full answer key.

10 blocks2 weeks at 85 min/block
7 lessonsDirect instruction + exploration
30 questionsSelectable by lesson and difficulty

Essential questions

  • What makes an algorithm precise enough for a computer to execute?
  • When is an algorithm practical, and when might a heuristic help?
  • How can decomposition and abstraction improve a solution?
  • How can we tell whether a program behaves correctly?
  • Which test cases expose bugs that ordinary examples miss?

By the end, I can…

  • Write and trace clear, ordered instructions.
  • Explain program purpose, inputs, outputs and behavior.
  • Distinguish errors and design tests to reveal them.
  • Use and justify decomposition and abstraction.
  • Explain how collaborative, iterative design improves programs.
  • Compare step growth and explain why heuristic solutions may not be optimal.
AP alignment: Primary: College Board topics 1.1 Collaboration, 1.2 Program Function and Purpose, 1.3 Program Design and Development, 1.4 Identifying and Correcting Errors. Supporting exposure: 3.9 Developing Algorithms. Control structures here are a preview; detailed AP pseudocode comes in Unit 3. Lesson 1.7 previews AP Topic 3.17 (Algorithmic Efficiency) and 3.18 (Undecidable Problems), revisited in depth in Unit 5.

Lesson map

Follow the workbook cycle: read website notes, watch assigned CodeHS and AP materials, complete STRIDES and visual planning, predict, run an investigation, and reflect. The webpage and workbooks use the same numbering.

LessonFocusLearning targetBlock
1.1Precise algorithmsTrace, evaluate, and revise an unambiguous set of instructions1–2
1.2Program purpose & developmentExplain purpose, function, input, output, and iterative improvement3–4
1.3DecompositionBreak a problem into testable subtasks and plan top-down5
1.4AbstractionUse procedures to manage complexity without changing behavior6
1.5Errors & debuggingDistinguish error types and support corrections with evidence7
1.6Testing & tracingTrack program state, select boundary cases, and find counterexamples8–9
1.7Efficiency & heuristicsCompare operation growth; evaluate exact vs. approximate solutions; recognize computational limits10 (or extension block)

Content summary, notes & worked examples

The notes are student-facing. Each lesson includes definitions in context, a worked example, a common error, and questions with solutions hidden until students choose to see them.

Lesson 1.1 · Workbook pages 8-10

Learning goal: Write, trace, and revise a precise finite sequence of instructions.

CodeHS 2025 Python: 1.1.1 Welcome to AP CSP; 1.2.1 Introduction to Programming With Karel; 1.2.4 Your First Karel Program; 1.3.4 Make a Tower
AP Classroom topics: 1.2 / 1.3; preview 3.9 — open assigned videos in AP Classroom.
Website lab: Precision Robot Lab A.
Learn & recordVisualize & planApply & reflect

Open the public CodeHS course outline for verified activity numbering; teacher assigns the selections in class.

Lesson 1.1 · Blocks 1–2

Algorithms and precise instructions

Core idea: An algorithm is a finite sequence of precise steps that performs a task. The computer does exactly what the instructions tell it to do—not what the author intended. A useful algorithm specifies its starting conditions, allowable operations, and the result it should produce.

What makes an algorithm reliable?

  1. Precision: each command has one clear meaning.
  2. Sequence: steps run in a defined order unless control structures change that order.
  3. Preconditions: assumptions about the starting state are stated.
  4. Termination: the process eventually finishes for the intended inputs.
  5. Correctness: it produces the required result for its specified inputs.
Worked example: Follow the robot, not your intuition.

Robot begins at (1,1), facing east. Commands are MOVE, LEFT, MOVE, RIGHT, MOVE. Each MOVE advances exactly one grid cell; LEFT and RIGHT rotate 90° without moving.

  1. MOVE → (2,1), east
  2. LEFT → (2,1), north
  3. MOVE → (2,2), north
  4. RIGHT → (2,2), east
  5. MOVE → (3,2), east

Final position: (3,2), facing east. Coordinates in this example use positive y upward; the robot simulator below uses screen-grid coordinates with y increasing downward.

Common mistake: Treating turns as movement, or assuming that a robot knows how far to travel when told to “move toward the wall.” State the number of cells or an explicit stopping condition.

Check your understanding

1. A robot starts facing north. It executes RIGHT, MOVE, MOVE, LEFT, MOVE. What direction does it face at the end?
Show solution

North. RIGHT makes it face east; the two moves do not change direction; LEFT returns it to north; the final move also preserves direction.

2. Why is “move a little farther” not a suitable robot command?
Show solution

“A little” has no precise distance or testable condition. Replace it with something like “MOVE twice” or “REPEAT UNTIL the next cell is a wall.”

3. Challenge. An algorithm reaches the goal when the robot faces east but fails from the same cell when it faces south. Is the algorithm necessarily incorrect?
Show solution

Not necessarily. If facing east is an explicit precondition, success from the specified state can be sufficient. If it claims to work from any starting orientation, the south-facing case is a counterexample.

Lesson 1.2 · Workbook pages 11-13

Learning goal: Explain a program’s purpose, behavior, inputs, outputs, and iterative improvement.

CodeHS 2025 Python: 1.1.2 Why AP CSP?; 3.1.1 What is Code? (preview); 3.2.1 Uses of Programs (preview)
AP Classroom topics: 1.1 / 1.2 / 1.3 — open assigned videos in AP Classroom.
Website lab: Robot design and user-purpose model.
Learn & recordVisualize & planApply & reflect

Open the public CodeHS course outline for verified activity numbering; teacher assigns the selections in class.

Lesson 1.2 · Blocks 3–4

Program purpose, function and iterative design

Core idea: A program's purpose is why it was made. Its function is what it does; its behavior is what happens when it runs. Distinguishing these concepts helps us explain a program without simply listing its instructions.

InputData provided to a program, such as a temperature reading or a button press.
OutputInformation or an action produced by a program, such as a message or a motor command.

Plan → create → test → revise

Programs are commonly developed iteratively. A first version may satisfy some needs while exposing weaknesses. User feedback, test evidence, and changing requirements inform subsequent revisions.

Worked example: School arrival alert

A program accepts a bus's estimated arrival time and notifies riders when the bus is at most five minutes away.

  1. Purpose: help riders avoid missing the bus.
  2. Input: estimated minutes until arrival.
  3. Processing: compare that value to 5.
  4. Output: an alert or a “not yet” message.
  5. Behavior: given input 4, it displays “Bus arriving soon.”

A tester reports alerts at negative arrival times. One revision is to check that the data is valid before displaying the warning.

Common mistake: “It displays a red warning” describes a behavior. “It helps riders prepare for an approaching bus” describes its purpose.

Check your understanding

1. A fitness app counts daily steps and displays a chart. Give one input and one output.
Show solution

Input: step-count data from a sensor or stored records. Output: a chart of daily steps. Other accurate examples may be acceptable.

2. A developer changes a program after classmates report that the directions are confusing. What development process does this demonstrate?
Show solution

Iterative development: feedback informs a revision, which can then be tested again.

3. Challenge. Explain why a program could behave as designed but still fail at its purpose.
Show solution

All programmed steps may run correctly while the design solves the wrong problem. For example, a bus alert may correctly display at five minutes but be too late for riders who need ten minutes to reach the stop.

Lesson 1.3 · Workbook pages 14-16

Learning goal: Break a complex problem into testable, meaningful subtasks.

CodeHS 2025 Python: 1.5.1 Functions in Karel; 1.6.1 Top Down Design and Decomposition; 1.6.4 The Two Towers; 1.7.1 Commenting Your Code
AP Classroom topics: 1.3; preview 3.12 — open assigned videos in AP Classroom.
Website lab: Robot and top-down route plan.
Learn & recordVisualize & planApply & reflect

Open the public CodeHS course outline for verified activity numbering; teacher assigns the selections in class.

Lesson 1.3 · Block 5

Decomposition and top-down design

Core idea: Decomposition separates a large problem into smaller problems that can be designed, tested, and discussed more easily. In top-down design, start with the overall goal, then define the subtasks required to achieve it.

Worked example: Design a delivery robot

Overall task: deliver a package from the entry area to a classroom.

DELIVER_PACKAGE()
    NAVIGATE_TO_CLASSROOM()
    VERIFY_DESTINATION()
    DROP_OFF_PACKAGE()
    CONFIRM_DELIVERY()

Now refine NAVIGATE_TO_CLASSROOM() into smaller tasks, such as EXIT_ENTRY_AREA(), FOLLOW_HALLWAY(), and TURN_AT_INTERSECTION(). Each subtask should have a clear responsibility and expected outcome.

Common mistake: Decomposition does not automatically make code shorter or faster. Its key benefit is making a complex system easier to reason about, divide into tasks, and test.

Check your understanding

1. Break “prepare a school newsletter” into at least three meaningful subtasks.
Show sample answer

Collect announcements, edit and organize stories, format the newsletter, and distribute the final version. Other sensible decompositions are valid.

2. Why should each subtask have a clearly defined input and outcome?
Show solution

It lets other parts of the system use the subtask predictably and makes each part easier to test independently.

3. Challenge. Two teams both divide a navigation program into functions. One team creates one function for every single move. Which design is more useful, and why?
Show sample answer

Functions that represent meaningful subtasks (such as navigating a hallway) usually manage complexity more effectively than one function per trivial command, although the best boundaries depend on the problem.

Lesson 1.4 · Workbook pages 17-19

Learning goal: Use a meaningful procedure name to hide details without changing expected behavior.

CodeHS 2025 Python: 1.8.1 Abstraction; 1.8.3 Abstracting Away build_tower; 1.8.4 Abstracting Your Day; 1.7.4 The Two Towers + Comments
AP Classroom topics: 1.3; preview 3.12 / 3.13 — open assigned videos in AP Classroom.
Website lab: Abstraction comparison in the Robot Lab.
Learn & recordVisualize & planApply & reflect

Open the public CodeHS course outline for verified activity numbering; teacher assigns the selections in class.

Lesson 1.4 · Block 6

Abstraction: hide details without hiding meaning

Core idea: An abstraction keeps the important features of something visible while hiding implementation details that are unnecessary for the current task. A named procedure can let someone reason about what an operation accomplishes before investigating how it is implemented.

Worked example: Two levels of the same algorithm

Detailed version:

MOVE
MOVE
LEFT
MOVE
RIGHT

Higher-level version:

NAVIGATE_AROUND_CORNER()

If NAVIGATE_AROUND_CORNER() faithfully performs the original sequence, a caller can use the meaningful name without reading every lower-level instruction. This example uses a descriptive procedure name, not a predefined AP exam robot operation.

Decomposition versus abstraction

Decomposition asks, “What smaller tasks make up the big problem?” Abstraction asks, “Which details can we hide so the task is easier to use and understand?” They are related, but not identical.

Common mistake: Hiding a faulty implementation does not fix it. An abstraction must still provide the behavior its name or contract promises.

Check your understanding

1. Which details are hidden when a program calls DRAW_SQUARE()?
Show solution

The individual movement and turning commands, or other lower-level drawing operations, can be hidden behind the procedure call.

2. A team replaces four repeated commands with a named procedure but changes the ending position. Has it preserved the intended behavior?
Show solution

No, not if the original ending position was required. A useful abstraction must preserve its specified behavior.

3. Challenge. Give an example where showing too many implementation details makes a program harder to understand.
Show sample answer

A main program that repeats dozens of low-level motion commands may obscure its overall goal. A few named procedures can expose the sequence of major tasks while keeping detailed instructions separate.

Lesson 1.5 · Workbook pages 20-22

Learning goal: Use evidence to identify syntax, runtime, and logic errors and justify fixes.

CodeHS 2025 Python: 1.2.6 Dancing Karel; 1.15.1 Debugging Basics; 1.15.3 Debug: The Two Towers; 1.15.5 Debugging From Error Messages
AP Classroom topics: 1.4 — open assigned videos in AP Classroom.
Website lab: Debugging Lab C.
Learn & recordVisualize & planApply & reflect

Open the public CodeHS course outline for verified activity numbering; teacher assigns the selections in class.

Lesson 1.5 · Block 7

Identifying and correcting errors

Core idea: Testing compares expected results with actual results. Debugging investigates the cause of a mismatch and changes the program in a way supported by evidence.

Syntax errorCode violates the rules of its language and generally cannot be interpreted or compiled successfully.
Runtime errorA problem occurs during execution; the program may stop unexpectedly or fail to complete an operation.
Logic errorThe program runs but gives behavior inconsistent with its requirements.
Boundary caseAn input at or near the edge of an allowed range, where faulty conditions often appear.
Worked example: Off-by-one alert

Rule: A student receives a certificate with a score of 80 or higher. Program condition:

IF (score > 80)
{
    DISPLAY("Certificate earned")
}
  1. Test score 81 → expected yes, actual yes.
  2. Test score 79 → expected no, actual no.
  3. Test score 80 → expected yes, actual no.

Diagnosis: a logic error at the boundary. Correction: change score > 80 to score ≥ 80.

Common mistake: A program can run without crashing and still be wrong. Successful execution does not prove correct output.

Check your understanding

1. A program divides by a user-supplied value and crashes when the value is zero. What general category of error does this illustrate?
Show solution

A runtime error caused by an invalid operation during execution. The input zero is an important test case.

2. A program uses age < 18 to represent “age 18 and younger.” What is wrong?
Show solution

It excludes age 18. Use age ≤ 18 to include the boundary.

3. Challenge. Why should a bug report record both expected and observed behavior?
Show solution

The comparison provides reproducible evidence of the failure and helps locate the statement responsible rather than relying on vague reports like “it doesn't work.”

Lesson 1.6 · Workbook pages 23-25

Learning goal: Trace changing state and design normal, boundary, and unusual test cases.

CodeHS 2025 Python: 1.15.2 Debugging Basics; 1.16.1 Karel Algorithms; 1.16.2 Quiz: Which Control Structure?; 1.19.1 Introduction to Programming Quiz (when ready)
AP Classroom topics: 1.4; preview 3.5 / 3.9 — open assigned videos in AP Classroom.
Website lab: Tracing Lab B.
Learn & recordVisualize & planApply & reflect

Open the public CodeHS course outline for verified activity numbering; teacher assigns the selections in class.

Lesson 1.6 · Blocks 8–10

Testing strategies and trace tables

Core idea: A trace table records how variable values change during execution. A test suite selects inputs deliberately, including typical inputs, boundary values, and invalid inputs if those must be handled. One successful test does not prove correctness for every possible input.

Worked example: Trace a variable carefully
value ← 2
value ← value + 5
value ← value * 3
DISPLAY(value)
Executed stepvalue after step
value ← 22
value ← value + 57
value ← value * 321
DISPLAY(value)21

Final output: 21. Assignment changes the stored value; it is not a mathematical equation that remains true forever.

Design tests around requirements

If a website accepts ages from 13 through 18 inclusive, useful tests include 12, 13, 15, 18, and 19. This suite checks values just below, at, inside, at, and just above the permitted interval.

Common mistake: Testing five random middle values may miss the exact boundary that contains the bug. Choose test cases based on the required behavior.

Check your understanding

1. Trace x ← 3; x ← 2 * x; x ← x - 4. What is the final value?
Show solution

3 → 6 → 2, so the final value is 2.

2. A program accepts temperatures from 0 through 100 inclusive. Which inputs would you choose to test the two boundaries?
Show solution

At minimum, test 0 and 100. Include -1 and 101 to verify that just-outside values are rejected.

3. Challenge. A student claims an algorithm works for every nonnegative integer. You find one nonnegative input that produces an incorrect result. What can you conclude?
Show solution

The universal claim is false. A single valid counterexample is enough to disprove “works for every nonnegative integer.”

Lesson 1.7 · Workbook pages 26-28

Learning goal: Compare growth of work and explain heuristic vs optimal solutions.

CodeHS 2025 Python: 1.16.1 Karel Algorithms (support only); use site Efficiency Lab D for this topic
AP Classroom topics: 3.17 / 3.18 preview; revisit Unit 5 — open assigned videos in AP Classroom.
Website lab: Efficiency Lab D.
Learn & recordVisualize & planApply & reflect

Open the public CodeHS course outline for verified activity numbering; teacher assigns the selections in class.

Lesson 1.7 · Block 10 or extension block · AP 3.17–3.18 preview

Algorithm efficiency, heuristics & computational limits

Core idea: Two algorithms can produce the same correct answer but require very different amounts of work. We often approximate efficiency by counting operations as input size n grows instead of measuring seconds on a particular computer. Sometimes an exact best answer is expensive to find; a heuristic seeks a useful answer efficiently without guaranteeing it is best.

How does the work grow?

For an illustrative algorithm that performs n operations, doubling the input doubles the work. For one requiring n × n operations, doubling the input quadruples the work. For one requiring 2^n operations, each increase of one input element doubles the work. The AP framework classifies polynomial or slower growth as reasonable time and exponential or factorial growth as unreasonable time; this is about how work scales, not a guarantee of fast performance for every small input.

Worked example: Comparing operation counts

One algorithm examines every item exactly once; a second compares every item with every other item. For a list of 10 items, they perform approximately 10 vs. 100 basic steps. For 20 items, the counts become 20 vs. 400. Both are reasonable-time growth, but the first scales more favorably.

Exact solutions, heuristics and undecidability

An exact algorithm for a shortest route seeks a provably shortest valid route. A heuristic such as “go to the nearest unvisited stop next” can quickly produce a useful route, but may miss a shorter one. A problem that takes an impractically long time is not the same as an undecidable problem, for which no algorithm can correctly decide every possible instance.

Important distinction: Time complexity, optimality and decidability are three different questions. Formal Big-O calculations are enrichment, not a required AP CSP skill.

Check your understanding

1. An algorithm needs 8 operations for 8 inputs and 16 for 16 inputs. Which growth model best matches these observations?
Show solution

Linear. Doubling input doubles work. Two observations suggest linear growth but do not prove the behavior for all inputs.

2. A second algorithm takes roughly n² operations. What happens when the input size triples?
Show solution

The work becomes approximately nine times as large because (3n)² = 9n².

3. A nearest-neighbor route is 19 distance units; another route is 16. What can you conclude?
Show solution

The 19-unit heuristic route is not optimal, since a shorter valid route exists. The 16-unit route is not necessarily globally optimal unless you show no shorter route exists.

4. Challenge. How does an algorithm that requires billions of steps differ from an undecidable problem?
Show solution

For the first problem, a correct algorithm exists but may be impractical. For an undecidable decision problem, no algorithm can correctly answer every possible instance.

Vocabulary & reference notes

Use this as a student study list. The detailed descriptions appear in the lesson notes; students should be able to define terms and use them in an example.

Language of algorithms

  • Algorithm
  • Program
  • Sequence
  • Precondition
  • State
  • Input
  • Output
  • Program purpose
  • Program behavior
  • Iteration

Design & testing

  • Decomposition
  • Top-down design
  • Abstraction
  • Procedure
  • Parameter
  • Debugging
  • Syntax error
  • Runtime error
  • Logic error
  • Boundary case
  • Test case
  • Counterexample

Efficiency & computational limits

  • Input size
  • Operation count
  • Time complexity
  • Linear growth
  • Polynomial growth
  • Exponential growth
  • Factorial growth
  • Reasonable time
  • Unreasonable time
  • Heuristic
  • Optimal solution
  • Undecidable problem
AP notation reminder

In College Board pseudocode, ← means assignment. A condition such as x ≥ 5 compares values; it does not change x. Python uses = for assignment and == for equality comparisons.

Lesson videos & resources

Watch a short explanation after reading the corresponding notes. Then return to the worked examples and quick checks. Some CodeHS and AP Classroom videos require student login.

1.1 Algorithms: Khan Academy — Algorithms · CodeHS lessons 1.2–1.4.
1.4 Abstraction: CodeHS 1.8 — Abstraction.
1.5 Debugging: CodeHS 1.15 — Debugging Strategies · AP Classroom Topic 1.4.
1.6 Testing and tracing: Khan Academy — Verifying Algorithms · AP Classroom Topic 1.4.
1.7 Efficiency and heuristics: Khan Academy — Using heuristics · AP Classroom topics 3.17–3.18.

Interactive lab A — The precision robot

Predict before running. The robot starts at column 1, row 5, facing east. The target is at column 4, row 2. Coordinates increase from left to right and top to bottom.

Robot workspace

Gray cells are walls. Gold cell is the goal. The robot cannot move outside the grid or through a wall.

Ready. Choose a challenge and predict its outcome.

Supported commands: MOVE, LEFT, RIGHT. You may edit the program and test your own solution.

Investigation evidence
Record: initial prediction, actual final position, first failing command (if any), and one specific revision to make the algorithm correct. Explain how each instruction contributes to the goal.

Interactive lab B — Trace the algorithm

Use AP-style assignment notation. Predict the output before stepping through the variable states.

Trace program

score ← 2 score ← score + 3 score ← score * 2 IF (score > 9) { score ← score - 4 } DISPLAY(score)
State 0 of 5: no instructions executed.

Trace table

StepExecuted actionscore
Think: What would happen if the condition changed from > 9 to > 10? Construct a counterexample input for a similar condition-based algorithm.

Interactive lab C — Debugging and test selection

Examine the intended requirement, run targeted tests, and identify the error. This lab requires reasoning about boundary values rather than programming syntax.

The requirement

Students with a score of 70 or higher should receive PASS. Every other score receives RETRY.

IF (score > 70) { DISPLAY("PASS") } ELSE { DISPLAY("RETRY") }
Choose a test and compare expected with actual behavior.

Testing record

InputExpectedActualResult

Interactive lab D — Efficiency and heuristic routes

Predict first, manipulate input size, record outcomes, then explain why the results occur. No Python required.

Investigation A · How does the work grow?

Model A does n operations, Model B does n², and Model C does 2^n. These are illustrative algorithms; real runtimes also depend on hardware and implementation.

10A · Linear (n)
100B · Quadratic (n²)
1,024C · Exponential (2ⁿ)
Linear
Quadratic
Exponential

Bar lengths use a logarithmic display scale to keep all three models visible; the exact operation counts are above.

Before moving the slider: Predict which model increases most sharply when n doubles from 5 to 10. Then compare n = 5, 10, 20 and enter the operation counts into a table on paper.
Analysis: Which models are considered reasonable-time growth in AP CSP, and which is unreasonable-time growth?
Check explanation

Linear and quadratic are reasonable-time growth (polynomial or better). Exponential growth is unreasonable-time growth. Even a polynomial algorithm can still be slow on a specific large input.

Investigation B · Nearest-neighbor delivery routes

Start at A. The heuristic chooses the nearest unvisited stop next, then returns to A. Compare it with a shortest route determined by checking all possible stop orders. All distances are Euclidean and the plane is an idealized model.

Predict the next stop before showing the heuristic.
Analysis: Does the nearest-neighbor route always equal the shortest route?
Check explanation

No. It makes the best immediate choice, but a locally short move may lead to a longer overall route. Finding any shorter valid route is enough to show the heuristic was not optimal.

Extension: Why might someone deliberately use a heuristic when an exact method is available?
Check explanation

For a large optimization problem, checking all candidate solutions may require unreasonable time. A heuristic may find a useful answer much faster, even though it cannot guarantee the best answer.

AP-style unit practice & self-check

30 questions across seven lessons, with foundation, AP-style, and challenge levels. Feedback explains the reasoning. These are independently written practice items, not official College Board questions.

Practice mode

30 available questions
Answer a question to get feedback.

Teacher implementation plan

A flexible two-week framework that keeps CodeHS programming but adds systematic reasoning and AP conceptual practice.

Ten 85-minute blocks + optional extension

BlockFocus and time allocationDeliverable
1Diagnostic 15 · precision mini-lesson 20 · human computer 35 · debrief 15First algorithm + failure analysis
2CodeHS Karel 40 · robot simulator 30 · explanation 15Predicted vs. actual path log
3Program purpose 20 · CodeHS 35 · user scenario 20 · exit 10Purpose/input/output specification
4Iterative design 20 · group redesign 40 · tests 15 · exit 10Revision log with rationale
5Decomposition 20 · CodeHS 35 · function planning 20 · exit 10Top-down design diagram
6Abstraction 20 · compare algorithms 30 · CodeHS 25 · retrieval 10Abstraction explanation
7Error categories 20 · debug lab 35 · CodeHS debugging 20 · exit 10Bug report and correction
8Boundary tests 15 · team test design 35 · trace lab 25 · exit 10Five-case test plan
9Tracing and tests 25 · algorithm reasoning 20 · question bank 30 · exit 10Practice score and corrections
10Efficiency and heuristic lesson/lab 45 · short assessment 25 · reflection 15 (or shift lab to an extension block)Efficiency lab report and unit assessment; schedule full assessment in an extension block if needed

Summative assessment blueprint — 40 points

  • 12 multiple-choice questions × 2 = 24 points (including two efficiency items)
  • One algorithm trace and explanation = 6 points
  • One error identification + boundary test = 6 points
  • One decomposition/abstraction explanation = 4 points

Build the summative separately from the practice bank to preserve assessment integrity.

Success criteria

  • At least 80% on precision, purpose and error identification items.
  • Accurate step-by-step trace with state changes recorded.
  • A test plan including at least one boundary case.
  • Explanation of why abstraction reduces complexity.

Use item-level results to assign brief intervention sets.

Lesson-level question-bank specifications and tags

Lessons 1–6 contain four prototype items each; Lesson 1.7 adds six items across all three difficulties. Expand the full bank to 12–15 items per lesson (84–105 total) before summative deployment, preserving misconceptions, distractor rationale, and skill tags. Record: id, lesson, AP_topic, level, stem, options, correct, explanation, misconception.

Tag targets: L1 sequence/ambiguity; L2 purpose/input/output/iteration; L3 decomposition/reuse; L4 abstraction/details; L5 error classification; L6 trace/edge cases/tests; L7 input growth/heuristic/optimality/undecidability. Plan four parallel forms and avoid student-visible answer keys until practice submission.

Teacher lesson specifications & CodeHS alignment

For planning: exact targets, CodeHS lessons, video suggestions, misconceptions, lab deliverables, question-bank coverage and suggested block structure.

Verified resource library

Student workbook — Unit 1

36 pages, all seven lessons, all four labs, project and review.

Download workbook PDF

Open the original providers. Some CodeHS lessons and AP Classroom videos require student or teacher login; links below deliberately avoid guessing private deep-link URLs.

CodeHS — 2025 AP CSP Python

Actual module 1: Welcome; Karel; functions; top-down design; commenting; abstraction; debugging; algorithms.

Khan Academy — AP CSP Algorithms

Video and practice sequence: building blocks, expressing algorithms, verifying algorithms.

Code.org — What makes a computer?

Short contextual video about inputs, outputs, processing and storage.

College Board — AP Classroom

Official AP Daily videos, topic questions, and progress checks accessed within AP Classroom.

College Board — CSP reference

Official pseudocode conventions and reference sheet; later units use this as a persistent reference.

Additional conceptual work

1729 Math and open textbook for enrichment, vocabulary and supporting readings.

Unit 1 Student Workbook

Use the student workbook alongside the lessons, practice questions, and interactive labs.

Download the student workbook (PDF) Open workbook in a new tab

Open the student workbook PDF to view or download it.