CS Fundamentals — MCQs & Practice Questions

122 multiple-choice questions and 92 exam-style questions with mark schemes, organised by chapter, with answers you can check as you go. Free, no sign-up.

New to a topic? Read the CS Fundamentals notes first, then come back to practise.

01

How Computers Represent Data

Multiple choice · 16

Q11011₂ in decimal is:

  1. A9
  2. B11
  3. C13
  4. D23
Show answer

Correct answer: B — 11

Place values 8, 4, 2, 1: 8 + 0 + 2 + 1 = 11.

Q2How many values can 6 bits represent?

  1. A12
  2. B36
  3. C64
  4. D128
Show answer

Correct answer: C — 64

Each extra bit doubles the number of possibilities, so n bits give 2ⁿ values: 2⁶ = 64. Those values run from 0 to 63, not 1 to 64 — the count includes zero, which is why the largest value is always one less than the total.

Q3FF₁₆ in decimal is:

  1. A155
  2. B255
  3. C256
  4. D1515
Show answer

Correct answer: B — 255

F is 15, so FF = 15×16 + 15 = 255. It is also 11111111 in binary, the largest 8-bit value.

Q410110110₂ in hexadecimal is:

  1. AB6
  2. B6B
  3. CA6
  4. DB5
Show answer

Correct answer: A — B6

Group in fours from the right: 1011 = B and 0110 = 6, giving B6. Grouping from the left instead is the usual error.

Q5Decimal 13 in binary is:

  1. A1011
  2. B1101
  3. C1110
  4. D1001
Show answer

Correct answer: B — 1101

Dividing by 2 repeatedly gives remainders 1, 0, 1, 1 read upwards as 1101. Check: 8 + 4 + 1 = 13.

Q6ASCII uses 7 bits, so it can represent:

  1. A7 characters
  2. B49 characters
  3. C128 characters
  4. D256 characters
Show answer

Correct answer: C — 128 characters

2⁷ = 128. Option D would be 8-bit extended ASCII, which is a different code.

Q7Adding 11111111 and 00000001 in 8 bits produces:

  1. A100000000 stored correctly
  2. B00000000 with overflow
  3. C11111111
  4. Dan error message
Show answer

Correct answer: B — 00000000 with overflow

255 + 1 = 256, which needs 9 bits. The carry out of the last column is lost, leaving 00000000 stored — a wrong answer, which is exactly what overflow means.

Q8Why is hexadecimal preferred to binary for writing memory addresses?

  1. Ait is a different number system
  2. Bit is four times shorter and converts with no arithmetic
  3. Ccomputers store hex directly
  4. Dit uses fewer symbols
Show answer

Correct answer: B — it is four times shorter and converts with no arithmetic

Each hex digit replaces exactly four bits, so a 32-bit address becomes 8 characters. The machine still stores binary — hex is purely for human readability.

Q9A colour depth of 4 bits allows how many colours?

  1. A4
  2. B8
  3. C16
  4. D32
Show answer

Correct answer: C — 16

2⁴ = 16. The depth is a count of bits, and the number of colours is 2 raised to it.

Q10ASCII uses 7 bits, representing:

  1. A7 characters
  2. B64 characters
  3. C128 characters
  4. D256 characters
Show answer

Correct answer: C — 128 characters

2⁷ = 128. Extended ASCII adds an eighth bit to reach 256.

Q11The file size of a bitmap depends on:

  1. Aresolution only
  2. Bcolour depth only
  3. Cboth resolution and colour depth
  4. Dthe number of colours actually used
Show answer

Correct answer: C — both resolution and colour depth

Size = width × height × colour depth. An image using only two colours still stores the full depth for every pixel unless it is compressed.

Q12A 500 × 400 image at 8 bits per pixel occupies:

  1. A200 000 bits
  2. B1 600 000 bits
  3. C200 000 bytes
  4. D1 600 000 bytes
Show answer

Correct answer: C — 200 000 bytes

500 × 400 × 8 = 1 600 000 bits, and dividing by 8 gives 200 000 bytes. Option B is the answer before converting to bytes.

Q13Increasing the sample rate of a recording:

  1. Areduces the file size
  2. Bimproves accuracy and increases the file size
  3. Chas no effect on size
  4. Dreduces the number of channels
Show answer

Correct answer: B — improves accuracy and increases the file size

More measurements per second follow the wave more closely and take proportionally more storage.

Q14Sample resolution refers to:

  1. Ahow often the wave is measured
  2. Bhow many bits store each measurement
  3. Cthe length of the recording
  4. Dthe number of channels
Show answer

Correct answer: B — how many bits store each measurement

How often is the sample RATE. Resolution is the precision of each individual measurement.

Q15Recording in stereo rather than mono:

  1. Ahalves the file size
  2. Bdoubles the file size
  3. Chas no effect
  4. Dtriples the file size
Show answer

Correct answer: B — doubles the file size

Two independent channels are stored, so everything is duplicated.

Q16The first 128 Unicode code points are identical to ASCII because:

  1. Ait was a coincidence
  2. Bit keeps existing ASCII text readable
  3. CASCII is a subset of Chinese
  4. Dit saves processing time
Show answer

Correct answer: B — it keeps existing ASCII text readable

Backwards compatibility: any file written in ASCII is already valid Unicode, so no conversion was needed for the vast amount of text that already existed.

Exam-style questions · 12

Q1[2 marks]
Why do computers use the binary number system?
Answer

A computer is built from electronic switches, each of which has only two reliable states — on and off, or high and low voltage. Binary has exactly two digits, so each digit maps directly onto one switch, making the hardware simple and resistant to electrical noise.

Q2[2 marks]
Convert 11010₂ to decimal.
Answer

Place values 16, 8, 4, 2, 1: 16 + 8 + 0 + 2 + 0 = 26.

Q3[2 marks]
State one advantage of hexadecimal over binary for a programmer.
Answer

It is far shorter and easier to read — one hex digit replaces four bits, so a 32-bit address takes 8 hex characters instead of 32 binary ones — while converting between the two needs no arithmetic at all.

Q4[4 marks]
Convert 2C₁₆ to binary and then to decimal.
Mark scheme
  1. 2 in hex is 0010 in binaryfour bits per hex digit[1]
  2. C is 12 in decimal, which is 1100A=10, B=11, C=12, D=13, E=14, F=15[1]
  3. Together: 00101100₂concatenate the groups, do not add them[1]
  4. Decimal: 32 + 8 + 4 = 44or 2×16 + 12 = 44 directly from hex[1]

2C₁₆ = 00101100₂ = 44₁₀

Q5[4 marks]
Add the 8-bit binary numbers 11001010 and 01110011. State whether overflow occurs.
Mark scheme
  1. Adds column by column from the right, carrying where a column totals 2[1]
  2. Result within 8 bits: 01000010 with a carry out of the leftmost column[1]
  3. In decimal 202 + 115 = 317, which exceeds the 8-bit maximum of 255[1]
  4. Overflow occurs — the true answer needs 9 bits, so the stored 8-bit result is incorrectthe consequence must be stated[1]

Carry out of the final column; overflow occurs because 317 > 255.

Q6[6 marks]
A system stores text using ASCII and images using 24-bit colour.
  1. How many different characters can 7-bit ASCII represent, and why is this insufficient for Urdu?
  2. How many distinct colours can 24-bit colour represent?
  3. Calculate the file size in KB of an uncompressed 100 × 200 pixel image in 24-bit colour.
Mark scheme
  1. 2⁷ = 128 characters[1]
  2. Urdu uses a different script with many additional letterforms, and 128 slots are already taken by English letters, digits and punctuation — so Unicode is used insteadnaming Unicode expected[1]
  3. 2²⁴ = 16 777 216 coloursaccept "about 16.7 million"[1]
  4. Total pixels = 100 × 200 = 20 000[1]
  5. Each pixel takes 24 bits = 3 bytes, so 20 000 × 3 = 60 000 bytesconverting bits to bytes is the step most often missed[1]
  6. 60 000 / 1024 = 58.6 KBaccept 58.6 or 60 KB if 1000 bytes per KB is stated[1]

(a) 128, too few for a second script (b) 16 777 216 (c) about 58.6 KB

Q7[2 marks]
State one advantage and one disadvantage of Unicode compared with ASCII.
Answer

Advantage: it represents over a million characters, covering every writing system including Urdu and Chinese, where ASCII covers only 128. Disadvantage: each character may need up to four bytes rather than one, so files are larger.

Q8[2 marks]
An image has a colour depth of 8 bits. How many different colours can each pixel be?
Answer

2⁸ = 256 colours.

Q9[2 marks]
Define sample rate and sample resolution.
Answer

Sample rate is the number of measurements taken per second, in hertz. Sample resolution is the number of bits used to store each measurement. The first controls accuracy in time, the second accuracy in amplitude.

Q10[4 marks]
A bitmap image is 1024 pixels wide and 768 pixels high with a colour depth of 16 bits. Calculate the file size in kilobytes.
Mark scheme
  1. Total pixels = 1024 × 768 = 786 432[1]
  2. Total bits = 786 432 × 16 = 12 582 912[1]
  3. Bytes = 12 582 912 ÷ 8 = 1 572 864dividing by 8 is the step most often missed[1]
  4. Kilobytes = 1 572 864 ÷ 1024 = 1536 KB[1]

1536 KB (1.5 MB)

Q11[4 marks]
A 30-second mono sound clip is recorded at 44 100 Hz with a resolution of 16 bits. Calculate the file size in megabytes, and state the effect of recording in stereo.
Mark scheme
  1. Bits = 44 100 × 16 × 30rate × resolution × seconds[1]
  2. = 21 168 000 bits[1]
  3. Bytes = 2 646 000, so ÷ 1 048 576 = 2.52 MBaccept 2.65 MB using 1 000 000[1]
  4. Stereo records two channels, so the file size doubles to about 5 MB[1]

About 2.5 MB mono, doubling to about 5 MB in stereo

Q12[6 marks]
A photographer must email a set of images but the files are too large.
  1. Explain two ways the file size of a bitmap image could be reduced, and the cost of each.
  2. Explain why increasing the colour depth from 8 to 24 bits triples the file size.
  3. Explain why the letters of the alphabet were given consecutive codes in ASCII.
Mark scheme
  1. Reduce the resolution — fewer pixels means a smaller file, at the cost of visible detail[1]
  2. Reduce the colour depth — fewer bits per pixel, at the cost of colour accuracy and possible banding in smooth gradientsaccept compression as a third method[1]
  3. The file size is width × height × colour depth, and only the depth has changed[1]
  4. 24 is three times 8, and the size is directly proportional to the depth, so the file is three times as largethe proportionality is the mark[1]
  5. Consecutive codes mean sorting alphabetically is the same as sorting numerically[1]
  6. And converting between upper and lower case is a fixed addition or subtraction of 32, both of which would be far harder with arbitrary assignments[1]

