Run and trace AP CSP pseudocode
The AP Computer Science Principles exam is written in a pseudocode that no computer runs, so students learn it on paper, by tracing. This tool runs it. Paste a program in the exam's notation, press Step, and watch each line do its work: every variable and list (indexes start at 1, as on the exam), each condition with its true or false, every pass of a loop, each procedure call and return, and the robot walking its grid. The same program shows in text and in the exam's block form. Free, in the browser, no account.
Using this with a class? Make a free class and add your students yourself: each gets a username and password, with no email or Google account needed. Or give them one join code. Using Google Classroom? Post the link there; with a free class, the link also puts each student in your class, so you see their work.A first lesson: Put a program on the projector, ask the class what the next line will do, then press Step. For a REPEAT UNTIL loop, have them write the trace table on paper first and check it row by row against the one the tool fills in.
Set up a free class Share to Google ClassroomWhat a student actually does
They press Step and line 1 runs: a list appears as a row of boxes, numbered from 1. They step again and a loop begins; the line shows which pass it is on, a condition shows the values it compared and whether it came out true, and the item the program read is outlined in the list. When a procedure is called, a card opens with its own variables and a return arrow draws back to the line that called it. At the end, what the program displayed is on the right, one value after another, as the exam writes it.
From there they can step back, scrub to any step, and switch to the Trace table tab, where a row fills in for every change or for every pass of a loop. They can type their own program or paste one from a worksheet, and the symbols are typed the easy way: <- becomes the assignment arrow. A program that never ends is caught after ten thousand steps and shown, not hung. Robot programs run on a grid they can edit by pressing squares, and the Teach menu holds the tools a teacher runs a lesson with.
What they are learning while they do it
Nothing here is presented as a lesson. This is what the activity is made of, in the terms the course uses.
| What the student does | What it is |
|---|---|
| Steps through a line at a time | Code tracing. Reading code and working out, line by line, what the computer would do. Half the exam's questions ask for exactly this. |
| Watches a list's boxes change | Lists and indexes. On the exam, the first item is at index 1. INSERT, APPEND and REMOVE shift the others, and the trace shows which. |
| Reads a condition's true or false on its line | Boolean expressions. A comparison, with AND, OR and NOT, comes out true or false, and that decides which branch runs. |
| Counts the passes of REPEAT UNTIL | Iteration. The condition is checked before every pass. A loop whose condition is true at the start runs zero times. |
| Follows a call into a procedure and back | Procedures and parameters. The argument is copied into the parameter, the procedure's variables are its own, and RETURN hands a value back to the line that called. |
| Fills a trace table from the run | Trace tables. A row for each change, or each pass of a loop: the way a trace is written on paper and in the exam's answer explanations. |
| Runs a program that uses RANDOM many times | Simulation. One run tells you little. A chart of a thousand runs shows the shape of what the program does. |
| Grows n and counts the steps | Algorithmic efficiency. A step count that doubles every time n grows by one is what the course calls unreasonable. |
| Steers the robot through a grid | The robot problems. MOVE_FORWARD, ROTATE_LEFT, ROTATE_RIGHT and CAN_MOVE, with the exam's rule that a move into a wall ends the program. |
How to tell whether it landed
Ask, and let them show you. A student who has understood it can answer these without pressing Step.
- A list has four items. What does REMOVE(list, 2) do to the item that was at index 3?
- This REPEAT UNTIL loop: how many passes, and why does the first check matter?
- Line 6 calls a procedure. What does the procedure's variable x have to do with the main program's x?
- What will this program display? Write the trace table before you check.
- The robot is facing the wall. What happens on MOVE_FORWARD, and what does the exam say happens?
Use it in your subject
Not a technology class? Then the app is how students show what they learned in your unit. More projects for every subject.
Math
Grow n on a program that counts the even numbers up to n, then on one that checks every pair of items in a list, and compare how the step counts grow.
Practical notes
- AgesHigh school, mainly AP Computer Science Principles students and anyone learning to read code before writing it. Middle schoolers who have met variables and loops can follow the examples.
- TimeA minute to the first step. One example is five to ten minutes on a projector; a class period covers a topic's examples and a worksheet.
- EquipmentAny computer or Chromebook with a modern browser. A projector helps. Nothing to install.
- CostFree. The tool has no paid tier.
- PrepNone. Open the page and pick an example by topic number. Reading this page first takes about three minutes.
- In a groupEveryone runs the same program and writes the next row of the trace table before anyone presses Step. The Teach menu covers the output for an exam-style question with choices A to D.
For AP CSP teachers and tutors
Tracing is taught on paper because the exam's pseudocode has no computer to run on. This gives it one. Every example is organized by the topic numbers of the AP Computer Science Principles Course and Exam Description, every answer the tool shows comes from running the program, and the choices it offers for an exam-style question come from running the program under a common misconception, so each wrong answer is one a real student would give.
- 42 examples by topic, each with a question to ask the class.
- Projector mode, with large code and the current line marked.
- Exam questions, predictions, fill-the-blank, compare programs, run many times, grow n, and a printable trace table worksheet with its answer key.
- Share any program as a link. Nothing is stored on a server.
- Every place the reference sheet leaves something open, the tool says what it chose and marks the step.
Common questions
Is there an AP CSP pseudocode compiler or interpreter online?
This is one. It is an interpreter: it runs the exam's pseudocode directly in your browser, line by line, with nothing to install. There is no compiler step and no other language in between.
Can I run AP CSP pseudocode?
Yes. Type it or paste it from a worksheet, press Step or Run to the end, and the output appears exactly as the exam writes it, one value after another. Both the text form and the block form of the exam's notation are shown.
Does it match the Exam Reference Sheet?
Everything the sheet decides, the tool does the same way: lists start at 1, assignment copies, REPEAT UNTIL checks before each pass, RANDOM includes both ends, DISPLAY puts one space after each value. The sheet leaves many things open, such as what happens when a procedure changes a list it was given. For each of those the tool makes one choice, marks the step where a program depends on it, and lists them all on its Outside the sheet page, so a teacher never presents our choice as exam fact.
Do lists start at 1?
Yes, as on the exam. list[1] is the first item and list[LENGTH(list)] is the last. An index of 0 is a run-time error, and the tool says why, since that is the mistake students bring from other languages.
Does it have the robot?
Yes. MOVE_FORWARD, ROTATE_LEFT, ROTATE_RIGHT and CAN_MOVE run on a grid you can edit: press a square to block it or make it the goal, drag the robot to its start. A move into a wall or off the edge ends the program with the robot where it was, as the exam says.
Can I print a trace table worksheet?
Yes. The Teach menu prints a blank trace table for any program on two pages: the worksheet, then the answer key with every row filled in from the run.
Do students need an account?
No. The tracer runs with no account, and a program can be shared as a link that carries everything in it. A free account adds saving programs as projects, but nothing on this page is behind an account.
Is this an official College Board tool?
No. AP is a trademark registered by College Board, which is not affiliated with, and does not endorse, this site. The examples are organized by the topics of the Course and Exam Description and were all written here; none is copied from an exam.
Still have a question? Ask us, and a person will write back.
Where to go next
Start with Pseudocode Tracer
Trying it costs nothing and takes about five minutes. An account is what makes the work last.
The Pseudocode Tracer is one of the tools on the platform. It is organized by the topics of the AP Computer Science Principles Course and Exam Description. AP is a trademark registered by College Board, which is not affiliated with, and does not endorse, this site.
Page last reviewed October 2026.