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 | |
|---|---|---|
| 1Answer = 5 | A<- is assignment, not a comparison. A condition should use = to test equality: IF Score = 10 THEN | |
| 2Name <> "Sam" | BTests whether Answer is equal to 5 and gives TRUE or FALSE | |
| 3Use <- (not =) when you want to store a value in a variable | CIF Colour = "red" THEN | |
| 4Use = inside an IF condition to check whether text matches exactly | DTests whether Name is not equal to the text "Sam" and gives TRUE if it is different | |
| 5IF Score <- 10 THEN | EAnswer <- 5 | |
| 6IF Age != 18 THEN | FCambridge pseudocode uses <> for not equal, not !=. It should be IF Age <> 18 THEN |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
= and <> — = tests whether two values are equal and <> tests whether they are not equal. Each gives TRUE or FALSE. Assignment uses <- instead, not =.IF Answer = 5 THEN
OUTPUT "Correct"
ENDIFIF Name <> "Sam" THEN
OUTPUT "Not Sam"
ENDIFAnswer <- 5IF Pet = "cat" THEN
OUTPUT "Meow"
ENDIFWHILE Guess <> Answer DO
INPUT Guess
ENDWHILE