(a) fewer pixels or fewer bits per pixel (b) size is proportional to depth, and 24 is 3 × 8 (c) sorting and case conversion become arithmetic

02

Logic and Circuits

Multiple choice · 16

Q1A two-input AND gate outputs 1 when the inputs are:

  1. A0 and 0
  2. B0 and 1
  3. C1 and 0
  4. D1 and 1
Show answer

Correct answer: D — 1 and 1

AND requires every input to be 1. Any 0 forces the output to 0.

Q2A NOR gate outputs 1 when:

  1. Aboth inputs are 1
  2. Bboth inputs are 0
  3. Cthe inputs differ
  4. Dalways
Show answer

Correct answer: B — both inputs are 0

NOR is OR followed by NOT. OR gives 0 only when both inputs are 0, so NOR gives 1 only then.

Q3The expression (A + B)′ is equivalent to:

  1. AA′ + B′
  2. BA′ · B′
  3. CA · B
  4. DA ⊕ B
Show answer

Correct answer: B — A′ · B′

De Morgan's second law: complementing a sum turns it into a product of complements. Option A applies the law in the wrong direction.

Q4A truth table for a circuit with 4 inputs has how many rows?

  1. A4
  2. B8
  3. C16
  4. D32
Show answer

Correct answer: C — 16

2⁴ = 16. Each additional input doubles the number of combinations.

Q5Simplify A·B + A·B′.

  1. AA
  2. BB
  3. CA·B
  4. D0
Show answer

Correct answer: A — A

Factor out A to get A·(B + B′), and B + B′ = 1, leaving A · 1 = A. The value of B turns out not to matter at all.

Q6In a half adder, the Carry output is produced by:

  1. Aan XOR gate
  2. Ban AND gate
  3. Can OR gate
  4. Da NOT gate
Show answer

Correct answer: B — an AND gate

A carry occurs only when both bits are 1, which is exactly the AND condition. XOR produces the Sum.

Q7Which is TRUE in Boolean algebra?

  1. AA + A = 2A
  2. BA + 1 = 1
  3. CA · A = A²
  4. DA + A′ = 0
Show answer

Correct answer: B — A + 1 = 1

Once one input to an OR is 1 the output is 1 regardless of the other. There is no 2 and no squaring in Boolean algebra, and A + A′ = 1, not 0.

Q8NAND is described as a universal gate because:

  1. Ait is the fastest gate
  2. Bany logic circuit can be built from NAND gates alone
  3. Cit has the most inputs
  4. Dit uses no power
Show answer

Correct answer: B — any logic circuit can be built from NAND gates alone

NOT, AND and OR can all be constructed from NAND gates, and therefore so can anything else. It means a manufacturer can build a whole chip from one repeated gate design.

Q9In Boolean algebra, A + A equals:

  1. A2A
  2. BA
  3. C0
  4. D1
Show answer

Correct answer: B — A

The idempotent law. Variables hold only 0 or 1, so there is nothing to accumulate — unlike ordinary algebra.

Q10(A · B)‾ is equivalent to:

  1. AĀ · B̄
  2. BĀ + B̄
  3. CA + B
  4. DA · B
Show answer

Correct answer: B — Ā + B̄

De Morgan: break the bar and change the AND to an OR.

Q11Karnaugh map headings use Gray code so that adjacent cells:

  1. Aare in numerical order
  2. Bdiffer in exactly one variable
  3. Chave the same value
  4. Dcan be ignored
Show answer

Correct answer: B — differ in exactly one variable

Single-variable adjacency is what allows a variable to be eliminated when cells are grouped.

Q12A valid Karnaugh map group may contain:

  1. Aany number of cells
  2. Bonly powers of two
  3. Conly 3 cells
  4. Donly single cells
Show answer

Correct answer: B — only powers of two

Groups must be 1, 2, 4, 8 … cells and rectangular. A group of three cannot eliminate a variable cleanly.

Q13A group of 4 cells on a K-map eliminates how many variables?

  1. A1
  2. B2
  3. C3
  4. D4
Show answer

Correct answer: B — 2

Each doubling of the group size removes one more variable, so 4 cells remove two.

Q14The four corner cells of a 4×4 Karnaugh map:

  1. Acannot be grouped
  2. Bform a valid group of 4
  3. Cform four separate groups
  4. Dmust be zeros
Show answer

Correct answer: B — form a valid group of 4

The map wraps in both directions, so the corners are all adjacent to one another.

Q15A + Ā·B simplifies to:

  1. AA
  2. BB
  3. CA + B
  4. DA · B
Show answer

Correct answer: C — A + B

Expanding gives (A + Ā)(A + B) = 1·(A + B) = A + B.

Q16NAND is functionally complete, which means:

  1. Ait is the fastest gate
  2. Bany circuit can be built from NAND gates alone
  3. Cit has two inputs
  4. Dit never fails
Show answer

Correct answer: B — any circuit can be built from NAND gates alone

NOT, AND and OR can all be constructed from NAND gates, so anything at all can be. NOR shares this property.

Exam-style questions · 11

Q1[2 marks]
Draw the truth table for a two-input NAND gate.
Answer

Inputs 00 → 1, 01 → 1, 10 → 1, 11 → 0. NAND is the inverse of AND, so it outputs 0 only when both inputs are 1.

Q2[2 marks]
State De Morgan's two laws.
Answer

(A · B)′ = A′ + B′ and (A + B)′ = A′ · B′. Complementing a whole expression swaps AND for OR and complements each variable.

Q3[2 marks]
Why are NAND and NOR called universal gates?
Answer

Because any logic function whatsoever can be built using copies of just one of them. NOT, AND, OR and every larger circuit can be constructed from NAND alone, or from NOR alone, which is why chip manufacturers can make a whole processor from one repeated gate design.

Q4[4 marks]
Construct the truth table for X = A′ · B + A · B′ and state which single gate it is equivalent to.
Mark scheme
  1. Four rows for two inputs, with columns for A′ and B′[1]
  2. A=0,B=0 → 0; A=0,B=1 → 1A′·B is 1 in the second row[1]
  3. A=1,B=0 → 1; A=1,B=1 → 0[1]
  4. Output is 1 exactly when the inputs differ, so this is an XOR gatethe identification is the point of the question[1]

The table matches XOR: output 1 when A and B differ.

Q5[4 marks]
Simplify X = (A + B) · (A + B′) using Boolean laws, naming each law you use.
Mark scheme
  1. Expand: A·A + A·B′ + B·A + B·B′distributive law[1]
  2. A·A = A (idempotent) and B·B′ = 0 (complement)[1]
  3. X = A + A·B′ + A·Bthe zero term disappears[1]
  4. By absorption A + A·anything = A, so X = Anaming the law is required by the question[1]

X = A

Q6[6 marks]
A half adder adds two single bits.
  1. Write the truth table showing Sum and Carry for the four input combinations.
  2. State which gate produces the Sum and which produces the Carry.
  3. Explain why a half adder cannot be used for the second column of a multi-bit addition.
Mark scheme
  1. 0+0 → Sum 0, Carry 0; 0+1 → Sum 1, Carry 0[1]
  2. 1+0 → Sum 1, Carry 0; 1+1 → Sum 0, Carry 1the last row is the whole point — 1+1 in binary is 10[1]
  3. Sum is produced by an XOR gateoutput 1 when the inputs differ[1]
  4. Carry is produced by an AND gateoutput 1 only when both are 1[1]
  5. A half adder has only two inputs, so it has nowhere to accept the carry produced by the previous column[1]
  6. A full adder is needed instead, taking three inputs — A, B and carry-innaming the full adder is expected[1]

(b) XOR for Sum, AND for Carry (c) it has no carry-in input, so a full adder is required

Q7[2 marks]
State De Morgan's two laws.
Answer

(A · B)‾ = Ā + B̄ and (A + B)‾ = Ā · B̄. In words: break the bar and change the operation between the terms.

Q8[2 marks]
Explain why the headings on a Karnaugh map are arranged in the order 00, 01, 11, 10 rather than 00, 01, 10, 11.
Answer

This is Gray code order, in which adjacent headings differ in exactly one variable. That adjacency is what makes grouping valid: within a group only one variable changes, so it can be eliminated. With ordinary binary order, neighbouring cells would differ in two variables and grouping would not simplify correctly.

Q9[3 marks]
State three rules for forming groups on a Karnaugh map.
Answer

Groups must contain a number of cells that is a power of two (1, 2, 4, 8…); groups must be rectangular and as large as possible; groups may overlap, and the map wraps round so opposite edges are adjacent.

Q10[6 marks]
(a) Simplify A·B + A·B̄ using Boolean algebra, showing each law used.
(b) Simplify A + Ā·B.
(c) Explain what is meant by saying NAND is functionally complete, and show how a NOT gate is made from one.
Mark scheme
  1. (a) A·B + A·B̄ = A·(B + B̄) — factorising, using the distributive law.Taking out the common factor is the first move.[1]
  2. B + B̄ = 1 by the inverse law, so A·1 = A by the identity law.Both laws should be named for full credit.[1]
  3. (b) A + Ā·B = (A + Ā)·(A + B) by distributionThis is the less obvious route; the absorption-style result can also be quoted.[1]
  4. = 1·(A + B) = A + BUsing the inverse and identity laws again.[1]
  5. (c) Functionally complete means any logic circuit can be built using only that one type of gate.The definition must mention building any circuit.[1]
  6. A NOT gate is made by connecting both inputs of a NAND together: NAND(A, A) = (A·A)‾ = Ā.The working using the idempotent law makes it convincing.[1]

(a) A; (b) A + B; (c) any circuit from one gate type; NAND(A,A) = NOT A

Q11[2 marks]
Explain why simplifying a Boolean expression before building the circuit is worthwhile.
Answer

A simpler expression needs fewer gates, which makes the circuit cheaper to manufacture, smaller, and lower in power consumption. Fewer gates in a signal path also means less propagation delay, so the circuit runs faster.

03

Inside the Machine

Multiple choice · 24

Q1Which of these is volatile?

  1. AHard disk
  2. BSSD
  3. CRAM
  4. DDVD
Show answer

Correct answer: C — RAM

RAM loses its contents the moment power is removed. The other three are all secondary storage and keep data without power.

Q2The part of the CPU that performs calculations is the:

  1. Acontrol unit
  2. BALU
  3. Cprogram counter
  4. Dcache
