Programming and Software Development
Core concepts
Candidates must read and write code in at least one language and understand constructs common to all: variables and scope, data types, operators and precedence, selection, iteration, functions with parameters and return values, and error handling. Know the difference between syntax errors (code won't compile/parse), runtime errors (crash during execution), and logic errors (runs but wrong output). Understand testing: unit, integration, system, and acceptance; black-box versus white-box; and the purpose of test data (normal, boundary, erroneous). Be familiar with the software development life cycle, version control basics, and the difference between compiled and interpreted languages.
Traps
- Integer division: 7/2 yields 3 in many languages; check the stated language's rules.
- Operator precedence:
andbinds tighter thanorin most languages; parenthesise when tracing. - Pass-by-value versus pass-by-reference changes whether a function can mutate the caller's variable.
- A loop that never executes (condition false initially) is not an error-questions test whether you notice zero iterations.
- Boundary testing targets edges (0, 1, max, empty), not average values.
Worked example
def total(items):
s = 0
for i in items:
s += i
return s
Calling total([]) returns 0 (zero iterations, valid). Calling total([3, -1, 4]) returns 6. A logic error would be initialising s = 1, which returns 7 for the same input-code still runs. Rule of thumb: for any function, test empty, single-element, typical, and boundary inputs before declaring it correct.