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 score > 50 THEN IF lives > 0 THEN SAY "Next level" END IF END IF | AThe inner IF is not indented, so it is hard to see that it is inside the first IF's THEN path. | |
| 2 IF lives > 0 THEN | BIF level = 1 THEN SAY "Easy mode" ELSE IF level = 2 THEN SAY "Medium mode" END IF END IF | |
| 3Each IF needs its own END IF, so two IFs need two END IFs. | CIF coins = 10 THEN IF key = 1 THEN SAY "Door opens" END IF END IF | |
| 4An IF inside the ELSE path is only checked when the first condition is false. | DA nested IF: the inner IF about lives is only checked when the score is over 50. | |
| 5IF score > 50 THEN IF lives > 0 THEN SAY "Next level" END IF | EThe outer IF has no END IF. Each IF needs its own END IF, so this needs a second END IF at the end. | |
| 6IF score > 50 THEN IF lives > 0 THEN SAY "Next level" END IF END IF | FThe inner IF is indented to show it belongs inside the outer IF's path. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
nested IF — A second IF written inside the THEN or ELSE path of the first IF. It is only checked when that path is taken. Indent it and give each IF its own END IF.IF score >= 50 THEN
IF lives > 0 THEN
SAY "Go to level 2"IF coins > 10 THEN
IF key = "yes" THEN
SAY "Door opens" SAY "Door opens"
END IF
END IFELSE
IF lives > 0 THEN
SAY "Try again"IF level = 3 THEN
IF boss_beaten = "yes" THEN
SAY "You win!"