Year 8 Computing — Combining conditions with and, or and not
Work out whether a condition joined by and, or or not comes out true, and which branch a program takes because of it.
Name: ________________________
1.A program prints "Go" only when the light is green and the road is clear, and prints "Wait" otherwise. Sort each situation by what it prints.
Groups: Go · Wait
- The light is red and the road is clear
- The light is green and nothing is standing on the road
- The light is red and the road is blocked
- The light is green and the road is clear
- The light is green and the road is blocked
2.A program says: if the number is more than 10 and less than 20, print "Middle"; otherwise print "Outside". The number is 12. What does it print?
3.Match each condition to the smallest whole number that makes it true.
- more than 3 and more than 7
- more than 3 or more than 7
- at least 5 and at least 9
- at least 5 or at least 9
- more than 0 and at least 2
- 8
- 2
- 4
- 9
- 5
4.A condition says: not (the number is more than 10). The number is 3. Is the condition true?
- a) Only when the number is 10
- b) No
- c) Yes
- d) There is no way to tell
5.A condition says: the number is more than 10 and the number is less than 20. The number is 15. Is the condition true?
- a) Only if the two halves are equal
- b) There is no way to tell
- c) No
- d) Yes
6.A program says: if the number is not more than 10, print "Small"; otherwise print "Large". The number is 30. What does it print?
7.A condition says: the number is more than 50 and the number is less than 10. Which numbers make it true?
- a) Every number
- b) No number at all
- c) The numbers between 10 and 50
- d) Only 10 and 50 themselves
8.A condition says: the number is more than 5 or the number is more than 50. Which numbers make it true?
- a) Every number above 5
- b) Only the numbers between 5 and 50
- c) No number at all
- d) Only the numbers above 50
Answer key — Year 8 Computing — Combining conditions with and, or and not
- 1. The light is green and the road is clear → Go; The light is green and the road is blocked → Wait; The light is red and the road is clear → Wait; The light is red and the road is blocked → Wait; The light is green and nothing is standing on the road → Go
- 2. Middle
- 3. more than 3 and more than 7 → 8; more than 3 or more than 7 → 4; at least 5 and at least 9 → 9; at least 5 or at least 9 → 5; more than 0 and at least 2 → 2
- 4. c) Yes
- 5. d) Yes
- 6. Large
- 7. b) No number at all
- 8. a) Every number above 5