Divide and conquer
Answers are for parents and teachers.
1
Decompose “plan a birthday party” into four sub-problems.
For example: invitations, food and drink, games and music, tidying up afterwards. Other correct answers are possible.
2
Which of these is a single step, and which is a sub-problem? (a) design the school garden; (b) put one seed in one hole.
(a) is a sub-problem (many steps, it can be split). (b) is a single step.
3
Give two reasons why programmers use sub-routines in a big program.
Parts can be shared between team members and tested separately; a sub-routine is written once and can be reused, so a change is made in one place.
4
Trace the program. What is printed?
Python
1def add_fee(price): 2 return price + 2 3 4print(add_fee(10) + add_fee(1))
add_fee(10) is 12 and add_fee(1) is 3, so the program prints 15.
5
A pupil writes all of a program, tests it, and finds it does not work. Explain how iterative development would have helped.
With small versions and a test after each, the mistake would be found as soon as the part that caused it was added, so it would be easy to find and fix.