Level 4 — ApplicationHow Computers Work

How Computers Work

60 minutes60 marksprintable — key stays hidden on paper

Level: 4 (Application — novel problems, no hints) Time limit: 60 minutes Total marks: 60

Answer all questions. Show all working. Use ...... notation for any binary/hex arithmetic where helpful.


Question 1 — Number Systems in Context (12 marks)

A network device stores its firmware version as a single byte and its MAC-address fragment as two bytes.

(a) The firmware version byte is stored as the hexadecimal value 0xB6\text{0x}B6. Convert it to both decimal and 8-bit binary. (3)

(b) The device counts boot events in a 6-bit binary counter. It has just displayed 101110. Write the next four values it will display as it counts up. (3)

(c) A programmer claims the value 0xB6\text{0x}B6 can be written more compactly in octal than in hexadecimal, and that this is why octal is preferred for byte values. Convert 0xB6\text{0x}B6 to octal, then state whether the claim is correct and explain why hexadecimal is actually the standard grouping for bytes. (4)

(d) Two firmware bytes 0xB6\text{0x}B6 and 0x4A\text{0x}4A are combined with a bitwise XOR to make a checksum. Give the checksum in hexadecimal. (2)


Question 2 — Boolean Logic & Gate Economy (13 marks)

A safety interlock outputs F=1F=1 (machine runs) only when a guard is closed (G=1G=1) and at least one of two operators has pressed their button (AA or BB), unless an emergency stop is active (E=1E=1), which always forces F=0F=0.

(a) Write a Boolean expression for FF in terms of G,A,B,EG, A, B, E. (3)

(b) Build the complete truth table for FF restricted to the case G=1G=1 (i.e. vary A,B,EA, B, E only, 8 rows). (4)

(c) It is a well-known result that NAND gates alone can build any circuit. Show how to build a NOT gate and an AND gate using only 2-input NAND gates, stating the gate count for each. (3)

(d) Identify which single named binary operation from a truth table gives output 1 exactly when its two inputs differ, and give one practical use of it inside an adder. (3)


Question 3 — Combinational & Sequential Design (12 marks)

(a) A full adder adds bits AA, BB and carry-in CinC_{in}. Give Boolean expressions for the Sum (SS) and Carry-out (CoutC_{out}) outputs. (3)

(b) Using full adders, compute 10112+011021011_2 + 0110_2 by hand, showing each column's carry. Give the 5-bit result. (3)

(c) A 22-to-11 multiplexer selects input D0D_0 or D1D_1 using select line SS. Write its Boolean output expression, then explain in one sentence how you would extend it to a 44-to-11 multiplexer (how many select lines are needed). (3)

(d) A D flip-flop is wired so its output QQ is fed back through a NOT gate into its own DD input, and it is clocked repeatedly. Describe the output behaviour over successive clock edges and name the type of circuit this creates. (3)


Question 4 — CPU, Memory & Execution (14 marks)

(a) List the three main components of a CPU and give the one-line role of each. (3)

(b) Put the following storage types in order from fastest/smallest to slowest/largest, then explain the fundamental trade-off that forces this hierarchy to exist: RAM, L1 cache, HDD, CPU register, SSD, L3 cache. (4)

(c) The fetch-decode-execute cycle runs one instruction. For each of the three phases, name what the CPU does and which component(s) are primarily involved. (3)

(d) A CPU register is described as "8 flip-flops in a row." Explain what determines the number of distinct values such a register can hold, and give that number for this register. (2)

(e) Explain, in the context of abstraction, why a programmer can write x = a + b without knowing which physical RAM addresses store a and b. Name the system component responsible. (2)


Question 5 — Integrated Reasoning (9 marks)

A tiny toy CPU has 3-bit registers and a machine instruction ADD R1, R2 that stores the result back into R1.

(a) R1 holds 110 and R2 holds 101. Perform the addition. Because registers are only 3 bits, state the value actually stored in R1 and explain what has been lost. (3)

(b) The same operation x = a + b in a high-level language becomes several machine-code instructions. Explain the relationship between assembly and machine code, and why machine code is what "actually runs." (3)

(c) Suggest one hardware flag the CPU's ALU should set as a result of the part (a) computation, and explain what software could do with it. (3)

Answer keyMark scheme & solutions

Question 1 (12 marks)

(a) 0xB6\text{0x}B6: B=11B=11, 6=66=6, so 11×16+6=176+6=18211\times16 + 6 = 176+6 = 182 decimal. Binary: B=1011B=1011, 6=01106=01101011011010110110. Marks: decimal 182 (1), correct method (1), binary 1011011010110110 (1).

(b) Counting up from 101110 (=46): next four are 101111 (47), 110000 (48), 110001 (49), 110010 (50). Marks: 1 for first two correct, 1 for handling the carry into 110000, 1 for last two.

(c) 0xB6=182=2668\text{0x}B6 = 182 = 266_8 (since 2×64+6×8+6=128+48+6=1822\times64 + 6\times8 + 6 = 128+48+6=182). Octal 266 uses 3 digits vs hex B6 uses 2 digits — the claim is wrong; hex is more compact here. Hex is standard because one hex digit maps to exactly 4 bits, so a byte (8 bits) is always exactly 2 hex digits; octal groups in 3s which does not divide 8 evenly. Marks: octal 266 (2), claim rejected (1), 4-bit grouping reason (1).

