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 | |
|---|---|---|
| 1age >= 13 AND hasPermission = TRUE | AThe rule 'between 13 and 19' means both limits must hold, so it needs AND, not OR. Also the comparisons are reversed, as this tests for outside the range. | |
| 2day = "Sat" OR day = "Sun" | BThe rule says 'either': it is a weekend if the day is Saturday or Sunday, so one part being true is enough. | |
| 3'Unless the bag is empty, pack it' uses the key word 'unless', which signals NOT. | CIF score >= 10 AND score <= 20 THEN | |
| 4'Between 10 and 20 inclusive' needs a lower limit AND an upper limit joined together. | D'Either red or blue' signals OR, but AND was used. One variable cannot be both red and blue at once, so the condition is never true. | |
| 5IF age < 13 OR age > 19 THEN // rule: between 13 and 19 | EThe rule says 'both': a student must be 13 or older and also have permission, so both parts must be true. | |
| 6IF colour = "red" AND colour = "blue" THEN // rule: either red or blue | FIF NOT (bagEmpty = TRUE) THEN |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
both = AND, either = OR, not = NOT — Key words in a worded rule signal the operator: both/and means AND, either/or means OR, not/unless/except means NOT. Use them to rewrite the rule as a compound condition.// Rule: both marks are 50 or more
IF maths >= 50 AND english >= 50 THEN// Rule: either Saturday or Sunday
IF day = "Sat" OR day = "Sun" THEN// Rule: unless it is raining
IF NOT raining THEN// Rule: between 10 and 20 inclusive
IF age >= 10 AND age <= 20 THEN// Rule: neither red nor blue
IF NOT (colour = "red" OR
colour = "blue") THEN