Write and amend an algorithm from a scenario
Translate a requirement into precise pseudocode, program code or a flowchart and test the result iteratively.
Exam scope and assessment notes
This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4. It covers subject content Topic 7 only. The separately published 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.
Before you begin
- No programming language is required. Be comfortable with place value and multiplication; each lesson introduces the computer-science notation it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
What should happen after an algorithm is amended?
What you will learn
- Select a suitable design representation
- Write ordered steps that satisfy a scenario
- Test and amend the algorithm
A complete algorithm joins requirements and control flow
Start from the scenario's inputs, rules and expected outputs. Decompose the work into clear steps, then express the algorithm in pseudocode, program code or a flowchart as requested.
Apply and check the rule
Make conditions, loops, variable updates and outputs precise. Follow the official paper requirements: Paper 2 normally expects pseudocode, while the 15-mark scenario permits pseudocode or the specified languages. Test the algorithm with relevant data, amend faults and test again.
Pause and explain
Which plan is most complete for a two-branch discount?
Worked example
Write steps for a club discount: members pay 90% of the original price; others pay full price.
Show the worked solution
- Input Price and IsMember.
- If IsMember is True, set FinalPrice to Price*0.9.
- Otherwise set FinalPrice to Price; output the result.
Answer INPUT Price, IsMember; IF IsMember = TRUE THEN FinalPrice ← Price * 0.9 ELSE FinalPrice ← Price ENDIF; OUTPUT FinalPrice.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
Write pseudocode steps to read 5 prices, total them and display the average.
Give me a hint
Initialise before the loop and divide after all five values are processed.
Compare my reasoning
- Set Total ← 0 and Count ← 0.
- Repeat five times: input Price; Total ← Total + Price; Count ← Count + 1.
- Output Total / Count.
Total ← 0; Count ← 0; REPEAT 5 TIMES INPUT Price; Total ← Total + Price; Count ← Count + 1; ENDREPEAT; OUTPUT Total / Count.
Look for these in your work
- Initialisation
- Loop input/update
- Average output
A ticket system charges 12 for adults and 7 for children. Describe the condition, both calculations and output needed.
Give me a hint
Use passenger type to choose one of two prices.
Compare my reasoning
- Input PassengerType.
- If it is Adult, set Fare ← 12; otherwise if Child, set Fare ← 7.
- Display Fare, or report invalid type for any other input.
Check the passenger type, assign the matching fare, and output it; handle any unsupported type explicitly.
Look for these in your work
- Input
- Two valid branches
- Invalid case
A new algorithm works for normal inputs but fails at the highest allowed quantity. Describe a responsible amend-and-test cycle.
Give me a hint
Reproduce the failure, fix the rule, then check both boundaries.
Compare my reasoning
- Record the failing maximum input and expected output.
- Inspect loop limits or range comparisons and amend the algorithm.
- Retest the maximum, just-outside value and representative normal data.
Use a boundary test to reproduce the defect, amend the endpoint condition and rerun the failed case plus adjacent and representative tests. Update the design or code if any expected result still fails.
Look for these in your work
- Reproducible case
- Targeted correction
- Regression tests
Common mistakes
- Writing a solution that omits the non-member branch
- Ignoring the required representation or syntax for the assessment
What can you explain now?
What should a scenario algorithm be checked against?
Compare with the explanation
The stated inputs, rules and expected outputs
Tests should demonstrate that the algorithm meets each requirement.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
What steps take a scenario from requirements to a tested algorithm?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.