Show answer

Correct answer: B — ALU

The arithmetic and logic unit does the arithmetic and the comparisons. The control unit directs traffic but computes nothing itself.

Q3During which stage is the instruction brought from memory into the CPU?

  1. AFetch
  2. BDecode
  3. CExecute
  4. DStore
Show answer

Correct answer: A — Fetch

Fetch places the program counter's address on the address bus and the instruction returns on the data bus.

Q4The address bus is unidirectional because:

  1. Ait is faster that way
  2. Bmemory never sends addresses to the CPU
  3. Cit carries only one bit
  4. Dit is shorter
Show answer

Correct answer: B — memory never sends addresses to the CPU

The CPU always decides which location to access, so addresses only ever travel outward. Data, by contrast, must travel both ways.

Q5A computer with 4 GB of RAM slows badly when many programs are open because:

  1. Athe CPU overheats
  2. Bit swaps data to much slower storage
  3. Cthe monitor cannot keep up
  4. Dthe address bus fills
Show answer

Correct answer: B — it swaps data to much slower storage

When RAM is full the operating system moves pages out to disk. Disk is thousands of times slower than RAM, so every swap costs a long wait.

Q6Which is fastest?

  1. ARAM
  2. BCache
  3. CRegisters
  4. DSSD
Show answer

Correct answer: C — Registers

Registers sit inside the CPU itself, so access takes a single clock cycle. The order of the hierarchy is registers, cache, RAM, SSD, hard disk.

Q7A quad-core 2 GHz processor compared with a single-core 3 GHz one:

  1. Ais always slower
  2. Bcan execute four instruction streams at once
  3. Chas no cache
  4. Duses no RAM
Show answer

Correct answer: B — can execute four instruction streams at once

Four cores work simultaneously, so for anything that can be split across them the quad-core wins despite the lower clock speed. Clock speed alone is a poor comparison.

Q8The instruction register holds:

  1. Athe address of the next instruction
  2. Bthe instruction currently being decoded
  3. Cthe ALU result
  4. Dthe whole program
Show answer

Correct answer: B — the instruction currently being decoded

The address of the next instruction is in the program counter, and the ALU result goes to the accumulator. The instruction register holds only the one being worked on now.

Q9In the von Neumann architecture, programs and data are:

  1. Astored in separate memories
  2. Bstored in the same memory
  3. Cnever stored
  4. Dstored only in registers
Show answer

Correct answer: B — stored in the same memory

Sharing one memory is the defining feature, and it is what allows a machine to be reprogrammed by loading different data.

Q10The program counter holds:

  1. Athe current instruction
  2. Bthe address of the next instruction
  3. Cthe result of the last operation
  4. Dthe data just fetched
Show answer

Correct answer: B — the address of the next instruction

It holds an address, not an instruction — and the address of the next one, which is why it can be incremented early.

Q11During the fetch stage, the instruction is copied from the MDR into the:

  1. AACC
  2. BMAR
  3. CCIR
  4. DPC
Show answer

Correct answer: C — CIR

The current instruction register holds the instruction while the control unit decodes it.

Q12The address bus is unidirectional because:

  1. Ait is cheaper
  2. Bonly the processor generates addresses
  3. Cit carries no data
  4. Dmemory is read-only
Show answer

Correct answer: B — only the processor generates addresses

Memory never sends an address back to the processor, so there is no need for the bus to run both ways.

Q13The von Neumann bottleneck arises because:

  1. Athe clock is too slow
  2. Binstructions and data share one bus
  3. Cthere is too much cache
  4. Dthere are too many cores
Show answer

Correct answer: B — instructions and data share one bus

Sharing a single bus means instruction fetches and data transfers cannot happen simultaneously.

Q14A single-threaded program on a quad-core processor runs:

  1. Afour times faster
  2. Bat about the same speed
  3. Cfour times slower
  4. Dtwice as fast
Show answer

Correct answer: B — at about the same speed

Extra cores only help when the software divides its work between them. A single thread uses one core.

Q15A graphics processor applying the same operation to millions of pixels is an example of:

  1. ASISD
  2. BSIMD
  3. CMISD
  4. DMIMD
Show answer

Correct answer: B — SIMD

One instruction is applied to many data items simultaneously — Single Instruction, Multiple Data.

Q16A disadvantage of running software in a virtual machine is:

  1. Apoorer isolation
  2. Breduced performance from the extra layer
  3. Cit cannot be backed up
  4. Dit needs separate hardware
Show answer

Correct answer: B — reduced performance from the extra layer

Isolation and easy backup are advantages. The cost is that everything passes through an additional software layer.

Q17The always-resident core of an operating system is called the:

  1. Ashell
  2. Bkernel
  3. Cdriver
  4. DBIOS
Show answer

Correct answer: B — kernel

The kernel manages the CPU, memory and devices and stays in memory throughout. The shell is the user interface and can be replaced.

Q18Twenty programs appear to run at once on one core because the OS:

  1. Auses more cores
  2. Bswitches between them very quickly
  3. Ccompresses them
  4. Druns them on the GPU
Show answer

Correct answer: B — switches between them very quickly

Time-slicing gives each a few milliseconds in turn. Only one instruction actually executes at any moment.

Q19A slow machine with constant disk activity most likely indicates:

  1. Aa virus
  2. BRAM is full and the OS is paging
  3. Ca broken monitor
  4. Dtoo few cores
Show answer

Correct answer: B — RAM is full and the OS is paging

The disk is busy because memory pages are being written out and read back. If the CPU were the bottleneck the processor, not the disk, would be saturated.

Q20Which operating system type guarantees a maximum response time?

  1. AMulti-user
  2. BReal-time
  3. CSingle-tasking
  4. DDistributed
Show answer

Correct answer: B — Real-time

A real-time OS is used where a late response is as dangerous as a wrong one — patient monitors, vehicle control, industrial machinery.

Q21File permissions typically control:

  1. Afile size
  2. Bread, write and execute rights
  3. Cthe file format
  4. Ddisk speed
Show answer

Correct answer: B — read, write and execute rights

Each is granted separately to the owner, a group and everyone else, which is how a system lets some users read a file while preventing them from changing it.

Q22Emptying the recycle bin means the data is:

  1. Asecurely erased
  2. Bstill on the disk until overwritten
  3. Cmoved to the cloud
  4. Dcompressed
Show answer

Correct answer: B — still on the disk until overwritten

Only the index entry is removed. Recovery software can retrieve the contents, which is why a disk being sold must be securely wiped.

Q23Virtual memory addressing allows the OS to:

  1. Aincrease physical RAM
  2. Bgive each program a private address space mapped onto real RAM
  3. Cspeed up the CPU
  4. Dremove the need for a disk
Show answer

Correct answer: B — give each program a private address space mapped onto real RAM

Programs are written without knowing where they will sit in memory, and the mapping is what prevents one program from reading another's data.

Q24Adding RAM helps a heavily paging machine more than a faster SSD because it:

  1. Aremoves the need to page at all
  2. Bmakes the disk faster
  3. Creduces CPU load
  4. Dincreases clock speed
Show answer

Correct answer: A — removes the need to page at all

A faster disk shortens each swap; more RAM means the swap never has to happen. Removing the cause beats reducing the symptom.

Exam-style questions · 17

Q1[2 marks]
Differentiate between RAM and secondary storage.
Answer

RAM is volatile, fast and comparatively small; it holds the programs and data currently in use and loses everything when the power goes. Secondary storage such as an SSD is non-volatile, slower and much larger; it keeps data permanently.

Q2[2 marks]
Name the two main components of the CPU and state the function of each.
Answer

The control unit, which fetches and decodes instructions and sends control signals to the rest of the system; and the arithmetic and logic unit, which performs calculations and logical comparisons.

Q3[2 marks]
What is held in the program counter, and why must it change during every cycle?
Answer

It holds the address of the next instruction to be fetched. It increments during the fetch stage so that the following cycle picks up the next instruction rather than repeating the current one.

Q4[4 marks]
Describe the four stages of the fetch–execute cycle.
Mark scheme
  1. Fetch: the address in the program counter is placed on the address bus and the instruction is brought back along the data bus into the instruction registermention of a bus expected[1]
  2. Decode: the control unit interprets the instruction to determine the operation and its operands[1]
  3. Execute: the ALU carries out the operation[1]
  4. Store: the result is written back to a register or to memory, and the cycle repeatsthe repetition should be stated[1]

Fetch, decode, execute, store — repeated for every instruction.

Q5[4 marks]
Explain the purpose of the address bus, the data bus and the control bus, and state which of them is unidirectional.
Mark scheme
  1. The address bus carries the memory address being accessed[1]
  2. The data bus carries the actual data or instruction[1]
  3. The control bus carries signals such as read and write[1]
  4. The address bus is unidirectional — addresses only ever travel from the CPU to memory, whereas data travels both waysthe reason is required[1]

Address = where (one-way), data = what (two-way), control = read or write.

Q6[6 marks]
A student is choosing between two laptops. Laptop A has a 3.2 GHz single-core processor, 4 GB RAM and a 1 TB hard disk. Laptop B has a 2.4 GHz quad-core processor, 16 GB RAM and a 512 GB SSD.
  1. Explain which laptop is likely to feel faster in everyday use.
  2. Explain one advantage Laptop A still has.
  3. Explain why clock speed alone is a poor way to compare processors.
Mark scheme
  1. Laptop B[1]
  2. Four cores can execute four instruction streams at once, so it handles several programs far better than one faster core[1]
  3. 16 GB of RAM means far less swapping to disk, and the SSD has no moving parts so it reads much faster than a hard diskeither point accepted[1]
  4. Laptop A has 1 TB of storage against 512 GB, so it holds roughly twice as many filescapacity is the only advantage here[1]
  5. Clock speed measures cycles per second on ONE core, so it says nothing about how many cores there are[1]
  6. It also ignores cache size and the amount of RAM, both of which decide how often the CPU has to wait for data[1]

(a) Laptop B — more cores, far more RAM, and an SSD (b) twice the storage capacity (c) clock speed ignores cores, cache and RAM

Q7[2 marks]
State what is meant by the von Neumann architecture and identify one limitation of it.
Answer

In the von Neumann architecture, program instructions and data are held in the same memory and travel over the same bus. The limitation is the von Neumann bottleneck: instructions and data cannot be transferred simultaneously, so the processor is often left waiting for memory.

Q8[3 marks]
Describe the fetch stage of the fetch–decode–execute cycle, naming the registers used.
Answer

The address in the PC is copied to the MAR. The PC is then incremented. The contents of the memory location addressed by the MAR are read into the MDR, and from there the instruction is copied into the CIR ready for decoding.

