Programming and Algorithms
Core programming knowledge
Candidates must read and write algorithms using sequence, selection and iteration, and express them as pseudocode or flowcharts. Know the standard control structures, subprograms (functions and procedures), parameter passing, local versus global scope, and the difference between a function (returns a value) and a procedure (performs an action). Understand data types, arrays and records, and validation versus verification. Learn to trace code line by line, tracking variable values in a table - examiners reward showing working, not just a final answer.
Algorithms and complexity
Be able to describe and compare linear search and binary search (binary requires sorted data and is far faster on large sets), and simple sorting approaches such as bubble and insertion sort. Understand test data: normal, boundary and erroneous, and the purpose of a test table with expected versus actual output. Debugging means locating and fixing errors; testing only reveals their presence.
Traps to watch
Off-by-one errors in loops and array indices are the classic trap. Another is confusing pass by value (a copy is changed) with pass by reference (the original is changed). Questions may ask for the output of code containing an early exit or a nested loop - trace carefully rather than guessing.
Worked example
For a binary search on a sorted list of 1000 items, halving each time gives about 10 comparisons (2^10 ≈ 1024), whereas linear search may need up to 1000. Rule of thumb: sorted data plus large size means binary search; unsorted or tiny data means linear search is acceptable.