(d) 0xB6=10110110\text{0x}B6 = 10110110, 0x4A=01001010\text{0x}4A = 01001010. XOR = 11111100=0xFC11111100 = \text{0x}FC. Marks: correct XOR bits (1), hex FC (1).


Question 2 (13 marks)

(a) F=G(A+B)EF = G \cdot (A + B) \cdot \overline{E}. Marks: AND of G (1), OR of A,B (1), NOT E factor (1).

(b) With G=1G=1, F=(A+B)EF = (A+B)\cdot\overline{E}:

A B E F
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0

Marks: correct E=1 rows all 0 (2), correct A+B logic when E=0 (2).

(c) NOT: tie both inputs of a NAND together → XX=X\overline{X\cdot X}=\overline{X}. 1 NAND. AND: NAND then NOT → AB=AB\overline{\overline{A\cdot B}} = A\cdot B; the NOT is itself a NAND, so 2 NANDs. Marks: NOT construction (1), AND construction (1), gate counts (1).

(d) XOR outputs 1 exactly when inputs differ. In an adder it computes the Sum bit (and half-adder sum). Marks: XOR named (1), "differ" justification (1), adder sum use (1).


Question 3 (12 marks)

(a) S=ABCinS = A \oplus B \oplus C_{in}; Cout=(AB)+(Cin(AB))C_{out} = (A\cdot B) + (C_{in}\cdot(A\oplus B)). Marks: S (1), Cout main term (1), Cout carry-propagate term (1).

(b) 1011+01101011 + 0110:

  • col0: 1+0=1, carry 0
  • col1: 1+1=0, carry 1
  • col2: 0+1+1(carry)=0, carry 1
  • col3: 1+0+1(carry)=0, carry 1 Result: 10001210001_2 (= 17 decimal; 11+6=1711+6=17 ✓). Marks: carries shown (1), result bits (1), 5-bit answer 10001 (1).

(c) Y=SD0+SD1Y = \overline{S}\cdot D_0 + S\cdot D_1. A 4-to-1 mux needs 2 select lines (22=42^2=4). Marks: expression (2), 2 select lines (1).

(d) Each clock edge inverts QQ (since D=QD=\overline{Q}), so QQ toggles 0,1,0,1,0,1,0,1,\dots. Output frequency is half the clock frequency — this is a frequency divider / toggle (T) flip-flop / 1-bit counter. Marks: toggling described (1), half-frequency noted (1), named (1).


Question 4 (14 marks)

(a) ALU — performs arithmetic/logic operations; Control Unit — fetches/decodes instructions and directs data flow; Registers — small fast storage for operands/results. Marks: 1 each.

(b) Fastest→slowest: CPU register → L1 cache → L3 cache → RAM → SSD → HDD. Trade-off: faster memory (closer to CPU, using more transistors per bit / more expensive tech) costs more per bit and generates more heat, so only small amounts are affordable; large capacity requires cheaper, slower technology — hence a hierarchy balancing speed vs. size/cost. Marks: correct order (2), trade-off explanation (2).

(c) Fetch — read instruction from memory using PC → involves Control Unit + memory/cache. Decode — interpret the instruction bits → Control Unit. Execute — perform the operation (e.g. compute) → ALU (and registers for operands/result). Marks: 1 per phase with component.

(d) Number of values = 2n2^{n} where nn = number of flip-flops (bits), since each stores one independent bit. For 8: 28=2562^8 = 256 values. Marks: 2n2^n reasoning (1), 256 (1).

(e) The operating system (with the memory-management unit) provides an abstraction: it maps program variables to physical addresses and manages memory, so the programmer works with names/logical addresses. Component: operating system / memory manager. Marks: abstraction idea (1), OS named (1).


Question 5 (9 marks)

(a) 110+101=10112110 + 101 = 1011_2 (= 6+5 = 11). But R1 is 3 bits, so only the low 3 bits 011 (=3) are stored; the carry-out bit (the 4th bit) is lost — this is overflow. Marks: full sum 1011 (1), stored value 011 (1), overflow/lost bit (1).

(b) Assembly is a human-readable mnemonic form (e.g. ADD R1,R2); an assembler translates it one-to-one into machine code — the binary instruction pattern the CPU decodes. The CPU hardware only reads binary opcodes, so machine code is what physically executes. Marks: assembly↔machine mapping (1), assembler translation (1), CPU runs binary (1).

(c) The carry (or overflow) flag should be set. Software can detect that a result exceeded 3 bits and handle it — e.g. raise an error, use multi-word arithmetic, or saturate the value. Marks: carry/overflow flag named (1), correct meaning (1), software use (1).

[
{"claim":"0xB6 = 182 decimal","code":"result = (int('B6',16)==182)"},
{"claim":"0xB6 in octal is 266","code":"result = (oct(int('B6',16))[2:]=='266')"},
{"claim":"0xB6 XOR 0x4A = 0xFC","code":"result = (int('B6',16)^int('4A',16)==int('FC',16))"},
{"claim":"1011b + 0110b = 10001b (17)","code":"result = (int('1011',2)+int('0110',2)==int('10001',2)==17)"},
{"claim":"8 flip-flops hold 256 values","code":"result = (2**8==256)"},
{"claim":"110b+101b=1011b, low 3 bits =011b=3, overflow lost","code":"s=int('110',2)+int('101',2); result = (s==11 and (s & 0b111)==3 and (s>>3)==1)"}
]