Q9[2 marks]
Explain why the program counter is incremented during the fetch stage rather than after execution.
Answer

A jump instruction writes a new address into the PC during execution. If the increment happened afterwards, that new address would be increased by one and the jump would land at the wrong instruction. Incrementing during the fetch means a jump can simply overwrite the PC and execution continues correctly.

Q10[6 marks]
(a) State the direction of data flow on the address bus and on the data bus, giving a reason for the address bus.
(b) Explain how increasing cache size can improve performance.
(c) A program runs at the same speed on a four-core processor as on a single core. Explain why.
(d) State one advantage and one disadvantage of using virtual machines.
Mark scheme
  1. (a) The address bus is unidirectional; the data bus is bidirectional.Both directions must be stated.[1]
  2. The address bus is one-way because only the processor generates addresses — memory never sends one back.The reason is the mark, not the direction alone.[1]
  3. (b) Cache is faster than main memory and holds recently or frequently used data, so more requests are met without a slow main-memory access.The speed difference must be mentioned.[1]
  4. This reduces the time the processor spends idle waiting for data.Linking to the bottleneck earns the second mark.[1]
  5. (c) The program is single-threaded, so the work is not divided between cores and only one core is used.The software, not the hardware, is the limitation.[1]
  6. (d) Advantage: several isolated systems on one machine, using hardware efficiently. Disadvantage: slower than running directly on hardware, because of the extra software layer.One of each is required.[1]

(a) address one-way, data two-way; (b) fewer slow memory accesses; (c) single-threaded; (d) isolation vs overhead

Q11[2 marks]
Distinguish between SIMD and MIMD, giving a typical use of each.
Answer

SIMD applies a single instruction to multiple data items at the same time — used by graphics processors operating on many pixels identically. MIMD executes different instructions on different data simultaneously — used by multi-core processors running separate tasks.

Q12[2 marks]
What is the kernel of an operating system?
Answer

The core of the OS, permanently resident in memory, which manages the CPU, memory and devices and controls access to them. Other parts of the OS such as the user interface can be restarted or replaced; the kernel cannot.

Q13[2 marks]
Explain how a single-core processor appears to run several programs at once.
Answer

Through time-slicing: the operating system gives each program a few milliseconds of CPU time in turn and switches between them far faster than a person can perceive. Only one instruction is ever executing, so the simultaneity is an illusion.

Q14[2 marks]
Why should everyday work not be done from an administrator account?
Answer

Any program that runs inherits the permissions of the account that started it. Malware launched from an administrator account can therefore alter system files and install itself permanently, whereas the same malware run from a standard account is confined to that user's own files.

Q15[4 marks]
Describe four services provided by an operating system.
Mark scheme
  1. Process management — scheduling which program uses the CPU and for how long[1]
  2. Memory management — allocating RAM to each program and keeping them separate[1]
  3. File management — organising storage into files and folders and controlling access to them[1]
  4. Device management — communicating with hardware through drivers; also accept security and user accounts[1]

Process, memory, file and device management — plus security and the user interface.

Q16[4 marks]
A computer with 4 GB of RAM becomes extremely slow when many applications are open, and the disk activity light stays on. Explain the cause and suggest two solutions.
Mark scheme
  1. RAM has filled, so the OS is moving pages of memory out to disk — paging or swappingthe constant disk light is the clue[1]
  2. Disk access is thousands of times slower than RAM, so every switch between programs now waits on the diskthe speed gap is the explanation[1]
  3. Solution: close unused applications and reduce the number of programs starting automatically[1]
  4. Solution: install more RAM, which removes the need to page rather than merely making paging fasteran SSD helps but does not fix the cause[1]

RAM is full and the OS is paging to disk. Close programs, or add RAM.

Q17[6 marks]
A hospital uses computers for two very different jobs: office machines for administration, and a monitor attached to a patient that must raise an alarm within a guaranteed time.
  1. State the type of operating system suited to each, with a reason.
  2. Explain what "real-time" guarantees and why it matters here.
  3. Explain one way file permissions protect patient records on the office machines.
Mark scheme
  1. Office machines: a single-user multi-tasking operating system, since one person at a time runs several applications togetheraccept multi-user for shared machines[1]
  2. Patient monitor: a real-time operating system[1]
  3. Real-time guarantees that a response occurs within a fixed maximum time, not merely quickly on averagethe guarantee is the distinguishing feature[1]
  4. For a patient monitor an alarm raised late is as dangerous as no alarm, so a predictable worst case matters more than average speed[1]
  5. File permissions grant read, write and execute rights separately to the owner, a group and others[1]
  6. So clinical staff can be given read access to records while administrative staff cannot open them at all, and only authorised users may alter themthe example must fit the hospital[1]

(a) multi-tasking for the office, real-time for the monitor (b) a guaranteed maximum response time (c) separate read and write rights per group

04

Thinking Computationally

Multiple choice · 14

Q1Breaking a large problem into smaller parts is called:

  1. Aabstraction
  2. Bdecomposition
  3. Citeration
  4. Dvalidation
Show answer

Correct answer: B — decomposition

Decomposition splits the problem up. Abstraction is a different habit — removing irrelevant detail from whatever you are looking at.

Q2Which flowchart symbol has two exits?

  1. ARectangle
  2. BParallelogram
  3. CDiamond
  4. DRounded box
Show answer

Correct answer: C — Diamond

The decision diamond asks a yes/no question, so exactly two branches leave it and both must be labelled.

Q3An algorithm must be finite, meaning it:

  1. Auses few steps
  2. Balways stops
  3. Cfits on one page
  4. Dhas one input
Show answer

Correct answer: B — always stops

Finiteness is about termination. An algorithm may have thousands of steps and still be finite, provided it eventually stops.

Q4A metro map omitting real distances is an example of:

  1. Adecomposition
  2. Babstraction
  3. Can algorithm
  4. Dvalidation
Show answer

Correct answer: B — abstraction

Irrelevant detail — actual geography — has been removed so the useful information, the order of stations and the connections, stands out.

Q5For a rule "age must be 18 to 65", boundary test data would include:

  1. A30 and 40
  2. B18 and 65
  3. Cabc and −1
  4. D100 only
Show answer

Correct answer: B — 18 and 65

Boundary data sits exactly at the limits. Option A is normal data and option C is erroneous data — all three types should be tested, but only B is boundary.

Q6In a flowchart, an arrow without an arrowhead:

  1. Ais acceptable
  2. Bdoes not show the direction of flow and loses a mark
  3. Cmeans a loop
  4. Dindicates an error
Show answer

Correct answer: B — does not show the direction of flow and loses a mark

The whole purpose of the flow line is to say which way the logic runs. Without a head it says nothing, and examiners mark it as incomplete.

Q7Where should OUTPUT largest be placed when finding the biggest of ten numbers?

  1. Ainside the loop
  2. Bafter the loop
  3. Cbefore the loop
  4. Dit does not matter
Show answer

Correct answer: B — after the loop

Inside the loop it prints on every pass, giving ten lines. After the loop it runs once, with the final answer — which is what was asked for.

Q8A trace table is used to:

  1. Adraw a flowchart
  2. Bfollow an algorithm by hand and find logic errors
  3. Ccompile a program
  4. Dmeasure execution speed
Show answer

Correct answer: B — follow an algorithm by hand and find logic errors

Recording every variable at every step exposes errors on paper, long before the program is written and at a fraction of the cost.

Q9An algorithm takes 5n + 300 steps. What is its complexity?

  1. AO(5n + 300)
  2. BO(n)
  3. CO(300)
  4. DO(n²)
Show answer

Correct answer: B — O(n)

Big-O keeps only the fastest-growing term and drops constant factors. As n grows large, 5n dominates the fixed 300, and the 5 does not change the shape of the curve. What is left is O(n).

Q10Binary search on a sorted array of 1,000,000 items takes roughly how many comparisons?

  1. A1,000,000
  2. B1,000
  3. C20
  4. D2
Show answer

Correct answer: C — 20

Each comparison halves the search space, so the count is log₂(1,000,000) ≈ 20. That is the practical power of logarithmic growth: a thousand-fold more data costs only about ten extra steps.

Q11Which sort is fastest on data that is already almost sorted?

  1. ASelection sort
  2. BInsertion sort
  3. CBubble sort with no early exit
  4. DAll are identical
Show answer

Correct answer: B — Insertion sort

Insertion sort only shifts elements that are genuinely out of place. On nearly-sorted input almost nothing moves, so it approaches O(n). Selection sort scans the entire remaining array every pass regardless, so it stays O(n²) no matter how ordered the data is.

Q12Quicksort is O(n log n) on average. When does it degrade to O(n²)?

  1. AWhen the array contains duplicates
  2. BWhen the pivot repeatedly splits the array very unevenly
  3. CWhen n is a prime number
  4. DIt never degrades
Show answer

Correct answer: B — When the pivot repeatedly splits the array very unevenly

Quicksort relies on the pivot cutting the array roughly in half. If the pivot is always the smallest or largest element — as happens when you take the last element of an already-sorted array — each partition removes just one item, giving n levels of recursion instead of log n.

Q13Why does O(2ⁿ) become unusable so quickly?

  1. AIt uses too much memory
  2. BEvery extra input element doubles the total work
  3. CIt only works on sorted data
  4. DIt requires recursion
Show answer

Correct answer: B — Every extra input element doubles the total work

Doubling per element is brutal. Going from n = 50 to n = 51 does not add a step, it adds as much work as all 50 previous elements combined. Exponential algorithms are typically replaced with dynamic programming or approximation.

Q14Two algorithms are O(n). One runs in 2 seconds, the other in 10. What does Big-O say about this?

  1. ABig-O is wrong here
  2. BNothing — Big-O describes growth rate, not absolute speed
  3. CThey must have different complexities
  4. DThe 10-second one is really O(n²)
Show answer

Correct answer: B — Nothing — Big-O describes growth rate, not absolute speed

Big-O deliberately ignores constant factors. Both will scale the same way — double the input and both roughly double their time — even though one is five times slower throughout. For choosing between two same-class algorithms you need real measurement, not Big-O.

Exam-style questions · 12

Q1[2 marks]
Define an algorithm.
Answer

A finite sequence of unambiguous instructions that solves a problem or completes a task, with clearly defined inputs and outputs.

Q2[2 marks]
Explain what is meant by abstraction, with an example.
Answer

Abstraction is removing the details that are not relevant to the problem being solved, so that the essential structure is easier to work with. A metro map shows the order of the stations and the connections between lines, but omits real distances and street layout — which makes it more useful for planning a journey, not less.

