Problem solving means turning a task into clear steps before you write any code. This area teaches four connected habits: break it down, trace it, draw it and test it.
Check the current syllabus scope with your teacher and at bpk.moe.gov.my. The examples below are original.
How do the lessons connect?
- Breaking a problem into smaller tasks gives you a plan of inputs, steps and outputs.
- Tracing pseudocode step by step checks that a plan does what you intended.
- Designing a flowchart shows the same plan as a diagram.
- Testing normal, boundary and invalid inputs tries the plan on awkward values.
A harder sub-section, algorithm reasoning and test design, adds harder tracing and comparison. When you are ready, use the practice set.
A worked example
A fictional canteen wants a program that gives change. A customer pays RM10 for a meal that costs RM6.50.
Break it into tasks. Read the price and the money paid, check that the money is enough, then subtract and display the change. Tracing with these numbers gives 10 − 6.50 = RM3.50.
Now test the edges. If the money paid equals the price, the change is RM0.00, which is a boundary. If the money paid is RM5, the plan must show a message, because the payment is too low. One small task has used all four skills.
Where should you start?
- If you freeze at a long question, begin with breaking a problem down.
- If your plan looks right but runs wrong, go to tracing.
- If you like pictures, use flowcharts to see the shape of the steps.
- If your code fails on odd inputs, read the testing lesson.
The restricted pseudocode trace trainer gives quick tracing practice. After this area, continue to programming foundations, where plans become code.
If you want a teacher to practise planning on tasks you choose, see online one-to-one Computer Science tuition.