How Computers Work
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 . 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 can be written more compactly in octal than in hexadecimal, and that this is why octal is preferred for byte values. Convert 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 and 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 (machine runs) only when a guard is closed () and at least one of two operators has pressed their button ( or ), unless an emergency stop is active (), which always forces .
(a) Write a Boolean expression for in terms of . (3)
(b) Build the complete truth table for restricted to the case (i.e. vary 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 , and carry-in . Give Boolean expressions for the Sum () and Carry-out () outputs. (3)
(b) Using full adders, compute by hand, showing each column's carry. Give the 5-bit result. (3)
(c) A -to- multiplexer selects input or using select line . Write its Boolean output expression, then explain in one sentence how you would extend it to a -to- multiplexer (how many select lines are needed). (3)
(d) A D flip-flop is wired so its output is fed back through a NOT gate into its own 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) : , , so decimal. Binary: , → . Marks: decimal 182 (1), correct method (1), binary (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) (since ).
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) , . XOR = . Marks: correct XOR bits (1), hex FC (1).
Question 2 (13 marks)
(a) . Marks: AND of G (1), OR of A,B (1), NOT E factor (1).
(b) With , :
| 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 → . 1 NAND. AND: NAND then NOT → ; 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) ; . Marks: S (1), Cout main term (1), Cout carry-propagate term (1).
(b) :
- 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: (= 17 decimal; ✓). Marks: carries shown (1), result bits (1), 5-bit answer 10001 (1).
(c) . A 4-to-1 mux needs 2 select lines (). Marks: expression (2), 2 select lines (1).
(d) Each clock edge inverts (since ), so toggles . 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 = where = number of flip-flops (bits), since each stores one independent bit. For 8: values. Marks: 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) (= 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)"}
]