Q3[2 marks]
State two differences between a flowchart and pseudocode.
Answer

A flowchart is graphical, using standard shapes and arrows, and shows the flow of control visually. Pseudocode is textual, resembles program code and is quicker to write and to translate into a real language. Flowcharts become unwieldy for long algorithms, where pseudocode stays readable.

Q4[4 marks]
Write an algorithm in pseudocode that reads a student's marks out of 100 and prints "Pass" if the mark is 40 or more and "Fail" otherwise. Include validation that rejects marks outside 0–100.
Mark scheme
  1. INPUT mark[1]
  2. Validation: WHILE mark < 0 OR mark > 100 → OUTPUT "Invalid" and INPUT mark againa loop, not a single if — the user may enter a bad value twice[1]
  3. IF mark >= 40 THEN OUTPUT "Pass"the >= is required; > alone fails a mark of exactly 40[1]
  4. ELSE OUTPUT "Fail" ENDIF[1]

Input with a validation loop, then IF mark >= 40 output Pass ELSE output Fail.

Q5[4 marks]
Complete a trace table for this algorithm with input 4: SET total = 0; SET i = 1; WHILE i <= n DO total = total + i; i = i + 1; ENDWHILE; OUTPUT total
Mark scheme
  1. Columns for n, i, total, and outputone column per variable[1]
  2. After pass 1: i = 2, total = 1; after pass 2: i = 3, total = 3[1]
  3. After pass 3: i = 4, total = 6; after pass 4: i = 5, total = 10[1]
  4. The loop ends because 5 > 4; output is 10the algorithm sums 1 to n[1]

Output 10 — the algorithm computes 1 + 2 + 3 + 4.

Q6[6 marks]
A school wants a program that records attendance for every class each day and produces a monthly report.
  1. Describe how decomposition would be applied to this problem.
  2. Give one example of abstraction in this system.
  3. Explain why the algorithm should be tested with boundary data, giving one example of such data.
Mark scheme
  1. Break the system into separate sub-problems, such as: record one student's attendance; store a day's records; calculate one student's monthly totalat least two named sub-problems[1]
  2. And: produce the report; handle login. Each is small enough to be designed and tested on its ownthe reason for decomposing is part of the answer[1]
  3. Abstraction: store only what the task needs — a student's roll number and present/absent flag — and ignore irrelevant details such as their address or hobbies[1]
  4. The unnecessary detail would make the system larger and slower without improving the report[1]
  5. Boundary data tests the values at the edges of what is acceptable, which is where most errors occur[1]
  6. Example: a month with 31 days, or a class with exactly one student, or an attendance percentage of exactly 75% if that is the pass thresholdany sensible boundary value[1]

(a) split into recording, storing, calculating and reporting (b) store only roll number and present/absent (c) edges are where errors hide — e.g. exactly 75% attendance

Q7[2 marks]
State one condition that must be met before a binary search can be used, and state why.
Answer

The data must already be sorted. The algorithm discards half the list at each step by comparing with the middle item, which is only valid if the order is known.

Q8[2 marks]
Explain what is meant by the time complexity of an algorithm.
Answer

A measure of how the number of operations grows as the size of the input grows, written in big-O notation. It describes the trend, not the exact running time on a particular machine.

Q9[3 marks]
A linear search of 1000 items takes at most 1000 comparisons. State the maximum number a binary search would need, and explain.
Answer

About 10, because 2¹⁰ = 1024. Each comparison halves the remaining list, so the maximum is log₂ n rounded up.

Q10[7 marks]
A bubble sort is used on the list 5, 3, 8, 1.
  1. Write out the list after each complete pass. [3]
  2. State the total number of passes needed and explain how the algorithm knows it has finished. [2]
  3. State the time complexity of a bubble sort and explain why it is unsuitable for large data sets. [2]
Mark scheme
  1. After pass 1: 3, 5, 1, 8[1]
  2. After pass 2: 3, 1, 5, 8[1]
  3. After pass 3: 1, 3, 5, 8[1]
  4. Three passes; a fourth confirms no swaps[1]
  5. A flag records whether any swap was made; if a whole pass makes none, the list is sorted[1]
  6. O(n²)[1]
  7. Doubling the data quadruples the work, so it becomes impractically slow[1]
Q11[8 marks]
A program must find whether a student name appears in a sorted list of 5000 names.
  1. Write pseudocode for a binary search on this list. [5]
  2. Explain what your code returns when the name is not present. [1]
  3. Compare the number of comparisons with a linear search on the same list. [2]
Mark scheme
  1. Initialises low = 1 and high = 5000[1]
  2. Loops while low <= high[1]
  3. Calculates mid = (low + high) DIV 2[1]
  4. Compares and returns mid if the name matches[1]
  5. Otherwise sets high = mid − 1 or low = mid + 1 correctly[1]
  6. Returns a value such as −1 or FALSE once low > high[1]
  7. Binary search: at most 13 comparisons, since 2¹³ = 8192[1]
  8. Linear search: up to 5000, so binary search is dramatically faster[1]
Q12[5 marks]
An algorithm is described as having complexity O(n log n).
  1. Name one sorting algorithm with this complexity. [1]
  2. Explain why it scales better than O(n²) as n grows. [2]
  3. A data set of 1000 items takes 2 seconds with the O(n log n) algorithm. Estimate the time for 2000 items and justify your estimate. [2]
Mark scheme
  1. Merge sort or quicksort (average case)[1]
  2. The log n factor grows very slowly compared with the extra factor of n[1]
  3. So the gap between the two widens rapidly as n increases[1]
  4. Doubling n slightly more than doubles n log n[1]
  5. So roughly 4.2 to 4.5 seconds, a little over doubleaccept "just over 4 seconds" with reasoning[1]
05

Organising Data

Multiple choice · 6

Q1Why can an array reach element 500 instantly while a linked list cannot?

  1. AArrays are stored in faster memory
  2. BArray elements are contiguous, so the address can be computed arithmetically
  3. CLinked lists are always longer
  4. DArrays keep a separate index table
Show answer

Correct answer: B — Array elements are contiguous, so the address can be computed arithmetically

Contiguity is the whole trick: address = base + 500 × elementSize, one multiply and one add. A linked list scatters its nodes, so the only way to find node 500 is to follow 500 pointers from the head.

Q2You need to add and remove items constantly at the front of a collection. Which structure fits best?

  1. AArray
  2. BLinked list
  3. CBinary search tree
  4. DHash table
Show answer

Correct answer: B — Linked list

Front insertion and deletion on a linked list is O(1) — you only re-point the head. An array would shift every remaining element on each operation, making it O(n) every single time.

Q3A stack is LIFO. Which real situation matches it?

  1. ACustomers waiting at a bank counter
  2. BUndo history in a text editor
  3. CPrint jobs on a shared printer
  4. DCars passing through a tunnel
Show answer

Correct answer: B — Undo history in a text editor

Undo reverses your most recent action first — last in, first out. The other three are FIFO: the first to arrive is the first served, which is a queue.

Q4An in-order traversal of a binary search tree outputs the values in what order?

  1. ARandom order
  2. BAscending sorted order
  3. CLevel by level
  4. DReverse insertion order
Show answer

Correct answer: B — Ascending sorted order

In-order visits left subtree, then node, then right subtree. Because a BST puts every smaller value left and every larger value right, that recursion emits values from smallest to largest. It is effectively a free sort.

Q5Inserting already-sorted data into a plain binary search tree causes what problem?

  1. AThe tree runs out of memory
  2. BThe tree degenerates into a linked list and search becomes O(n)
  3. CThe values get stored in the wrong order
  4. DNothing — the tree self-balances
Show answer

Correct answer: B — The tree degenerates into a linked list and search becomes O(n)

Each new value is larger than everything before it, so it always goes right. The result is a single chain with no branching, and lookup degrades from O(log n) to O(n). Self-balancing trees exist precisely to prevent this.

Q6Breadth-first search needs which helper structure?

  1. AA stack
  2. BA queue
  3. CA hash table
  4. DAn array of size n²
Show answer

Correct answer: B — A queue

BFS explores level by level, so nodes must come out in the same order they were discovered — FIFO, a queue. Swapping in a stack turns the same algorithm into depth-first search.

Exam-style questions · 6

Q1[2 marks]
State one advantage and one disadvantage of an array compared with a linked list.
Answer

Advantage: any element can be reached directly from its index in constant time. Disadvantage: inserting at the front requires every later element to be shifted.

Q2[2 marks]
Explain the difference between a stack and a queue.
Answer

A stack is last-in-first-out: items are added and removed at the same end. A queue is first-in-first-out: items are added at one end and removed from the other.

Q3[3 marks]
A stack is implemented with an array and a pointer. Describe what happens to the pointer during a push and during a pop.
Answer

On a push the pointer is incremented and the new item is written at that position. On a pop the item at the pointer is read and the pointer is decremented. The pointer must be checked against the array bounds first.

Q4[6 marks]
A program uses a queue to hold print jobs waiting for a printer.
  1. Explain why a queue is the appropriate structure for this task. [2]
  2. Describe how a circular queue avoids the problem of a linear queue in a fixed-size array. [3]
  3. State what must be checked before a job is added. [1]
Mark scheme
  1. Jobs must be printed in the order they were submitted[1]
  2. A queue removes items in the same order they were added, which is first-in-first-out[1]
  3. In a linear queue the front pointer moves forward and the space behind it is wasted[1]
  4. A circular queue wraps the rear pointer round to the start of the array[1]
  5. So the freed space is reused and the array does not appear full while space remains[1]
  6. That the queue is not full[1]
Q5[7 marks]
A binary search tree is built by inserting the values 50, 30, 70, 20, 40, 60 in that order.
  1. Draw the resulting tree. [3]
  2. Write down the in-order traversal. [2]
  3. State what the in-order traversal of any binary search tree always produces, and give one use of that property. [2]
Mark scheme
  1. 50 at the root with 30 on its left and 70 on its right[1]
  2. 20 and 40 as the children of 30[1]
  3. 60 as the left child of 70[1]
  4. Visits left subtree, then node, then right subtree[1]
  5. 20, 30, 40, 50, 60, 70[1]
  6. The values in ascending order[1]
  7. It can therefore be used to sort the data, or to output it in order without re-sorting[1]

(b) 20, 30, 40, 50, 60, 70

Q6[5 marks]
A linked list stores the names Ali, Bilal, Danish in alphabetical order. Each node holds a name and a pointer.
  1. Describe the steps needed to insert Chand in the correct position. [3]
  2. Explain why no data has to be moved, unlike in an array. [2]
