Grade 7 Computer Science — 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 condition says: the number is more than 50 and the number is less than 10. Which numbers make it true?
- a) The numbers between 10 and 50
- b) No number at all
- c) Every number
- d) Only 10 and 50 themselves
2.Sort each statement by whether it is true or false.
Groups: True · False
- 4 is more than 5 and 4 is less than 9
- 8 is more than 9 or 8 is more than 10
- 7 is more than 3 and 7 is less than 10
- 5 is less than 5 or 5 is more than 5
- 6 is equal to 6 and 6 is more than 1
- 2 is more than 5 or 2 is less than 3
3.A condition says: not (the number is more than 10). The number is 3. Is the condition true?
- a) No
- b) There is no way to tell
- c) Yes
- d) Only when the number is 10
4.A program says: if the mark is less than 33 or the attendance is less than 75, print "Not allowed"; otherwise print "Allowed". The mark is 90 and the attendance is 80. What does it print?
5.A program says: if the number is not more than 10, print "Small"; otherwise print "Large". The number is 30. What does it print?
6.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?
7.A program says: if the mark is less than 33 or the attendance is less than 75, print "Not allowed"; otherwise print "Allowed". The mark is 20 and the attendance is 95. What does it print?
8.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) Yes
- d) No
Answer key — Grade 7 Computer Science — Combining conditions with and, or and not
- 1. b) No number at all
- 2. 7 is more than 3 and 7 is less than 10 → True; 4 is more than 5 and 4 is less than 9 → False; 2 is more than 5 or 2 is less than 3 → True; 8 is more than 9 or 8 is more than 10 → False; 6 is equal to 6 and 6 is more than 1 → True; 5 is less than 5 or 5 is more than 5 → False
- 3. c) Yes
- 4. Allowed
- 5. Large
- 6. Middle
- 7. Not allowed
- 8. c) Yes