Programming Fundamentals and Problem Solving
What the exam tests
Programming Fundamentals and Problem Solving tests algorithms, flowcharts, pseudocode, variables, data types, control structures, functions, arrays and debugging. Questions ask you to trace output, complete a flowchart or correct logic.
Core rules
- An algorithm is finite, unambiguous, has input/output and is effective. A flowchart uses terminal, input/output, process, decision and connector symbols.
- A variable has a name, type, value and scope; a constant cannot change after assignment. Common types: integer, real/float, character, string, Boolean.
- Sequence, selection (if/else, switch) and iteration (while, for, do-while) control execution.
- A function groups reusable logic and returns at most one value in many languages; parameters pass data in.
- An array stores multiple same-type elements under one name, indexed from 0 in C-style languages.
- Trace tables record variable values after each step; desk-checking finds logic errors.
Worked example
Find the sum of the first n natural numbers. Pseudocode: read n; sum ← 0; for i ← 1 to n do sum ← sum + i; end for; print sum. For n = 4: i = 1, sum = 1; i = 2, sum = 3; i = 3, sum = 6; i = 4, sum = 10. Output 10. The formula n(n + 1)/2 gives 4 × 5 / 2 = 10, confirming the trace.
Traps
Do not confuse assignment (=) with comparison (==). Check loop bounds: for i ← 1 to n runs n times, not n − 1. Integer division truncates: 5/2 gives 2 in integer arithmetic. Array index 0 is valid; index n is out of bounds for an n-element array. Uninitialised variables do not start at zero automatically.