Mark scheme
  1. Traverse from the head until the node after which Chand belongs is found, here Bilal[1]
  2. Create the new node and set its pointer to whatever Bilal was pointing at, that is Danish[1]
  3. Set Bilal's pointer to the new nodethis order matters or the rest of the list is lost[1]
  4. The nodes are not stored in consecutive memory locations[1]
  5. Order is held by the pointers, so changing two pointers is enough[1]
06

Ideas Behind Programming

Multiple choice · 16

Q1SQL is an example of which paradigm?

  1. Aimperative
  2. Bdeclarative
  3. Clow-level
  4. Dobject-oriented
Show answer

Correct answer: B — declarative

A query states the result required without describing how to obtain it — the defining feature of declarative programming.

Q2Encapsulation means:

  1. Amaking all data public
  2. Bbundling data with its methods and restricting access
  3. Ccopying a class
  4. Drunning code in parallel
Show answer

Correct answer: B — bundling data with its methods and restricting access

The data is kept private so every change goes through a method that can validate it.

Q3The same method call producing different behaviour on different object types is:

  1. Ainheritance
  2. Bencapsulation
  3. Cpolymorphism
  4. Dabstraction
Show answer

Correct answer: C — polymorphism

Polymorphism resolves the call according to the actual type of the object receiving it.

Q4A subclass gaining the members of a superclass is:

  1. Apolymorphism
  2. Binheritance
  3. Cencapsulation
  4. Doverloading
Show answer

Correct answer: B — inheritance

Inheritance lets shared behaviour be written once in the superclass and reused by every subclass.

Q5Code that must run whether or not an exception occurred belongs in:

  1. ATRY
  2. BCATCH
  3. CFINALLY
  4. Dnowhere
Show answer

Correct answer: C — FINALLY

FINALLY executes on both paths, which is why resource cleanup such as closing a file belongs there.

Q6Catching all exceptions in one generic handler is poor practice because it:

  1. Aruns too slowly
  2. Bcan hide genuine bugs and loses specificity
  3. Cis not allowed
  4. Dprevents the program running
Show answer

Correct answer: B — can hide genuine bugs and loses specificity

Different errors deserve different responses, and an unexpected error gets silently swallowed rather than noticed.

Q7Which paradigm would suit writing a device driver?

  1. Adeclarative
  2. Blow-level
  3. Cobject-oriented
  4. Dfunctional
Show answer

Correct answer: B — low-level

Direct access to hardware registers and precise timing control are required, which higher-level paradigms deliberately abstract away.

Q8An advantage of exception handling over checking every operation with an if is that:

  1. Ait runs faster
  2. Bthe normal logic stays readable
  3. Cerrors never occur
  4. Dno testing is needed
Show answer

Correct answer: B — the normal logic stays readable

The error path is separated from the main flow, so the normal logic is not interrupted by a check after every statement.

Q9A recursive routine must always contain:

  1. Aa loop
  2. Ba base case
  3. Can array
  4. Da global variable
Show answer

Correct answer: B — a base case

The base case is what allows the recursion to stop. Without it the calls never end.

Q10A recursive function with no base case will:

  1. Areturn zero
  2. Bcause a stack overflow
  3. Crun faster
  4. Dskip the recursion
Show answer

Correct answer: B — cause a stack overflow

Every call pushes a frame and none ever returns, so the stack memory is exhausted.

Q11A stack frame stores:

  1. Aonly the return value
  2. Bthe return address, parameters and local variables
  3. Cthe whole program
  4. Dnothing
Show answer

Correct answer: B — the return address, parameters and local variables

It holds everything needed to resume the suspended call once the deeper one returns.

Q12For F(n) = n × F(n−1) with F(1) = 1, calling F(4) pushes how many frames?

  1. A1
  2. B3
  3. C4
  4. D24
Show answer

Correct answer: C — 4

Frames are pushed for F(4), F(3), F(2) and F(1) — four in total. 24 is the result, not the depth.

Q13During recursion, calculations happen:

  1. Aon the way down
  2. Bon the way back up after the base case
  3. Call at once at the start
  4. Dnot at all
Show answer

Correct answer: B — on the way back up after the base case

Each call is suspended at the recursive call. The work is completed as the frames are popped.

Q14Recursive calls complete in which order?

  1. Afirst in, first out
  2. Blast in, first out
  3. Crandom order
  4. Dall simultaneously
Show answer

Correct answer: B — last in, first out

The stack is LIFO, so the most recently pushed frame is the first to be popped and completed.

Q15The main disadvantage of recursion compared with iteration is:

  1. Ait cannot solve the same problems
  2. Bit uses more memory for stack frames
  3. Cit is harder to write
  4. Dit always gives wrong answers
Show answer

Correct answer: B — it uses more memory for stack frames

Anything recursive can be written iteratively; the cost is one stack frame per level of depth.

Q16Recursion is most naturally suited to:

  1. Asumming a list of numbers
  2. Btraversing a tree
  3. Ccounting to ten
  4. Dreading one input
Show answer

Correct answer: B — traversing a tree

A tree is itself defined recursively, so a recursive traversal matches the structure. Simple repetition is better served by a loop.

Exam-style questions · 10

Q1[2 marks]
State the difference between the imperative and declarative paradigms.
Answer

An imperative program specifies how to obtain the result, as an ordered sequence of statements that change the program state. A declarative program specifies what result is required and leaves the method of obtaining it to the system — SQL being the standard example.

Q2[3 marks]
Explain what is meant by encapsulation and give one benefit of it.
Answer

Encapsulation means bundling data together with the methods that operate on it inside a class, and making the data private so it can only be accessed through those methods. The benefit is that the data cannot be set to an invalid value by unrelated code, since every change passes through a method that can validate it — so the object stays in a consistent state.

Q3[2 marks]
Explain what polymorphism means, using an example.
Answer

Polymorphism means the same method call behaves differently depending on the object it is applied to. For example, calling Area() on a Circle runs the circle's formula while the same call on a Rectangle runs a different one — the calling code does not need to know which type it holds.

Q4[6 marks]
(a) State what a try–catch–finally structure is for.
(b) Explain why the finally block is useful when working with files.
(c) Explain why catching all exceptions with a single generic handler is poor practice.
(d) Give one advantage of exception handling over checking every operation with an if statement.
Mark scheme
  1. (a) It separates the normal flow from error handling: risky code goes in TRY, and control passes to a CATCH block if an exception occurs.The separation of normal and error paths is the point.[1]
  2. (b) FINALLY runs whether or not an exception occurred, so the file is closed either way.The "either way" behaviour is what makes it useful.[1]
  3. Without it a file could be left open after an error, locking it or losing unwritten data.A concrete consequence earns the second mark.[1]
  4. (c) Different errors need different responses, and a generic handler treats them identically.Loss of specificity is the core issue.[1]
  5. It can also hide genuine bugs, since an unexpected error is caught and silently ignored rather than being noticed.The masking of programming errors is the stronger half of the answer.[1]
  6. (d) The normal logic stays readable, uncluttered by a check after every operation, and an error can be handled at whatever level makes sense rather than at the point it occurred.Either readability or the level of handling is acceptable.[1]

(a) separates normal and error paths; (b) files close either way; (c) loses specificity and hides bugs; (d) readability

Q5[2 marks]
Give one situation where a low-level paradigm would be chosen over a high-level one, and explain why.
Answer

Writing a device driver or code for an embedded microcontroller. Direct access to specific registers, memory addresses and hardware timing is required, and the precise number of clock cycles may matter — control a high-level language deliberately abstracts away.

Q6[2 marks]
State the two conditions a recursive routine must satisfy in order to terminate.
Answer

It must have a base case that returns a value without calling itself, and each recursive call must make progress towards that base case — typically by reducing the parameter.

Q7[3 marks]
Explain the role of the stack when a recursive routine executes.
Answer

Each call pushes a stack frame containing the return address, the parameters and any local variables, so the suspended call can be resumed. Frames accumulate as the recursion descends. When the base case returns, the frames are popped in reverse order — last in, first out — with each completing its calculation as it goes.

Q8[2 marks]
A recursive function is written with no base case. Describe what happens when it runs.
Answer

It calls itself indefinitely, pushing a new stack frame each time and never returning. The stack eventually runs out of memory and the program terminates with a stack overflow error.

Q9[6 marks]
A function is defined as: S(1) = 1, and S(n) = n + S(n−1) for n > 1.
(a) State the base case and the recursive case.
(b) Trace S(5), showing the calls and the returns.
(c) Give one advantage and one disadvantage of using recursion here rather than a loop.
Mark scheme
  1. (a) Base case: S(1) = 1. Recursive case: S(n) = n + S(n−1).Both must be identified separately.[1]
  2. (b) S(5) calls S(4), which calls S(3), S(2) and finally S(1). Five frames are pushed.The descent, with nothing computed yet.[1]
  3. S(1) returns 1 — the base case.This starts the unwinding.[1]
  4. S(2) = 2 + 1 = 3; S(3) = 3 + 3 = 6; S(4) = 4 + 6 = 10; S(5) = 5 + 10 = 15.Returns in reverse order of the calls.[1]
  5. (c) Advantage: the code closely matches the mathematical definition, so it is shorter and clearer.Readability is the usual advantage.[1]
  6. Disadvantage: each call uses a stack frame, so it needs more memory and risks stack overflow for large n.Memory cost is the standard disadvantage.[1]

(a) S(1)=1 and S(n)=n+S(n−1); (b) S(5) = 15; (c) clarity vs stack memory

Q10[2 marks]
Give one situation where recursion is clearly preferable to iteration, and one where iteration is preferable.
Answer

Recursion is preferable for recursive data structures such as traversing a tree, or for divide-and-conquer algorithms like quicksort, where an iterative version would need an explicit stack of its own. Iteration is preferable for simple repetition such as summing a list, where recursion would waste memory on stack frames for no gain in clarity.

07

Networks and the Internet

Multiple choice · 14

Q1Data is split into packets before transmission mainly because:

  1. APackets travel faster than whole files
  2. BLost data can be resent in small pieces and links can be shared
  3. CComputers cannot store whole files
  4. DIt encrypts the data
Show answer

Correct answer: B — Lost data can be resent in small pieces and links can be shared

Packet switching means a single lost packet costs one retransmission rather than a whole file, and many conversations can interleave on one link. Packets do not travel faster than anything — the medium sets the speed — and splitting provides no encryption at all.

Q2Which protocol would a live video call most likely use?

  1. ATCP, because reliability matters most
  2. BUDP, because late data is useless anyway
  3. CHTTP, because it is a web application
  4. DSMTP, because it streams
Show answer

Correct answer: B — UDP, because late data is useless anyway

