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 | AFOR Count ← 1 TO 5 INPUT Score NEXT Count | |
| 2INPUT Mark IF Mark >= 50 THEN OUTPUT "Pass" ENDIF | BThe statements are in the wrong order and the IF is incomplete. The IF must come before the OUTPUT, wrap it, and end with ENDIF. | |
| 3The problem has several fixed choices for one value, so a CASE structure suits the process step | CDeclare the variable and its data type at the start, before it is used in the algorithm | |
| 4The problem says to repeat an action a set number of times, so a FOR loop is used for the process step | DInput a value, process it with a selection test from the problem, then output the result | |
| 5Total ← 0 INPUT Mark Total ← Total + Mark | EThe variables Total and Mark are used but never declared. DECLARE Total : INTEGER and DECLARE Mark : INTEGER must come first. | |
| 6INPUT Age OUTPUT "Adult" IF Age >= 18 THEN | FCASE OF Choice 1 : OUTPUT "Start" 2 : OUTPUT "Quit" ENDCASE |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
DECLARE, INPUT, process, OUTPUT — To write an algorithm from a problem, DECLARE variables first, then INPUT, process with IF, CASE or a loop, then OUTPUT. Check each part against the problem and use the exam format.DECLARE Mark : INTEGER
INPUT Mark
OUTPUT MarkDECLARE Age : INTEGER
INPUT Age
OUTPUT AgeIF Mark >= 50 THEN
OUTPUT "Pass"
ENDIFFOR Count ← 1 TO 5
INPUT Score
NEXT CountDECLARE Total : INTEGER
Total ← 0
OUTPUT Total