Mock-driven revision system

Turn every lost mark into a repeatable method.

Revise the complete Weeks 1–4 syllabus, repair the exact patterns behind your mocks, and practise 65 archived past-paper questions alongside 69 focused questions.

Question bank13469 core + 65 past-paper questions
Best practice score0%Saved on this device
Practice attempts0Repeat until automatic
PriorityLoopsSingle → nested → dependent

Today

Four-part sprint

Evidence from your mock

Lost-mark map

  1. High
    Nested-loop countingAnswered 32; expected 15
  2. High
    continue tracingSkipped value was still printed
  3. Medium
    Expression evaluation&&, integer division, %, compound assignment
  4. Medium
    MSQ completenessTwo partially correct answers

Official Weeks 1–4 scope

Revision notes

Use the rules, then test yourself with the worked example before opening the answer.

01

How a computer works

Memory and computation

Think of the CPU as a worker with a few very fast working slots called registers. RAM holds the larger working set, while the Program Counter tells the CPU where the next instruction is. The basic cycle is fetch → decode → execute.

  • Program Counter: address of the next instruction
  • Hierarchy: Registers → Cache → RAM → SSD
  • Load: memory to register
  • Store: register to memory
  • Split memory: instructions and data use separate paths
  • Memory-mapped I/O: devices are accessed through addresses
How to solve a register question
  1. Write the old value of every register and memory location.
  2. Evaluate the right-hand side using only those current values.
  3. Write the result into the left-hand destination; change nothing else.
Worked load example
R[0] = 4
M[4] = 31
R[1] ← M[R[0]]

M[R[0]] = M[4] = 31
Therefore R[1] = 31
Common Week 1 traps

Load versus store: follow the arrow. If the arrow ends at a register, it is a load. If it ends at memory, it is a store. Cache is faster than RAM but smaller; SSD is persistent but much slower than registers and cache.

02

Data representation

Bits, encoding and compilation

A bit is one binary choice, 0 or 1. With n bits there are 2n distinct patterns. Unsigned numbers use every pattern for zero or a positive value; two’s complement uses half the patterns for negative values.

  • Unsigned n-bit: 0 to 2n−1
  • Two’s complement: −2n−1 to 2n−1−1
  • Negative value: invert positive bits, then add 1
  • Hexadecimal: one digit represents four bits
  • Characters: ASCII/Unicode map characters to numbers
  • Compilation: C source becomes machine instructions
Conversion method

For binary to decimal, label positions from right to left as 1, 2, 4, 8, 16… and add the positions containing 1. For binary to hexadecimal, split from the right into groups of four bits and convert each group separately.

Worked −12 example
+12      00001100
Invert  11110011
Add 1   11110100

−12 = 11110100
Range and instruction-size method

For an unsigned n-bit value, write 0 to 2n−1. For signed two’s complement, write −2n−1 to 2n−1−1. For instruction size, calculate the bits needed for each independent choice—opcode, register, and address—then add them.

03

C fundamentals

Types, operators and expressions

C evaluates an expression according to precedence and associativity, not simply from left to right. Parentheses first, then multiplication/division/remainder, then addition/subtraction, followed by comparisons and logical operators.

  • Built-in types: char, int, float, double
  • Not built-in C types: string, class
  • Integer division: 7 / 3 gives 2
  • Remainder: 7 % 3 gives 1
  • Logical result: false is 0; true is 1
  • Assignment: chained assignments evaluate right to left
Expression method
  1. Copy the initial value of each variable.
  2. Resolve parentheses and high-precedence operators.
  3. For x++, use the old value and increment afterward; for ++x, increment first.
  4. Update variables after each complete statement.
Pre- versus post-increment
int x = 6;
int y = x++ + 4;

y uses 6, so y = 10
then x becomes 7
Logical and compound-assignment traps

&& is true only when both sides are non-zero; || is true when either side is non-zero. In a += b += c, work from the right: update b first, then use the new b to update a.

04

Control flow

Conditions and loops

Every loop has four questions: What is the starting value? What condition allows another iteration? What happens in the body? How does the control variable change? A nested loop repeats the complete inner loop for every legal outer-loop value.

  • if: zero is false; non-zero is true
  • switch: execution falls through without break
  • continue: skip the rest of this iteration
  • break: exit the loop immediately
  • Single loop: list every legal control-variable value
  • Nested loop: restart the inner loop for each outer value
Loop-solving rule

Never multiply loop limits until you know the inner count is constant. If the inner condition contains the outer variable, make one row for each outer value and add the row counts.

The five-column tracing method
Iteration | i before | condition | body/output | i after
1         | 2        | 2 <= 8    | print C     | 4
2         | 4        | 4 <= 8    | print C     | 6
3         | 6        | 6 <= 8    | print C     | 8
4         | 8        | 8 <= 8    | print C     | 10
stop      | 10       | false     | —           | —
Worked dependent nested loop
for (i = 2; i <= 4; i++)
    for (j = 1; j <= i; j++)
        printf("*");

i = 2 → 2 prints
i = 3 → 3 prints
i = 4 → 4 prints
Total = 2 + 3 + 4 = 9

continue skips the remaining body for only the current iteration. break exits the nearest loop completely.

Personalised from your mock

Repair lab

Learn the method behind every lost-mark pattern, then practise a changed version.

Priority 2

continue skips the body

for (i = 0; i < 5; i++) {
    if (i == 2) continue;
    printf("%d ", i);
}

At i = 2, printing is skipped. The update still occurs, so the output is 0 1 3 4.

Priority 3

Logical expressions

(x >= y) && (x / y == 2)

Evaluate each comparison as 0 or 1. With &&, the result is 1 only when both sides are true. Read whether the question asks for output 0 or output 1.

Priority 4

Compound assignment

a = b = c = d = 2;
a += b += c += d;

Work right to left: c=4, then b=6, then a=8. Only after that should you evaluate the next expression.

MSQ rule

Check every option independently

For multiple-select questions, do not stop after finding one true option. Mark every option T/F, then select the complete true set. Equivalent forms such as [−2³¹, 2³¹−1] and [−2³¹, 2³¹) can both be correct.

C vocabulary

Built-in data types

int and char are C types. C has no built-in string type and no class keyword. Strings are arrays of char.

Exact-set scoring

Complete question practice

Choose all 134 questions, the complete 26-question Assembly & Registers set, the 65-question past-paper archive, one paper, one week, or only weak areas.