A retransmitted video frame arrives after the moment it belonged to, so TCP's guarantees buy nothing and its waiting causes stalls. UDP tolerates a brief glitch to keep the call live. SMTP is for email.

Q3A MAC address differs from an IP address in that it is:

  1. AAssigned by your router each time you connect
  2. BFixed to the hardware and used only on the local network
  3. CAlways a public internet address
  4. DUsed to encrypt traffic
Show answer

Correct answer: B — Fixed to the hardware and used only on the local network

The MAC address is burned into the network interface and only has meaning within one local network segment. The IP address is assigned by the network you join and is what routing across the internet uses.

Q4The purpose of DNS is to:

  1. AEncrypt web traffic
  2. BTranslate domain names into IP addresses
  3. CSplit data into packets
  4. DChoose the fastest route
Show answer

Correct answer: B — Translate domain names into IP addresses

DNS is the internet's phone book, turning a human-readable name into the numeric address routing actually needs. Encryption is TLS, packetising is the transport layer, and route selection is the job of routers running IP.

Q5In the layered model, the main benefit of layers is that:

  1. AData travels faster
  2. BEach layer can be changed without disturbing the others
  3. CFewer packets are needed
  4. DIt removes the need for addresses
Show answer

Correct answer: B — Each layer can be changed without disturbing the others

Layering isolates concerns. Swapping ethernet for wifi replaces the data-link and physical layers entirely, and TCP, IP and your browser never notice. Layers add a little overhead rather than removing any.

Q6TCP establishes a connection using:

  1. AA single SYN message
  2. BA three-way handshake: SYN, SYN-ACK, ACK
  3. CA DNS lookup
  4. DAn encrypted certificate exchange
Show answer

Correct answer: B — A three-way handshake: SYN, SYN-ACK, ACK

Three messages confirm that both sides can send and receive before real data flows. The certificate exchange is the separate TLS handshake, which happens after the TCP connection is already up.

Q7The world wide web is:

  1. Athe same as the internet
  2. Ba collection of pages accessed over the internet
  3. Ca type of cable
  4. Da browser
Show answer

Correct answer: B — a collection of pages accessed over the internet

The internet is the infrastructure; the web is one kind of content carried on it, alongside email and file transfer.

Q8DNS converts:

  1. AHTML into a page
  2. Ba domain name into an IP address
  3. Ctext into binary
  4. DHTTP into HTTPS
Show answer

Correct answer: B — a domain name into an IP address

The network routes by numeric address, so the memorable name must be looked up first.

Q9A session cookie is deleted:

  1. Aafter a year
  2. Bwhen the browser is closed
  3. Cnever
  4. Dwhen the page reloads
Show answer

Correct answer: B — when the browser is closed

It is held in memory for the duration of the visit. A persistent cookie is written to disk and survives until it expires.

Q10A cookie can:

  1. Arun a program
  2. Binfect a computer with a virus
  3. Cstore text data for a website
  4. Daccess any file on the disk
Show answer

Correct answer: C — store text data for a website

It is a small text file readable only by the site that set it. It cannot execute, so it cannot be malware.

Q11HTTPS differs from HTTP in that it:

  1. Ais faster
  2. Bencrypts the traffic
  3. Cuses a different port only
  4. Dworks without DNS
Show answer

Correct answer: B — encrypts the traffic

It is the same protocol with encryption added, secured by a digital certificate that also confirms the site's identity.

Q12The padlock in a browser means:

  1. Athe site is trustworthy
  2. Bthe connection is encrypted and the certificate is valid
  3. Cno cookies are used
  4. Dthe site is government approved
Show answer

Correct answer: B — the connection is encrypted and the certificate is valid

It says the connection is secure and the site is who its certificate says. A fraudulent site can obtain a valid certificate.

Q13Which happens FIRST when a URL is entered?

  1. Athe HTML is parsed
  2. Ba DNS lookup
  3. CCSS is applied
  4. Dcookies are sent
Show answer

Correct answer: B — a DNS lookup

The browser cannot send a request until it knows the IP address to send it to.

Q14An ISP is:

  1. Aa browser
  2. Bthe company providing the internet connection
  3. Ca type of server
  4. Da protocol
Show answer

Correct answer: B — the company providing the internet connection

The internet service provider supplies the physical connection and usually the router and IP address that come with it.

Exam-style questions · 12

Q1[2 marks]
State the difference between a LAN and a WAN.
Answer

A LAN covers a small geographical area such as one building and its hardware is usually owned by the organisation. A WAN covers a large area and typically uses third-party communication links.

Q2[2 marks]
Explain the purpose of an IP address and a MAC address.
Answer

An IP address identifies a device on a network and can change when the device moves to a different network. A MAC address is fixed in the hardware and uniquely identifies the network adapter itself.

Q3[3 marks]
Describe what happens when data is split into packets for transmission.
Answer

The data is divided into equal-sized blocks. Each packet carries a header with the source and destination addresses and its sequence number, and packets may travel by different routes and are reassembled in order at the destination.

Q4[8 marks]
A school is setting up a network for 30 computers in one building.
  1. State whether a LAN or a WAN is appropriate and justify your choice. [2]
  2. Describe the function of a router and of a switch in this network. [4]
  3. State two advantages of networking the computers rather than leaving them standalone. [2]
Mark scheme
  1. A LAN[1]
  2. The computers are all within a single building and the school owns the cabling[1]
  3. A switch connects devices within the LAN[1]
  4. It forwards each frame only to the port of the intended recipient, using MAC addresses[1]
  5. A router connects the LAN to another network, usually the internet[1]
  6. It forwards packets between networks using IP addresses[1]
  7. Advantage: files and printers can be shared[1]
  8. Advantage: software and backups can be managed centrally[1]
Q5[7 marks]
A student enters a web address into a browser and the page loads.
  1. Describe the role of the DNS in this process. [3]
  2. Explain the difference between HTTP and HTTPS. [2]
  3. State two reasons a school might use a firewall on this connection. [2]
Mark scheme
  1. The browser sends the domain name to a DNS server[1]
  2. The server looks up the matching IP address[1]
  3. The IP address is returned and the browser requests the page from that server[1]
  4. HTTPS encrypts the data in transit, HTTP sends it in plain text[1]
  5. So HTTPS protects information such as passwords from being read if intercepted[1]
  6. To block access to unsuitable or unauthorised sites[1]
  7. To inspect incoming traffic and block unauthorised access to the network[1]
Q6[5 marks]
A company is choosing between a wired and a wireless network for its office.
  1. Give one advantage of a wired connection. [1]
  2. Give one advantage of a wireless connection. [1]
  3. The company handles confidential data. Describe one security measure it should apply to a wireless network and explain how it helps. [3]
Mark scheme
  1. Faster and more reliable, with less interference[1]
  2. Devices can be moved freely and no cabling is needed[1]
  3. Use WPA encryption on the wireless network[1]
  4. Data sent over the air is scrambled[1]
  5. So anyone intercepting the signal cannot read it without the keyaccept MAC filtering or a strong passphrase, explained[1]
Q7[2 marks]
Explain the difference between the internet and the world wide web.
Answer

The internet is the global infrastructure of interconnected networks that carries data. The world wide web is a collection of pages and resources accessed over that infrastructure — one of several services using it, alongside email and file transfer.

Q8[2 marks]
What is the purpose of DNS?
Answer

It translates a domain name that people can remember into the IP address the network needs to route data. This also allows a site to move to a different server without its address changing for visitors.

Q9[2 marks]
State two uses of cookies.
Answer

Keeping a user logged in as they move between pages of a site, and remembering preferences such as language, currency or the contents of a shopping basket.

Q10[4 marks]
Describe the sequence of events from entering a URL to a web page being displayed.
Mark scheme
  1. The browser extracts the domain name and requests its IP address from a DNS server[1]
  2. The DNS server returns the IP address, querying other DNS servers if necessary[1]
  3. The browser sends an HTTP request to that address and the server responds with the HTML[1]
  4. The browser requests the further resources the page references, then parses the HTML, applies the CSS and renders the page[1]

DNS lookup → HTTP request → server response → further resource requests → parse and render.

Q11[4 marks]
Explain how HTTPS protects a user entering payment details, and state one thing the padlock does not guarantee.
Mark scheme
  1. The data is encrypted in the browser before it is transmitted[1]
  2. so anyone intercepting it on the network sees only ciphertext and cannot read the card details[1]
  3. A digital certificate issued by a trusted authority supplies the public key and confirms the site's identity[1]
  4. The padlock does not guarantee the site is honest — only that the connection is encrypted and the site is genuinely the one named on the certificatea fraudulent site can hold a valid certificate[1]

Encryption in transit plus a certificate proving identity; the padlock says nothing about the site's honesty.

Q12[6 marks]
An online shop uses cookies and HTTPS.
  1. Explain the difference between a session cookie and a persistent cookie, with a use for each.
  2. Explain why cookies raise privacy concerns.
  3. Explain why a cookie cannot infect the visitor's computer.
Mark scheme
  1. A session cookie is held in memory and deleted when the browser closes — used to keep the customer logged in while moving between pages[1]
  2. A persistent cookie is stored on disk and survives until it expires — used to remember preferences or a basket between visits[1]
  3. A cookie set by an advertiser present on many different sites can be read on each of them[1]
  4. so a record of the user's browsing can be assembled across sites without their being aware of itthe cross-site point is the concern[1]
  5. A cookie is a small text file, not a program, so it cannot be executed[1]
  6. It can only be read by the site that set it, and cannot access other files on the machine — the genuine risk is to privacy, not to the computer[1]

(a) session in memory until the browser closes; persistent on disk until expiry (b) cross-site tracking builds a browsing profile (c) it is data, not a program

08

Artificial Intelligence

Multiple choice · 16

Q1In machine learning, the computer produces:

  1. Athe data
  2. Bthe rules
  3. Cthe hardware
  4. Dthe labels
Show answer

Correct answer: B — the rules

You supply data and answers; the system derives the rules that connect them. That inversion is the whole idea.

Q2Training on photographs labelled "cat" or "dog" is:

  1. Aunsupervised learning
  2. Bsupervised learning
  3. Creinforcement learning
  4. Dnot machine learning
Show answer

Correct answer: B — supervised learning

The labels are the correct answers supplied with the data, which is precisely what makes learning supervised.

Q3Grouping customers into segments nobody defined in advance is:

  1. Asupervised
  2. Bunsupervised
  3. Creinforcement
  4. Doverfitting
Show answer

Correct answer: B — unsupervised

There are no labels; the structure is discovered by the system rather than specified by a person.

