Programming Fundamentals and Problem Solving
Programming fundamentals test the ability to turn a problem statement into an algorithm, flowchart or pseudocode and to trace it accurately.
From problem to program
This area covers problem decomposition, algorithm design, flowcharts and pseudocode before coding. An algorithm is a finite, unambiguous sequence of steps. A flowchart uses an oval for start/end, a parallelogram for input/output, a rectangle for process, a diamond for decision, and arrows for flow. Pseudocode combines structured English with programming constructs.
Core constructs
Sequence executes steps in order; selection uses if/else or switch; iteration uses for, while or do–while loops. Variables hold values of a data type; operators follow precedence (parentheses, exponent, multiplication/division, addition/subtraction, comparison, logical). A dry run traces variable values line by line, which is the fastest way to find logic errors.
Worked example
Find the sum of 1 to 5. Pseudocode: total ← 0; for i ← 1 to 5: total ← total + i. Dry run: i=1 total=1; i=2 total=3; i=3 total=6; i=4 total=10; i=5 total=15. Output 15. Check with n(n+1)/2 = 5×6/2 = 15, confirming the loop.
Traps that cost marks
- Using a decision diamond for a process step.
- Off-by-one loop bounds: 1 to 5 runs five times, 1 to n−1 runs n−1 times.
- Confusing assignment (=) with comparison (==) in pseudocode or code.
- Declaring an algorithm correct without testing boundary and invalid inputs.