SQU IT Exit study materials
SQU IT Exit study resources

SQU IT Exit: Programming Fundamentals and Problem Solving

SQU IT Exit · Work through your exam, one topic at a time.

All guide sections

Programming Fundamentals and Problem Solving

What this domain tests

Programming Fundamentals and Problem Solving checks whether you can read a short program or pseudocode, predict its output, and choose a correct algorithm rather than recall syntax trivia. Expect tracing, data types, control flow, functions, scope, recursion, and debugging.

Core rules and concepts

  • Integer division truncates toward zero in Java and C; 5/2 is 2, and -5/2 is -2 in Java.
  • = assigns; == compares. Comparing objects with == usually compares references, not contents.
  • && and || short-circuit. The right operand may never run, so side effects there are unsafe.
  • Java passes primitives by value and object references by value: a method can mutate the object but cannot reassign the caller's reference.
  • Arrays are 0-indexed; a loop for (i=0; i<n; i++) visits exactly n elements.

Worked example

int sum = 0; for (int i = 1; i <= 5; i++) { if (i % 2 == 0) continue; sum += i; } Trace: i=1 is odd, sum=1; i=2 is even, continue skips the addition; i=3, sum=4; i=4 skipped; i=5, sum=9. The result is 9. continue jumps to the update statement, not out of the loop; break would exit.

Traps that cost marks

Using <= when the array length is n causes an out-of-bounds access. Forgetting that continue still runs the loop update. Treating 5/2 as 2.5. Writing a recursive function without a base case. Assuming && always evaluates both sides.