Plans before programs
Answers are for parents and teachers.
1
Write three instructions of your own in English for a program at a bakery. Then write each one in pseudocode.
For example: Ask for the number of loaves, INPUT loaves. Calculate the cost of each loaf at 2, cost ← loaves * 2. Show the cost, OUTPUT "Cost: ", cost. Any three sensible, valid lines are correct.
2
Follow this algorithm and write the output.
Pseudocode
1m ← 9 2n ← m * 2 3m ← n - 4 4OUTPUT m, " and ", n
The output is: 14 and 18. m is 9, n is 18, m becomes 14.
3
Say which three identifiers are invalid and why: speed, 5th_run, best time, lap_time, if.
5th_run starts with a number. best time has a space. if is a reserved word in Python. speed and lap_time are valid.
4
Explain in your own words why a team of programmers might write pseudocode before they write Python.
It lets them agree on the steps, the variables and the calculations. People who use different languages can read it, and nobody has to fix syntax mistakes yet. Changes are quick.
5
Write pseudocode that asks for a pupil’s name and shows Welcome to the choir, followed by the name.
OUTPUT "Name?" / INPUT pupil / OUTPUT "Welcome to the choir, ", pupil. The comma joins the string and the variable.