# Are there problem sets for trace table problems? If not, what are some good topics to cover?

A trace table problem is code that you follow along by hand and fill out variable values at each line. For example.

0  msg = 'hello'
1  num = 5
2  num = num + 1
3  if num < 6:
4      msg = 'goodbye'
5  print(msg)


The table is filled out with variable values at each line number.

line | num | msg     |
0    |     | 'hello' |
1    | 5   | 'hello' |
2    | 6   | 'hello' |
3    | 6   | 'hello' |
4    |     |         |
5    | 6   | 'hello' |


This would be for a collection of beginner language problems, to provide practice and review understanding of programming language operations. These are the CS 101 style problems of what does this print, or what is x at the end of this. An initial topic list might be as follows.

• variable declaration
• function declaration
• function calls
• if / else if / else
• for / while
• arithmetic
• scope
• asynchronous

Are there any resources or existing collections for these types of problems? Specifically looking for Javascript but I can adapt other problems to the language.

## 1 Answer

I'm not aware of such resources, and I expect that there wouldn't be. These are great problems, but you (hopefully) only need to do a few of them until the concepts click into place.

I didn't know these were called trace table problems, but I have often provided them to struggling students in three different contexts:

1. Absolute beginners, where it helps students understand the ideas of assignment and execution order
2. Strugglers, where it helps students understand whatever has them lost, and
3. Students working on very low-level problems, such as assembly, or on processor design. Here it is more of a basic survival tool. There are few, if any, meaningful variable names, and working your way through the values is a straightforward way of figuring out what is going on.

And this gets me to why I don't think you'll find a specific resource for problems like these: in all three of these scenarios, the actual prompt is the specific code we're studying. Tracing the values is just a tool to understand the code that is in front of you. The value-add (and the overarching purpose) comes from that code, not from the trace table per se.