This handout is based on the ideas presented in An Explicit Strategy to Scaffold Novice Program Tracing by Benjamin Xie, Greg L. Nelson, and Andrew J. Ko.
Program tracing is the process of executing program code by hand, with concrete inputs. Similar to how it is important for children to have the basic skills of reading before they can start writing their own sentences, it is important to be able to execute existing code by hand, before writing own code. This handout explains how to trace C++ programs with pen and paper, and check that traces are correct with C++ Tutor (a version of Python Tutor for C++).
In the first section we start with tracing the most basic programs. Then in each following section we extend our approach to handle more and more complicated language features.