Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1Counter ← Counter + 1 | ATake the current value of Counter, add 1, then store the new value back in the Counter column of the trace table. | |
| 2Total ← Total + Value | BThe student ignored the old value of Counter and only used the 1. They should work out 3 + 1 and write 4. | |
| 3Counter is 4 before this line runs. Working out the right side gives 4 + 1, so 5 is written in the Counter column. | CAdd the current Value to the current Total, then write the answer in the Total column as the new running total. | |
| 4Total is 20 and Value is 7. Work out 20 + 7 by hand, then write 27 in the Total column. Value stays 7. | DTotal ← Total + Value | |
| 5Counter is 3. For Counter ← Counter + 1 the student writes 1 in the Counter column. | EThe student replaced Total with Value instead of adding them. The correct sum is 12 + 5, so 17 goes in the Total column. | |
| 6Total is 12 and Value is 5. For Total ← Total + Value the student writes 5 in the Total column. | FCounter ← Counter + 1 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
Counter ← Counter + 1 — When tracing, work out the right side using the current values, then write the result in that variable's column. The old value is used first, then replaced by the new one.Counter ← 0
Counter ← Counter + 1Total ← 10
Total ← Total + 5
// Total is now 15Total ← 0
Total ← Total + ValueCounter ← 4
Counter ← Counter + 1
// Old value was 4, new value is 5Total ← 12
Value ← 7
Total ← Total + Value