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 | |
|---|---|---|
| 1IF Mark > 50 THEN OUTPUT "Pass" | AFOR Count ← 1 TO 5 | |
| 2Total ← Total + Score (Total was never set to 0) | BThe wrong operator makes the loop stop one pass too soon. The trace table shows no row for Number = 10. It should be <= instead of <. | |
| 3A loop must run 5 times, but the trace table shows only 4 passes. The first wrong row points to the loop header. Correction: change the end value to 5. | CThe first row of the trace table already shows a wrong Total, so the error is a missing starting value. Fix it by adding Total ← 0 before the loop. | |
| 4The trace table shows Count is 1 higher than expected on every row, so the error is a counter not set to 0. Correction: set the counter to 0 before the loop. | DThe loop ends one pass too soon, so the last letter is never traced. The correction is to remove the - 1 from the end value. | |
| 5WHILE Number < 10 DO (should include 10) | EA wrong operator: a mark of 50 should pass but the trace table shows no Pass. Fix it by changing > to >=. | |
| 6FOR Index ← 1 TO LENGTH(Word) - 1 | FCount ← 0 |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
first wrong value — In a trace table, the first row where a value differs from what you expected points to the faulty line of the algorithm. Look at that line, then suggest a correction.// 50 or more is a Pass
IF Mark >= 50 THEN
OUTPUT "Pass"Count ← 0
FOR Index ← 1 TO 5
Count ← Count + 1// Output 1 to 5
FOR Index ← 1 TO 5
OUTPUT Index// Add each mark to the total
Total ← Total + Mark
Count ← Count + 1// Only under 18 is a Child
IF Age < 18 THEN
OUTPUT "Child"