Grade 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.In a step that says "if this, do that; otherwise do the other", when does the otherwise part run?
- a) Every single time, after the first part
- b) Only when the condition is false
- c) Only when the condition is true
- d) Never — it is there for decoration
2.Match each condition to the smallest whole number that makes it true.
- More than 5
- More than 9
- At least 3
- More than 0
- At least 12
- 1
- 10
- 3
- 6
- 12
3.Is 7 more than 10?
- a) Sometimes
- b) There is no way to tell
- c) Yes
- d) No
4.A program says: if the mark is at least 40, print "Pass"; otherwise print "Fail". The mark is 40. What does the program print?
5.A program says: if the number is more than 10, print "Big"; otherwise print "Small". The number is 25. What does the program print?
6.Sort each of these statements by whether it is true or false.
Groups: True · False
- 7 is equal to 7
- 10 is less than 10
- 8 is more than 3
- 5 is less than 2
- 4 is more than 4
- 9 is more than 2
7.A program says: if the mark is at least 40, print "Pass"; otherwise print "Fail". The mark is 39. What does the program print?
8.A program says: if the number is more than 12, print "Over"; otherwise print "Under". The number is 12. What does the program print?
- a) Under
- b) Nothing at all
- c) Over
- d) Both words
Answer key — Grade 6 Computer Science — Making decisions in programs
- 1. b) Only when the condition is false
- 2. More than 5 → 6; More than 9 → 10; At least 3 → 3; More than 0 → 1; At least 12 → 12
- 3. d) No
- 4. Pass
- 5. Big
- 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. Fail
- 8. a) Under