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 | |
|---|---|---|
| 1Count <- 0 Total <- 0 | AFOR Student <- 1 TO 30 INPUT Mark NEXT Student | |
| 2IF Mark >= 50 THEN Passes <- Passes + 1 ENDIF | BSelection inside the loop: only count the values that meet the condition | |
| 3Iteration repeats the input and processing steps a set number of times | COUTPUT is inside the loop, so it prints ten times. The result should be output once after NEXT. | |
| 4Results are output after the loop has finished, as the last part of the sequence | DSequence: set the counter and total to 0 before the loop starts | |
| 5FOR i <- 1 TO 10 Count <- 0 INPUT Num IF Num > 5 THEN Count <- Count + 1 ENDIF NEXT i | ECount is set to 0 inside the loop, so it is reset on every repeat and the final count is wrong. It must be set to 0 before the loop. | |
| 6FOR i <- 1 TO 10 INPUT Num Total <- Total + Num OUTPUT Total NEXT i | FNEXT Student OUTPUT "Passes: ", Passes |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
sequence, selection, iteration — Set counters to 0 first (sequence), loop to read input (iteration), use IF inside the loop to pick values to count or total (selection), then OUTPUT the result after the loop.Total ← 0
FOR Index ← 1 TO 5
INPUT MarkFOR Student ← 1 TO 30
INPUT Mark
IF Mark >= 50 THENIF Mark >= 50 THEN
Passes ← Passes + 1
ENDIFNEXT Index
OUTPUT "Total: ", TotalIF Mark > 50 THEN
Total ← Total + Mark
ENDIF