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 >= 13 AND Age <= 19 THEN | ARuns the code when the answer is a capital Y or a lowercase y, because only one test needs to be true | |
| 2IF Answer = "Y" OR Answer = "y" THEN | BRuns the code only when Age is between 13 and 19 inclusive, because both tests must be true | |
| 3One IF with AND can replace two nested IFs that must both be true | CIF Day = "Sat" OR Day = "Sun" THEN | |
| 4Use OR when any one of several rules is enough to run the code | DThe second test is missing the variable name. Each side of AND needs a full test, so it should be Age <= 19. | |
| 5IF Age >= 13 AND <= 19 THEN | EIF Score >= 50 AND Attendance >= 90 THEN | |
| 6IF Answer = "Y" AND Answer = "y" THEN | FAND is the wrong operator. Answer cannot be both Y and y at once, so the condition is never true. It should use OR. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
IF Age >= 13 AND Age <= 19 THEN — A compound condition joins tests with AND, OR or NOT so one IF checks several things at once. AND needs both tests true; OR needs at least one true.IF Age >= 13 AND Age <= 19 THENIF Answer = "Y" OR Answer = "y" THENIF Age >= 13 AND Age <= 19 THEN
OUTPUT "Teenager"
ENDIFIF NOT (Age < 13) THEN
OUTPUT "Not a child"
ENDIFIF Score < 0 OR Score > 100 THEN
OUTPUT "Invalid"
ENDIF