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 | AIF Age >= 13 THEN IF Age < 20 THEN | |
| 2ELSE OUTPUT "Fail" | B50 > 50 is FALSE because > does not include the limit value, so the ELSE path is followed instead. | |
| 3Checking a limit: when Mark is 50, the condition is TRUE because >= includes the limit value | CCheck the condition with the current value of Mark. If it is TRUE, follow the THEN path only. | |
| 4A nested IF is traced one condition at a time. The inner IF is only checked if the outer condition is TRUE | DOnly one path is followed. When the condition is FALSE, only the ELSE statement is traced and the THEN statement gets no row. | |
| 5Mark = 50, IF Mark > 50 THEN: condition TRUE, so OUTPUT "Pass" | EThis statement is skipped when the condition is TRUE, so it gets no row in the trace table. | |
| 6Mark = 40, IF Mark >= 50 THEN: FALSE, so trace both OUTPUT "Pass" and OUTPUT "Fail" | FIF Mark >= 50 THEN |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
IF Mark >= 50 THEN — To trace an IF, work out if the condition is TRUE or FALSE for the current values, then follow only the THEN or ELSE path. Skipped statements get no row in the trace table.IF Mark >= 50 THEN
OUTPUT "Pass"
ENDIFIF Temp > 30 THEN
OUTPUT "Hot"
ENDIFIF Score < 40 THEN
OUTPUT "Retry"
ENDIFMark ← 50
IF Mark > 50 THEN
// 50 > 50 is FALSEIF Mark >= 50 THEN
IF Mark >= 80 THEN
OUTPUT "Merit"