2
Plans, bugs and data
Computing 2: Units 5–8, pp. 66–121
GoalReview algorithms, bugs, questions and kinds of data.
New words
bug · a mistake in an algorithm or programstatistical question · a question that can have many different answersnumerical data · numbers that were counted or measuredcategorical data · data in groups with names
Explanation
We plan an algorithm in the right order before we make a program. If the program does not match the plan, it has a bug. Debugging with a partner is faster and finds more bugs. A statistical question has many possible answers, so we collect data. Numerical data is counted or measured, and categorical data is sorted into named groups. Data helps us to decide what to do.
Worked examples
The algorithm says: start on green flag, up 3, say “Yay!”, hop 1, end. In the program, steps 3 and 4 are in the wrong order. The character hops first, then says Yay!.
| Child | Pages read | Favourite colour |
|---|---|---|
| Yuki | 12 | blue |
| Bilal | 8 | green |
| Tom | 9 | blue |
| Lola | 5 | red |
A park counts its visitors each day. Thursday is the busiest day, with 30 visitors, so the park decides to open extra toilets and paths for Thursday.
Class activity
Review stations: make six cards. Cards 1 and 2 are programs written in words with one bug each. Cards 3 and 4 are questions: one statistical and one not. Cards 5 and 6 are data: one numerical and one categorical. Swap with a partner. Find the bugs, sort the questions and sort the data. Check each other’s answers kindly.
Practice
1
The algorithm says: start on tap, say “Hi!”, grow 2, pop, end. Find the bug.
A block is missing. The pop block should come after grow 2, before the end.
2
Statistical or non-statistical? A: What is your teacher’s name? B: Which games do the children in Class 4 play at break?
A is non-statistical (one answer). B is statistical (many answers).
3
Numerical or categorical? A: the seconds that each child takes to run to the fence (14, 12, 18). B: the colour of each child’s trainers.
A is numerical. B is categorical.
4
A juice stall counted the cups it sold. Which day was the busiest? How many more cups were sold that day than on Wednesday?
Friday was the busiest, with 25 cups. 25 − 8 = 17 more cups than on Wednesday.