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 | |
|---|---|---|
| 1ELSE IF temperature < 25 THEN | AA catch-all path that runs when none of the conditions above were true | |
| 2ELSE Wear a t-shirt | BIF temp > 30 THEN Stay inside ELSE IF temp > 20 THEN Go to the park ELSE Wear a jacket | |
| 3Conditions are checked in order from the top, and only the first true one runs | CThe ELSE is before the ELSE IF. The catch-all ELSE must be last, otherwise the ELSE IF can never be checked. | |
| 4Using ELSE IF lets an algorithm choose between three paths: hot, mild or cold | DIF score >= 90 THEN Show A ELSE IF score >= 70 THEN Show B | |
| 5IF mark >= 80 THEN Say Great ELSE IF Say Good job | EChecks a second condition only when the first condition was false | |
| 6IF age < 5 THEN Say Toddler ELSE Say Child ELSE IF age < 13 THEN Say Kid | FThe ELSE IF has no condition. It needs one, such as ELSE IF mark >= 50 THEN. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
ELSE IF — Checks another condition when the first one is false, so an algorithm can pick from more than two paths. Conditions are checked in order and only one path runs.IF temp > 30 THEN DISPLAY "Hot"
ELSE IF temp > 20 THEN DISPLAY "Warm"
ELSE DISPLAY "Cold"IF mark >= 80 THEN grade ← "A"
ELSE IF mark >= 50 THEN grade ← "B"
ELSE grade ← "C"IF light = "red" THEN DISPLAY "Stop"
ELSE IF light = "yellow" THEN DISPLAY "Slow"
ELSE DISPLAY "Go"IF coins >= 10 THEN DISPLAY "Big"
ELSE IF coins >= 5 THEN DISPLAY "Medium"
ELSE DISPLAY "Small"IF weather = "rain" THEN DISPLAY "Coat"
ELSE IF weather = "sun" THEN DISPLAY "Hat"
ELSE DISPLAY "Jumper"