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.