The Stacks
AP COMPUTER SCIENCE PRINCIPLES

Code tracer

Step through real exam-style code one line at a time and watch every variable change. This is the skill behind most of the multiple-choice section — every trace below was recorded by actually running the program, so what you see is exactly what happens.

REPEAT UNTIL — sum 1 through 4

Step through with the buttons, or use the ← → keys. Changed variables are highlighted.

List operations — INSERT, REMOVE, APPEND

Step through with the buttons, or use the ← → keys. Changed variables are highlighted.

Calling a procedure twice

Step through with the buttons, or use the ← → keys. Changed variables are highlighted.

Find the maximum with FOR EACH

Step through with the buttons, or use the ← → keys. Changed variables are highlighted.