The Stacks
AP COMPUTER SCIENCE A

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.

while loop with integer division

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

Nested loops where the inner bound depends on the outer

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

Enhanced for loop does not modify the array

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

Removing from an ArrayList in a forward loop (the bug)

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

Binary search — tracking low, high, mid

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

Recursion — factorial, calls and returns

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

Counting substring occurrences

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