Problem Solving, Algorithms and Programming Concepts
Domain focus
This section tests problem-solving steps, algorithm design, flowchart/pseudocode reading, control structures and basic programming concepts.
Core rules
- Problem-solving cycle: define the problem, analyse inputs/processes/outputs, design the algorithm, code it, test/debug, document and maintain.
- An algorithm is a finite, ordered set of unambiguous steps that solves a problem.
- Flowchart symbols: oval = start/stop; parallelogram = input/output; rectangle = process; diamond = decision; arrow = flow.
- Control structures: sequence, selection (IF…THEN…ELSE, CASE) and iteration (FOR, WHILE, REPEAT…UNTIL).
- Variables change; constants do not. Data types include integer, real, character, string and Boolean.
- Syntax errors break language rules; logic errors produce wrong results; runtime errors occur during execution.
- Dry running means tracing variable values by hand.
Worked example
Trace this algorithm with A = 12, B = 7, C = 19: START INPUT A, B, C MAX = A IF B > MAX THEN MAX = B IF C > MAX THEN MAX = C PRINT MAX END Reasoning: MAX starts at 12. Is 7 > 12? No, so MAX stays 12. Is 19 > 12? Yes, so MAX becomes 19. Output is 19. The trace must show each comparison, not only the final answer.
Traps
- Omitting the start/stop oval in a flowchart.
- Using a rectangle for a decision.
- Reversing a loop condition, causing an infinite loop or zero iterations.
- Confusing = (assignment) with equality in pseudocode.
- Giving code when the question asks for pseudocode or a flowchart.