Choices and loops on the board
Answers are for parents and teachers.
1
Write the blocks for this rule: if the temperature is more than 25, show the t-shirt icon, else show the sad icon. What does the program show for 25 and for 26?
if <(temperature) > (25)> then show icon t-shirt else show icon sad. For 25 the condition is false, so it shows sad. For 26 it is true, so it shows the t-shirt.
2
Trace the program. What does the board show?
Round 1: 1 + 4 = 5, then 5 × 2 = 10. Round 2: 10 + 4 = 14, then 14 × 2 = 28. Round 3: 28 + 4 = 32, then 32 × 2 = 64. The board shows 64.
3
Trace the loop. How many rounds does it run and what does the board show?
80 > 10, so n = 40. 40 > 10, so n = 20. 20 > 10, so n = 10. Then 10 > 10 is false and the loop stops. It runs 3 times and the board shows 10.
4
Make a test table for the rule ‘free swimming for children under 8’. Include five tests, say which are boundary tests and give the expected results.
For example: 3 (free, normal), 12 (not free, normal), 7 (free, boundary), 8 (not free, boundary) and 9 (not free, just above the edge). The edge of the rule is at 8, so 7, 8 and 9 are the boundary values.
5
(if you have a computer or tablet) In a micro:bit simulator, build the temperature program from this week with three outcomes. Test it with a table of at least six values, including the edges.
Check that the program shows the t-shirt for 30 and above, yes for 15 to 29 and sad below 15. The values 14, 15, 29 and 30 are the boundary tests.