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 | |
|---|---|---|
| 1| Count | Total | OUTPUT | | AThe header row of a trace table: one column for each variable (Count, Total) plus an OUTPUT column. | |
| 2INPUT Num (value given: 7) | BTotal ← Total + Num | |
| 3Only write a new value in a column when that statement changes the variable | CTake the next value supplied by the question and write it in the Num column on a new row. | |
| 4Anything printed by the algorithm is written in the OUTPUT column | DThe OUTPUT column is missing, so there is nowhere to record what the algorithm displays. | |
| 5Trace table has columns for Count and Total only, but the algorithm uses OUTPUT Total | EValues are copied into columns for variables that did not change on that statement. | |
| 6Row for Count ← Count + 1 also rewrites the Total and Num values, which did not change | FOUTPUT Total |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
trace table — A table used to dry-run pseudocode: one column per variable plus OUTPUT, and a new row each time a statement changes a value. INPUT values come from the question.Num | Total | OUTPUTTotal ← 0
Total ← Total + 4
Row 2: Total = 4INPUT Score
// the question supplies the value 60Count ← 3
OUTPUT Count
OUTPUT row: Count unchanged = 3// Total was 0, Num is 4, now Total is 4
Total ← Total + Num