Class 6 Computer Science — Making decisions in programs
Test whether a condition is true, and work out which branch of an if-otherwise step a program takes.
Name: ________________________
1.A program says: if the number is equal to 6, print "Six"; otherwise print "Not six". The number is 8. What does the program print?
2.A program says: if the number is less than 5, print "Low"; otherwise print "High". The number is 5. What does the program print?
3.A program says: if the mark is at least 40, print "Pass"; otherwise print "Fail". The mark is 39. What does the program print?
4.Is 7 more than 10?
- a) Sometimes
- b) Yes
- c) There is no way to tell
- d) No
5.A program tests a number and takes one of its two branches. In a single run, how many of the two words does it print?
- a) One
- b) Two
- c) It changes each time
- d) None
6.Sort each of these statements by whether it is true or false.
Groups: True · False
- 5 is less than 2
- 8 is more than 3
- 4 is more than 4
- 9 is more than 2
- 10 is less than 10
- 7 is equal to 7
7.A program says: if the number is more than 10, print "Big"; otherwise print "Small". The number is 7. What does the program print?
8.A program says: if the mark is at least 40, print "Pass"; otherwise print "Fail". The mark is 40. What does the program print?
Answer key — Class 6 Computer Science — Making decisions in programs
- 1. Not six
- 2. High
- 3. Fail
- 4. d) No
- 5. a) One
- 6. 8 is more than 3 → True; 5 is less than 2 → False; 7 is equal to 7 → True; 10 is less than 10 → False; 4 is more than 4 → False; 9 is more than 2 → True
- 7. Small
- 8. Pass