Q4A model scoring 99% on training data and 55% on new data is:

  1. Aunderfitting
  2. Boverfitting
  3. Cwell trained
  4. Dunsupervised
Show answer

Correct answer: B — overfitting

The gap shows it memorised its examples rather than learning the general pattern. A model that generalised would score similarly on both.

Q5Algorithmic bias mainly arises from:

  1. Abugs in the code
  2. Bpatterns present in the training data
  3. Cslow hardware
  4. Dtoo much test data
Show answer

Correct answer: B — patterns present in the training data

The model faithfully reproduces what it was shown. If the historical data recorded unfair decisions, the model learns to make them.

Q6The test set must be:

  1. Apart of the training data
  2. Bdata the model has never seen
  3. Clabelled by the model
  4. Das small as possible
Show answer

Correct answer: B — data the model has never seen

Only unseen data measures generalisation. Testing on training data measures memory, which is not what the model is for.

Q7The "black box" problem means a model:

  1. Aruns too slowly
  2. Bcannot explain how it reached a decision
  3. Cneeds no data
  4. Dhas no output
Show answer

Correct answer: B — cannot explain how it reached a decision

This is tolerable for a film recommendation and unacceptable for a loan refusal, where the person affected is entitled to a reason.

Q8Reinforcement learning improves by:

  1. Abeing given the correct answers
  2. Breceiving rewards and penalties for its actions
  3. Cgrouping unlabelled data
  4. Dcopying another model
Show answer

Correct answer: B — receiving rewards and penalties for its actions

It is told only how well it did, not what it should have done, and improves over very many attempts.

Q9AI is best suited to tasks involving:

  1. Amoral judgement
  2. Bfinding patterns in large amounts of data
  3. Cunfamiliar novel situations
  4. Dexplaining its reasoning
Show answer

Correct answer: B — finding patterns in large amounts of data

That single capability underlies every successful application. The other three are precisely where these systems are weakest.

Q10Using AI to flag scans for a radiologist to review is an example of:

  1. Areplacement
  2. Btriage
  3. Creinforcement learning
  4. Doverfitting
Show answer

Correct answer: B — triage

The system sorts by likely urgency and the human still decides, so its errors are caught while the speed benefit is kept.

Q11A legitimate transaction blocked by a fraud system is a:

  1. Afalse negative
  2. Bfalse positive
  3. Cbias
  4. Dblack box
Show answer

Correct answer: B — false positive

The system positively identified fraud where there was none. A false negative would be real fraud allowed through.

Q12A model trained on data from one country may fail elsewhere because:

  1. Athe code is different
  2. Bthe population it learned from differs from the one it is used on
  3. Cthe hardware differs
  4. Dthe language differs
Show answer

Correct answer: B — the population it learned from differs from the one it is used on

A model reproduces patterns from its training data. If the new population differs in ways that matter, those patterns may not hold.

Q13The strongest argument against fully automating a benefits decision is:

  1. Ait would be slower
  2. Bthe applicant could not be told why they were refused
  3. Ccomputers are expensive
  4. Dit needs internet
Show answer

Correct answer: B — the applicant could not be told why they were refused

A consequential decision affecting a person requires a reason they can understand and challenge. Speed and consistency do not compensate for its absence.

Q14Deskilling means:

  1. Aworkers are retrained
  2. Ba skill is lost because it is always automated
  3. Cthe AI becomes less accurate
  4. Djobs are created
Show answer

Correct answer: B — a skill is lost because it is always automated

A capability nobody exercises eventually disappears, which matters most at the moment the automated system fails and someone must step in.

Q15Which is a genuine environmental cost of AI?

  1. Ae-waste from sensors
  2. Bthe electricity used to train large models
  3. Cpaper use
  4. Dwater in data entry
Show answer

Correct answer: B — the electricity used to train large models

Training a large model consumes a substantial amount of electricity, which is an increasingly common point in exam answers about drawbacks.

Q16When AI applies the same rule to every applicant, the benefit is:

  1. Acreativity
  2. Bconsistency
  3. Cempathy
  4. Dexplainability
Show answer

Correct answer: B — consistency

Human assessors vary between themselves and across a working day. Consistency is a real advantage — though it also means a flawed rule is applied uniformly to everyone.

Exam-style questions · 12

Q1[2 marks]
Differentiate between artificial intelligence and machine learning.
Answer

Artificial intelligence is the broad field of making machines perform tasks that would ordinarily require human intelligence. Machine learning is a subset of AI in which the system learns patterns from data rather than being given explicit rules. All machine learning is AI; not all AI is machine learning.

Q2[2 marks]
What is supervised learning? Give an example.
Answer

Learning from data in which each example is labelled with the correct answer. The model learns to reproduce those labels on new data. Example: training on photographs already tagged "cat" or "dog" so the system can classify unseen photographs.

Q3[2 marks]
Why must a model be tested on data it has not been trained on?
Answer

Because a model can score perfectly on data it has effectively memorised, which says nothing about how it will behave on new examples. Only unseen data measures whether it has learned the general pattern — the property that actually matters in use.

Q4[4 marks]
Describe the difference between supervised, unsupervised and reinforcement learning, giving one use of each.
Mark scheme
  1. Supervised: trained on labelled data — for example spam detection from emails already marked spam or not[1]
  2. Unsupervised: trained on unlabelled data and finds structure itself — for example grouping customers into segments[1]
  3. Reinforcement: learns by acting and receiving rewards or penalties — for example a program learning to play a game[1]
  4. The distinguishing factor is what the training data contains: answers, no answers, or a reward signalthe unifying statement earns the fourth mark[1]

Labelled data, unlabelled data, and reward feedback respectively.

Q5[4 marks]
A bank uses a machine learning model trained on its past lending decisions to approve loans. Explain how bias could arise and state two ways to reduce it.
Mark scheme
  1. The model learns the patterns in the historical decisions, including any that were unfair[1]
  2. If certain groups were refused disproportionately in the past, the model reproduces that pattern while appearing objectivethe appearance of objectivity is part of the harm[1]
  3. Reduce it by examining the training data for representativeness, and testing outcomes separately for each group[1]
  4. And by keeping a human decision-maker for consequential decisions, with a documented route to appealaccept requiring the model to be explainable[1]

The model learns historical unfairness. Audit the data, test outcomes per group, and keep human oversight.

Q6[6 marks]
A school wants to use machine learning to predict which students are at risk of failing, so extra help can be offered.
  1. Describe the data the system would need and how it would be trained.
  2. Explain one way the system could produce unfair results.
  3. Explain why a teacher should review every prediction before action is taken.
Mark scheme
  1. Historical records of past students — attendance, assessment marks, homework completion — each labelled with whether that student ultimately passed or failedlabelled data, so this is supervised learning[1]
  2. The data is split into a training set and a test set; the model learns from the first and is measured on the second[1]
  3. Unfairness: if the historical data reflects a group that was under-supported in the past, the model predicts failure for that group and the prediction becomes self-fulfilling[1]
  4. Or: a feature that correlates with background rather than ability — such as distance travelled to school — drives the predictioneither example accepted[1]
  5. A prediction is a statistical likelihood about a group, not a fact about the individual student in front of the teacher[1]
  6. The model cannot explain its reasoning, and being labelled "likely to fail" could itself affect how a student is treated and how they see themselves[1]

(a) labelled historical records, split into training and test sets (b) it reproduces past under-support as a prediction (c) a prediction is about likelihood, not about the individual, and cannot justify itself

Q7[2 marks]
Give one application of AI in healthcare and state its main benefit.
Answer

AI can analyse medical images such as chest X-rays and flag those most likely to show disease, so a radiologist reviews the urgent cases first. The benefit is speed and consistency: it works continuously without fatigue, letting a small number of specialists cover a large population.

Q8[2 marks]
State two disadvantages of using AI in decision-making.
Answer

It usually cannot explain how it reached a decision, so a person affected cannot be told why. And it reproduces the biases in its training data while appearing objective, which can make unfair outcomes harder to challenge.

Q9[2 marks]
Explain one way AI can help farmers.
Answer

A farmer can photograph an affected leaf with a phone and a model identifies the crop disease and suggests treatment. This reaches farms that an agricultural extension officer could not visit often enough, and gives an answer within seconds rather than days.

Q10[4 marks]
Describe two benefits and two risks of self-driving vehicles.
Mark scheme
  1. Benefit: they do not tire, become distracted or drive under the influence, and human error causes most collisions[1]
  2. Benefit: they can give independent mobility to people unable to drive, and can coordinate to reduce congestion[1]
  3. Risk: an unfamiliar situation not represented in training may be handled badly, and roads present many such situations[1]
  4. Risk: responsibility for a collision is unclear — the owner, the manufacturer or the software developer — and the vehicle is a target for interferenceaccept job losses among professional drivers[1]

Benefits: no fatigue or distraction, and mobility for non-drivers. Risks: unfamiliar situations, and unclear liability.

Q11[4 marks]
A bank introduces an AI system to detect fraudulent transactions. Explain why this suits AI, and state one problem it may cause customers.
Mark scheme
  1. There are millions of transactions, far more than any human team could examine[1]
  2. Fraud shows as an unusual pattern, and finding patterns in large volumes of data at speed is exactly what these systems do well[1]
  3. Problem: false positives — a legitimate but unusual transaction is blocked, such as a card used abroad on holiday[1]
  4. The customer is inconvenienced and may not be told why, since the system cannot explain the pattern it reacted tothe inability to explain is the sharper point[1]

The volume and the pattern-matching suit AI; the cost is blocked legitimate transactions with no explanation.

Q12[6 marks]
A government department proposes using AI to decide which applicants receive financial assistance, replacing the current human assessors.
  1. Give two arguments in favour of the proposal.
  2. Give two arguments against.
  3. Recommend how the system should be used, with justification.
Mark scheme
  1. In favour: decisions would be made far faster and applicants would wait less[1]
  2. In favour: the same rules would be applied to every applicant, removing the inconsistency between individual assessors[1]
  3. Against: trained on past decisions, it would reproduce any historical unfairness while appearing objective[1]
  4. Against: an applicant refused assistance could not be told why, and would have no meaningful basis for appealthe accountability point[1]
  5. Recommendation: use the system to sort and prioritise applications, with a human assessor making every final decision[1]
  6. Justified because the speed and consistency are gained while accountability and the right to an explanation are preserved, and unusual cases still reach a personthe justification must address both sides[1]

(a) speed and consistency (b) inherited bias and no explanation (c) AI prioritises, humans decide — keeping the benefit and the accountability

These questions come from the CS Fundamentals lessons — each topic has its own notes, worked examples and an interactive diagram.