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 | |
|---|---|---|
| 1DECLARE Total : INTEGER | ADECLARE Num : INTEGER DECLARE Sum : INTEGER DECLARE Count : INTEGER | |
| 2FOR Count ← 1 TO 4 | BTotal needs its own column in the trace table, placed in the order the variable first appears | |
| 3Variables are listed as columns in the order they first appear in the algorithm | CSum ← 0 | |
| 4A starting value is entered in the first row of the variable's column | DCount and Num have no columns. Each variable must have its own column. | |
| 5A trace table with only one column, Total, for an algorithm that declares Total, Count and Num | EThe loop counter Count also gets its own column, and its value changes on each pass of the loop | |
| 6Row 1: Count = 1, Total = 5 Row 2: Count = 1, Total = 5 (Count repeated) | FCount is written again even though it did not change. The cell should be left blank. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
one column per variable — To set up a trace table, give each variable its own column in the order they first appear, then add a row each time a value changes. Leave unchanged cells blank.DECLARE Total : INTEGER
DECLARE Count : INTEGER
Columns: Total | Count | OUTPUTFOR Num ← 1 TO 3
Total ← Total + Num
Columns: Num | Total | OUTPUTDECLARE Score : INTEGER
// Score gets its own trace table columnDECLARE Total : INTEGER
Total ← 0
// The Total column starts at 0Count ← Count + 1
// Total unchanged: leave its cell blank