Term 2 check-in
Answers are for parents and teachers.
1
Each row in a school hall holds 12 chairs. For 100 pupils, what does math.floor(100 / 12) give, and what does it mean? How many rows are really needed, and which function gives that?
100 ÷ 12 = 8.33, so math.floor gives 8: eight rows can be filled completely (96 pupils). The other 4 pupils still need seats, so 9 rows are needed, which is what math.ceil(100 / 12) gives.
2
A game picks a number with random.randint(1, 6) and prints the number plus 10. List all the possible outputs, and say why the program can never print 17.
The possible outputs are 11, 12, 13, 14, 15 and 16. It cannot print 17, because that would need a 7, and randint(1, 6) stops at 6.
3
A swimming club accepts members aged 7 to 14. Write a test plan with five tests: normal, boundary and invalid. Give the expected outcome for each.
For example: 10 normal, Accepted; 7 boundary, Accepted; 14 boundary, Accepted; 15 boundary, Rejected; 40 invalid, Rejected. The expected outcomes follow the rule 7 to 14.
4
A receiver adds each incoming number to total, which starts at 0, and shows the sad icon when total > 10. The messages are 4, 3, 5, 2. What does it show after each message?
After 4: total 4, shows 4. After 3: total 7, shows 7. After 5: total 12, shows the sad icon. After 2: total 14, shows the sad icon.
5
A sheet has Total = Price × Number sold. Price is 4. The goal is 100. Which number sold gives the goal? Show the inverse operation.
100 ÷ 4 = 25, so 25 must be sold. Goal seek works backwards by dividing, which is the inverse of multiplying.