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 Age >= 18 THEN FOR I <- 1 TO 3 OUTPUT I NEXT I ENDIF | AIF Go = TRUE THEN FOR N <- 1 TO 5 OUTPUT N NEXT N ENDIF | |
| 2IF Score > 50 THEN OUTPUT "Pass" ELSE WHILE Score < 50 DO Score <- Score + 10 ENDWHILE ENDIF | BIF Total > 100 THEN FOR I <- 1 TO 3 OUTPUT "Big" NEXT I ELSE OUTPUT "Small" ENDIF | |
| 3The ENDIF comes after NEXT, because the loop is closed first and then the IF is closed | CENDIF is placed before NEXT I. The loop is inside the IF, so NEXT I must come first and ENDIF after it. | |
| 4If the condition is FALSE, the loop in the THEN branch is skipped and the ELSE part runs instead | DThe FOR loop runs three times only when Age is 18 or more. Otherwise the whole loop is skipped. | |
| 5IF X > 0 THEN FOR I <- 1 TO 3 OUTPUT I ENDIF NEXT I | EThe WHILE loop is inside the ELSE branch, so it only runs when Score > 50 is FALSE. | |
| 6IF Ready = TRUE THEN WHILE Count < 5 DO Count <- Count + 1 ENDIF ENDWHILE | FThe WHILE loop is closed with ENDIF and the IF is closed with ENDWHILE, so the end keywords are the wrong way round. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
IF...THEN FOR...NEXT...ENDIF — A loop written inside an IF branch only runs when that branch is chosen. If the condition is FALSE, it is skipped. NEXT ends the loop first, then ENDIF ends the IF.IF Age >= 18 THEN
FOR Count <- 1 TO 3
OUTPUT "Welcome" OUTPUT Count
NEXT Count
ENDIFELSE
WHILE Tries < 3 DO
Tries <- Tries + 1 N <- N - 1
ENDWHILE
ENDIFCASE OF Choice
1 : FOR Count <- 1 TO 5
OUTPUT Count