Key Idea: Every program is built from three control structures — sequence, selection and iteration — grouped into functions so each piece can be named, tested and reused.
Paper 1
- Short definitions and a trace.
- State, identify, outline — precise terms.
Paper 2
- Write or correct Python for a scenario — your paper is the Python version, option B.
- Construct, determine, suggest.
Both
- Trace tables and justified choices earn method marks even when the final answer slips.
🔀 Selection
What gets asked
- A chain of ELSE IF runs exactly one branch — the first that matches
- Separate IF statements are each evaluated, so more than one can run
- Test grade boundaries from the highest down, or every mark above 40 takes the first branch
- A CASE statement needs a default, or an unmatched value is silently ignored
Important: A valid range needs AND — both bounds must hold. Testing for invalid needs OR — either bound breached is enough. 'mark < 0 AND mark > 100' can never be true, so nothing is ever rejected — and nothing reports it.
🔁 Iteration
| Loop | Use when | Watch for |
|---|---|---|
| FOR | The count is known before the loop starts | Off-by-one at the bounds |
| WHILE | It depends on what happens inside | Nothing in the body changes the condition |
| REPEAT-UNTIL | The body must run at least once | Tests AFTER, so it always runs once |
Loop discipline
- An infinite loop means nothing in the body changes what the condition tests
- Move work that does not depend on the loop variable outside it
- Nested loops multiply — which is why they become impossible at scale
- Decide what is inside and what is outside before writing: an input inside asks twelve times; an output outside prints only the last value
🧱 Functions and modularity
| Term | Meaning |
|---|---|
| Function | Named block doing one task and returning a value |
| Procedure | Performs an action and returns nothing |
| Parameter | The name in the definition |
| Argument | The value supplied at the call |
| By value | Passes a copy — the caller's variable is untouched |
| By reference | Passes access — the caller's variable can be changed |
Low coupling: a module depends only on another's published interface, so changes stay local. High cohesion: everything in a module serves one purpose. If a function's name needs the word 'and', it is doing too much.
📝 Exam-style questions
Write a Python program that reads 10 marks, counts how many are 50 or above, and outputs that count together with the highest mark entered.
🔒 Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.
A program validates a percentage with: IF mark < 0 AND mark > 100 THEN reject. Explain why no value is ever rejected, and give the correction.
🔒 Model answer plan
See the mark-by-mark plan — for / against / judgement, with marking guidance — in study mode.
✅ Quick check
Cover the answers.
ELSE IF chain or separate IFs — which runs only one branch? The ELSE IF chain — the first match wins and the rest are skipped. Separate IFs are each evaluated.
Why test grade boundaries from the highest down? Otherwise every mark above 40 matches the first branch and no higher grade is ever awarded.
Parameter or argument — which is in the definition? The parameter. The argument is the value supplied at the call.
What does low coupling mean? A module depends only on another's published interface, so changing the body of one breaks nothing.
Where should an INPUT statement go in a loop that reads 12 values? Inside the loop. Outside it, the same value is reused twelve times.
Exam tips
- Initialise outside the loop, read inside it, output outside it.
- Valid range uses AND; invalid uses OR. Substitute a failing value to check.
- '50 or above' is ≥, not >. Read the boundary wording twice.
- A CASE statement needs a default branch.
- A function returns a value; a procedure performs an action. Use the right word.
- If a function's name needs 'and', split it in two.