Year 8 Computing — Choosing between more than two things
Follow a chain of tests in which the first one that comes out true wins, and say which branch a program takes.
Name: ________________________
1.In that same program — if the number is more than 10, print "Big"; else if the number is more than 100, print "Huge"; otherwise print "Small" — is there any number at all that makes it print Huge?
- a) Yes, any number above 100
- b) No, because anything above 100 is already above 10
- c) Yes, but only the number 100 itself
- d) Yes, any number above 10
2.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 89. What does it print?
3.A program says: if the number is less than 0, print "Negative"; else if the number is 0, print "Zero"; otherwise print "Positive". The number is 0. What does it print?
- a) Zero
- b) Nothing at all
- c) Positive
- d) Negative
4.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". Sort each score by what the program prints for it.
Groups: Gold · Silver · Bronze · Try again
- 96
- 71
- 90
- 12
- 55
- 50
5.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 70. What does it print?
6.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 95. What does it print?
7.A program says: if the age is at least 18, print "Adult"; else if the age is at least 13, print "Teenager"; else if the age is at least 5, print "Child"; otherwise print "Toddler". Match each age to what the program prints.
- 20
- 13
- 9
- 3
- Teenager
- Child
- Adult
- Toddler
8.A program says: if the score is at least 90, print "Gold"; else if the score is at least 70, print "Silver"; else if the score is at least 50, print "Bronze"; otherwise print "Try again". The score is 50. What does it print?
Answer key — Year 8 Computing — Choosing between more than two things
- 1. b) No, because anything above 100 is already above 10
- 2. Silver
- 3. a) Zero
- 4. 96 → Gold; 90 → Gold; 71 → Silver; 55 → Bronze; 50 → Bronze; 12 → Try again
- 5. Silver
- 6. Gold
- 7. 20 → Adult; 13 → Teenager; 9 → Child; 3 → Toddler
- 8. Bronze