Two tests, one decision
Answers are for parents and teachers.
1
Work out the result: x holds 15. (a) x > 10 AND x < 20 (b) x < 5 OR x = 15 (c) NOT (x > 10).
(a) True AND True is True. (b) False OR True is True. (c) NOT True is False.
2
Follow the algorithm for the inputs 3, 4, 6 and 7.
Pseudocode
1INPUT n 2IF n >= 4 AND n <= 6 THEN 3 OUTPUT "In" 4ELSE 5 OUTPUT "Out" 6ENDIF
3: Out. 4: In. 6: In. 7: Out. Only 4 to 6 are inside the range.
3
Write a condition: the player has at least 3 lives and has collected fewer than 10 stars, OR the player has the key (variable key, value "yes").
(lives >= 3 AND stars < 10) OR key = "yes". The brackets are not needed, because AND is worked out before OR, but they make it clear.
4
Explain why a sports club that writes IF age < 10 OR age > 15 THEN OUTPUT "Welcome" would let in a 5-year-old.
5 < 10 is True, so the OR condition is True, and Welcome is shown. The club wanted ages 10 to 15 inside, so it should use age >= 10 AND age <= 15.
5
Complete the sentence in your own words: NOT reverses a condition, so NOT (n = 4) is true when ...
n is any number except 4. For n = 4 the small condition is True and NOT makes it False.