O Level Computer Science (2210) — MCQs & Practice Questions

194 multiple-choice questions and 150 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 O Level Computer Science (2210) notes first, then come back to practise.

01

Data representation

Multiple choice · 24

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.

Q17Lossless compression means the original file can be:

  1. Aapproximated closely
  2. Breconstructed exactly
  3. Cnever recovered
  4. Dplayed faster
Show answer

Correct answer: B — reconstructed exactly

Nothing is discarded — the data is only described more briefly, so the original is recoverable bit for bit.

Q18Which file type should NOT be compressed lossily?

  1. Aa photograph
  2. Ba music track
  3. Ca spreadsheet
  4. Da video
Show answer

Correct answer: C — a spreadsheet

A changed digit in a spreadsheet is a wrong number. Lossy methods rely on perceptual tolerance, and numeric data has none.

Q19Run-length encoding of AAABBBBCC gives:

  1. A3A4B2C
  2. BABC
  3. C9ABC
  4. D3A3B3C
Show answer

Correct answer: A — 3A4B2C

Three A, four B and two C, each written as a count followed by the value.

Q20Run-length encoding can increase a file size when:

  1. Athe file is very large
  2. Bthere is little repetition in the data
  3. Cthe file is text
  4. Dthe counts are small
Show answer

Correct answer: B — there is little repetition in the data

With no runs, every single value is stored with a count of 1 alongside it, so the encoded file has twice as many items.

Q21JPEG compression works by:

  1. Astoring every pixel exactly
  2. Bdiscarding colour detail the eye is unlikely to notice
  3. Cremoving every second pixel
  4. Dconverting to text
Show answer

Correct answer: B — discarding colour detail the eye is unlikely to notice

The eye is far more sensitive to brightness than to fine colour variation, so colour precision is where the data is cut.

Q22Repeatedly saving a JPEG causes:

  1. Ano change
  2. Bprogressive quality loss
  3. Cthe file to grow
  4. Da lossless result
Show answer

Correct answer: B — progressive quality loss

Each save discards a little more information. This is generation loss, and it is why an uncompressed master should be kept.

Q23The main advantage of solid-state over magnetic storage is:

  1. Alower cost per gigabyte
  2. Bno moving parts, so faster and shock-resistant
  3. Cunlimited writes
  4. Dlarger capacity
Show answer

Correct answer: B — no moving parts, so faster and shock-resistant

It costs more per gigabyte and has limited write endurance. Speed and durability are what it buys.

Q24Compressing an already-compressed file usually:

  1. Ahalves it again
  2. Bachieves little or nothing
  3. Crestores lost quality
  4. Dconverts it to lossless
Show answer

Correct answer: B — achieves little or nothing

Compression removes redundancy, and once it is gone there is nothing left to exploit — the second pass may even add a little overhead.

Exam-style questions · 18

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

Q13[2 marks]
State two reasons for compressing a file.
Answer

It uses less storage space, and it transmits faster over a network while using less bandwidth — which reduces cost on a metered connection.

Q14[2 marks]
Explain the difference between lossy and lossless compression.
Answer

Lossless reduces the file size in a way that allows the original to be reconstructed exactly. Lossy discards some data permanently, giving a much smaller file that can never be restored to the original.

Q15[2 marks]
Why must a program file not be compressed using a lossy method?
Answer

Lossy compression alters the data, and in a program every bit matters — changing even one instruction could stop the program running or make it behave incorrectly. Lossy methods rely on human perception tolerating small changes, and a computer executing code has no such tolerance.

Q16[4 marks]
Apply run-length encoding to RRRRRGGGBBBBBBBB and comment on when this method works poorly.
Mark scheme
  1. Runs identified: five R, three G, eight B[1]
  2. Encoded as 5R 3G 8B — six items instead of sixteen characters[1]
  3. It works poorly when adjacent values rarely repeat, such as in a photograph where neighbouring pixels differ slightly[1]
  4. In that case each run has length 1 and the encoding stores a count as well as the value, making the file larger than the originalthe enlargement is the key insight[1]

5R3G8B; it fails on data with little repetition, where it can increase the file size.

Q17[4 marks]
Compare magnetic, optical and solid-state storage, giving one advantage and one disadvantage of solid-state.
Mark scheme
  1. Magnetic uses magnetised regions on spinning platters — large capacity and cheap per gigabyte[1]
  2. Optical uses pits read by laser — portable and cheap, but small capacity and slow[1]
  3. Solid-state advantage: no moving parts, so it is much faster, silent and resistant to being dropped[1]
  4. Disadvantage: higher cost per gigabyte, and each memory cell tolerates only a limited number of writesthe write-endurance point is the stronger one[1]

Magnetic cheap and large, optical portable, solid-state fast but dearer with limited write endurance.

Q18[6 marks]
A school is setting up a system to store student photographs, exam scripts as scanned documents, and the school database.
  1. Recommend a compression approach for the photographs, with a reason.
  2. Recommend one for the database, with a reason.
  3. Explain why the total storage needed cannot be reduced indefinitely by compressing repeatedly.
Mark scheme
  1. Photographs: lossy compression such as JPEG[1]
  2. The reduction is large and the discarded detail is not noticeable in a photograph viewed normally, so the loss costs nothing in practice[1]
  3. Database: lossless compression, or none at all[1]
  4. Every value must be recoverable exactly — a changed digit in a mark or a date is simply wrong data, with no perceptual tolerance to exploit[1]
  5. Lossless compression works by removing repetition, and once the repetition is gone there is nothing further to remove[1]
  6. Compressing an already-compressed file usually achieves nothing and can make it slightly larger, since the compression data itself must be storedaccept that repeated lossy compression degrades quality instead[1]

(a) lossy — the loss is imperceptible (b) lossless — every value must be exact (c) once repetition is removed there is nothing left to compress

02

Data transmission

Multiple choice · 24

Q1Which part of a packet contains the receiver's address?

  1. Apayload
  2. Bheader
  3. Ctrailer
  4. Dchecksum
Show answer

Correct answer: B — header

The header carries the addressing and sequencing information. The payload is the data itself and the trailer holds the error check.

Q2Serial transmission sends:

  1. Aseveral bits at once
  2. Bone bit at a time
  3. Cwhole bytes in parallel
  4. Donly text
Show answer

Correct answer: B — one bit at a time

One bit at a time down a single wire, which is why it works reliably over long distances.

Q3Skew is a problem for:

  1. Aserial transmission
  2. Bparallel transmission over distance
  3. Cwireless only
  4. Dpacket switching
Show answer

Correct answer: B — parallel transmission over distance

Bits travelling down separate wires arrive at slightly different times, and over distance the gap becomes large enough to corrupt the data.

Q4A walkie-talkie is an example of:

  1. Asimplex
  2. Bhalf duplex
  3. Cfull duplex
  4. Dparallel
Show answer

Correct answer: B — half duplex

Both parties can transmit, but only one at a time — which is why users say "over" to hand the channel across.

Q5A telephone call is an example of:

  1. Asimplex
  2. Bhalf duplex
  3. Cfull duplex
  4. Dbroadcast
Show answer

Correct answer: C — full duplex

Both people can speak and be heard simultaneously, so data flows in both directions at the same time.

Q6If one packet arrives corrupted:

  1. Athe whole file is resent
  2. Bthat packet alone is requested again
  3. Cthe file is discarded
  4. Dnothing happens
Show answer

Correct answer: B — that packet alone is requested again

Packets are independent, so only the faulty one needs resending. This is one of the main reasons for packet switching.

Q7USB connectors cannot be inserted the wrong way round because:

  1. Athey are round
  2. Bthey are shaped to fit only one orientation
  3. Cthe software prevents it
  4. Dthey are magnetic
Show answer

Correct answer: B — they are shaped to fit only one orientation

The physical shape enforces it, which removes a whole class of user error before any software is involved.

Q8Parallel transmission is still used:

  1. Afor the internet
  2. Binside a computer over short distances
  3. Cfor USB
  4. Dfor Ethernet
Show answer

Correct answer: B — inside a computer over short distances

Over a few centimetres skew is negligible and the extra wires give real speed. Over metres it becomes unusable, so every external link is serial.

Q9Under even parity, the byte 11010010 (including its parity bit) is:

  1. Acorrect
  2. Bcorrupted
  3. Cunreadable
  4. Dodd parity
Show answer

Correct answer: A — correct

Counting the 1s gives four, which is even, so the byte passes the check. That does not guarantee it is right — two flipped bits would also pass.

Q10A single parity check fails to detect an error when:

  1. Aone bit flips
  2. Btwo bits in the same byte flip
  3. Cthe data is text
  4. Dthe byte is all zeros
Show answer

Correct answer: B — two bits in the same byte flip

Two flips restore the original parity, so the count is correct again and nothing is reported.

Q11Which method can identify exactly which bit is wrong?

  1. Asingle parity check
  2. Bparity block
  3. Cecho check
  4. Dcheck digit
Show answer

Correct answer: B — parity block

The failing row and failing column intersect at one cell, so the bit can be corrected without a resend.

Q12A checksum works by:

  1. Asending the data twice
  2. Bcalculating a value from the data and comparing it after transmission
  3. Cadding a parity bit
  4. Dcounting packets
Show answer

Correct answer: B — calculating a value from the data and comparing it after transmission

The receiver recalculates from what arrived. Agreement means the data is almost certainly intact.

Q13A check digit is designed to detect:

  1. Atransmission interference
  2. Bdata entry errors
  3. Clost packets
  4. Dattenuation
Show answer

Correct answer: B — data entry errors

It guards codes typed by people — ISBNs, barcodes, account numbers — rather than data in transit.

Q14In ARQ, a timeout is used to detect:

  1. Aa corrupted packet
  2. Ba packet that never arrived
  3. Ca slow connection
  4. Da parity error
Show answer

Correct answer: B — a packet that never arrived

A lost packet produces no acknowledgement of any kind, so only the expiry of the timer reveals it.

Q15An echo check's main disadvantage is that it:

  1. Acannot detect errors
  2. Bdoubles the amount of data transmitted
  3. Cneeds a parity bit
  4. Donly works on text
Show answer

Correct answer: B — doubles the amount of data transmitted

The entire data is returned, so twice as much travels. It also cannot say which direction the corruption occurred in.

Q16Attenuation means the signal:

  1. Aarrives too early
  2. Bweakens over distance
  3. Csplits into packets
  4. Dis encrypted
Show answer

Correct answer: B — weakens over distance

As it weakens, the difference between a 1 and a 0 becomes harder to distinguish, and eventually bits are misread.

Q17Encryption prevents intercepted data from being:

  1. Acopied
  2. Bunderstood
  3. Cdeleted
  4. Dtransmitted
Show answer

Correct answer: B — understood

The data can still be taken and destroyed. What it cannot be is read, because without the key the ciphertext is meaningless.

Q18In asymmetric encryption, the public key:

  1. Adecrypts messages
  2. Bencrypts messages
  3. Cmust be kept secret
  4. Dis the same as the private key
Show answer

Correct answer: B — encrypts messages

It encrypts only. Even the sender cannot read the message back, which is why publishing the key is safe.

Q19The main problem with symmetric encryption is:

  1. Ait is slow
  2. Bthe key must be shared safely
  3. Cit needs two keys
  4. Dit cannot be broken
Show answer

Correct answer: B — the key must be shared safely

Any channel secure enough to send the key on would have been secure enough for the message itself. Asymmetric encryption exists to solve this.

Q20A brute force attack works by:

  1. Aguessing the algorithm
  2. Btrying every possible key
  3. Cintercepting the message
  4. Dflipping bits
Show answer

Correct answer: B — trying every possible key

It needs no cleverness, only time — which is why key length, and therefore the number of keys to try, is the defence.

Q21Encryption algorithms are published because:

  1. Athey are not important
  2. Bpublic scrutiny finds weaknesses
  3. Cthe key is also public
  4. Dit is a legal requirement
Show answer

Correct answer: B — public scrutiny finds weaknesses

A secret algorithm has been examined by very few people, and an undiscovered flaw is far more dangerous than a public one that has been fixed.

Q22Real secure connections use:

  1. Asymmetric only
  2. Basymmetric only
  3. Casymmetric to exchange a key, then symmetric
  4. Dneither
Show answer

Correct answer: C — asymmetric to exchange a key, then symmetric

Asymmetric solves the key distribution problem, then symmetric handles the bulk data because it is far faster.

Q23Adding one bit to a key length:

  1. Aadds one possible key
  2. Bdoubles the number of possible keys
  3. Chalves the security
  4. Dhas no effect
Show answer

Correct answer: B — doubles the number of possible keys

Each bit has two states, so every extra bit doubles the search space a brute force attack must cover.

Q24Entering card details on an HTTPS page that is actually a fake site:

  1. Ais safe because of the encryption
  2. Bdelivers the details securely to the attacker
  3. Ccannot happen
  4. Dtriggers a browser warning
Show answer

Correct answer: B — delivers the details securely to the attacker

The encryption works perfectly and protects the journey. It says nothing about who is at the other end, which is why phishing defeats it.

Exam-style questions · 18

Q1[2 marks]
State two items contained in a packet header.
Answer

Any two of: the sender's address, the receiver's address, the packet number, and the total number of packets making up the file.

Q2[2 marks]
Explain why parallel transmission is unsuitable over long distances.
Answer

The bits travel at very slightly different speeds along different wires, so they arrive out of step — a problem called skew — and the data can no longer be read correctly. Long parallel cables also suffer crosstalk between adjacent wires.

Q3[2 marks]
Give an example of simplex transmission and explain why it is simplex.
Answer

A keyboard to a computer: data travels from the keyboard to the machine and never in the other direction, so only one direction is ever used.

Q4[4 marks]
Explain how a file is transmitted across the internet using packet switching, and give two advantages of doing so.
Mark scheme
  1. The file is divided into packets, each with a header containing the addresses and its packet number[1]
  2. Packets travel independently and may take different routes; the receiver reassembles them in order using the packet numbers[1]
  3. Advantage: a single corrupted or lost packet can be resent on its own rather than restarting the whole file[1]
  4. Advantage: many transfers share the same links, and a broken route can be avoided rather than stopping transmission[1]

Split into numbered packets, routed independently, reassembled by number — allowing resends and rerouting.

Q5[4 marks]
Classify each of the following by wires and by direction: (i) a USB connection to an external drive, (ii) a walkie-talkie, (iii) the connection between a CPU and RAM.
Mark scheme
  1. (i) Serial — USB sends one bit at a time[1]
  2. (i) Full duplex in modern versions — data is read and written in both directionsaccept half duplex for USB 1 and 2 with justification[1]
  3. (ii) Serial and half duplex — one party speaks at a time[1]
  4. (iii) Parallel, because the distance is very short, and full duplexinside the machine skew is not a problem[1]

(i) serial full duplex (ii) serial half duplex (iii) parallel

Q6[6 marks]
A company is connecting devices in a new office.
  1. Explain why the network cabling between rooms will use serial transmission.
  2. Give three advantages of USB for connecting peripherals.
  3. Explain what happens if one packet of a file arrives corrupted.
Mark scheme
  1. The distances between rooms are far too great for parallel transmission[1]
  2. Skew and crosstalk would corrupt the data, and serial also needs fewer wires so the cabling is cheaper[1]
  3. USB is a universal standard, so one type of connector serves many different devices[1]
  4. The connector cannot be inserted the wrong way round, and devices are detected automatically with drivers loaded — plug and play[1]
  5. It also supplies power as well as data, so small peripherals need no separate supplyany three advantages[1]
  6. The error-checking value in the trailer fails, so the receiver requests that packet again — only the one packet is resent, not the whole filethe point is that just one packet is affected[1]

(a) skew and crosstalk over distance (b) universal, one-way connector, plug and play, supplies power (c) that packet alone is requested again

Q7[2 marks]
Explain how an even parity check works.
Answer

One bit of each byte is set so that the total number of 1s is even. The receiver counts the 1s in the byte it received; if the total is odd, at least one bit has been corrupted in transmission.

Q8[2 marks]
Give one limitation of a single parity check.
Answer

If two bits flip in the same byte, the parity is restored and the error is not detected. It also cannot identify which bit is wrong, so the data must be resent rather than repaired.

Q9[2 marks]
What is a check digit used for?
Answer

An extra digit calculated from the others and appended to a code such as an ISBN, barcode or account number, so that a data entry error can be detected immediately when the code is typed in.

Q10[4 marks]
Explain how a parity block allows a single corrupted bit to be both detected and corrected.
Mark scheme
  1. Each byte carries a parity bit, so a corrupted byte fails its own row check[1]
  2. An extra parity byte is sent whose bits give the parity of each column across the block[1]
  3. A single flipped bit causes exactly one row and exactly one column to fail their checks[1]
  4. The bit at the intersection of that row and column is the faulty one, so it can simply be flipped back — no resend is neededthe intersection is the key idea[1]

The failing row and failing column intersect at the corrupted bit, which is then flipped back.

Q11[4 marks]
Describe how Automatic Repeat reQuest ensures reliable delivery, including what happens if a packet is lost entirely.
Mark scheme
  1. The receiver checks each packet using an error-detection method such as a checksum[1]
  2. It sends back a positive acknowledgement if the packet is intact, or a negative one if it is corrupted, prompting a resend[1]
  3. The sender starts a timer when it transmits each packet[1]
  4. If no acknowledgement arrives before the timeout, the packet is assumed lost and resent — which covers a packet that never arrived, since the receiver had nothing to checkthe timeout is the mark most often missed[1]

Acknowledgements handle corrupted packets; a timeout handles ones that never arrive.

Q12[6 marks]
A hospital transmits patient records between buildings over a long cable.
  1. Explain two causes of transmission errors over such a link.
  2. Recommend an error-detection method and justify it for this application.
  3. Explain why detection alone is not sufficient here, and what must be added.
Mark scheme
  1. Attenuation — the signal weakens over the distance until a bit is misread[1]
  2. Interference from nearby electrical equipment, which a hospital has a great deal ofaccept skew if parallel[1]
  3. A checksum on each packet, since it detects most corruption across the whole block rather than one byte at a timeaccept parity block with justification[1]
  4. Patient data must be exactly correct — a single wrong digit in a dosage could cause harm — so a strong check is justified even at the cost of extra datathe justification must fit the context[1]
  5. Detection only tells you the data is wrong; it does not deliver the correct data[1]
  6. ARQ must be added so that any packet failing the check, or failing to arrive at all, is automatically requested again until it is received intact[1]

(a) attenuation and interference (b) a checksum, because the data must be exact (c) detection must be paired with ARQ so faulty packets are resent

Q13[2 marks]
Explain what encryption does to data being transmitted.
Answer

It scrambles the data using a key so that it becomes meaningless to anyone who intercepts it. Only someone with the correct key can decrypt it back into readable form.

Q14[2 marks]
Does encryption prevent data being intercepted? Explain.
Answer

No. The data can still be intercepted, copied or deleted exactly as before. What encryption prevents is the interceptor understanding what they have taken, because without the key the ciphertext is unreadable.

Q15[2 marks]
Why is a longer encryption key more secure?
Answer

Each extra bit doubles the number of possible keys, so a brute force attack — trying every key in turn — takes far longer. A key short enough to be tried exhaustively offers no real protection.

Q16[4 marks]
Compare symmetric and asymmetric encryption, giving one advantage of each.
Mark scheme
  1. Symmetric uses the same key to encrypt and decrypt[1]
  2. Advantage: it is much faster, so it suits large volumes of data[1]
  3. Asymmetric uses a public key to encrypt and a matching private key to decrypt[1]
  4. Advantage: no secret key needs to be exchanged, which removes the problem of getting the key to the recipient safelythe key distribution problem is the point[1]

Symmetric: one key, fast. Asymmetric: a public/private pair, no shared secret needed.

Q17[4 marks]
Explain why encryption algorithms are made public rather than kept secret.
Mark scheme
  1. A public algorithm can be examined by cryptographers worldwide[1]
  2. so weaknesses are found and corrected, rather than remaining hidden until an attacker discovers one[1]
  3. Security rests entirely on the key, which remains secret — knowing the method does not read the message[1]
  4. A secret algorithm has been checked by very few people, and once leaked offers no protection at all — "security through obscurity" is not security[1]

Public scrutiny finds weaknesses; secrecy rests on the key alone, not on the method.

Q18[6 marks]
A customer buys goods from an online shop and enters card details.
  1. Explain how HTTPS protects the card details in transit.
  2. Explain why the site uses both asymmetric and symmetric encryption.
  3. Explain one thing encryption does NOT protect against here.
Mark scheme
  1. The data is encrypted in the browser before it is sent, so anything intercepted on the way is ciphertext[1]
  2. Only the shop's server holds the key needed to decrypt it, so an interceptor sees nothing usable[1]
  3. Asymmetric encryption is used first, to exchange a symmetric key safely without any prior shared secret[1]
  4. Then symmetric encryption is used for the actual data, because it is far faster for the volume involvedthe combination is the mark[1]
  5. Encryption does not protect the data once it has been decrypted at the destination[1]
  6. If the shop's database is later breached, or if the customer was tricked into sending details to a fake site in the first place, encryption offers no protection — it secured the journey, not the endpointsaccept phishing as the example[1]

(a) encrypted before sending, decryptable only by the server (b) asymmetric to exchange the key, symmetric for speed (c) it protects the journey, not the endpoints — a breached database or a fake site defeats it

03

Hardware

Multiple choice · 30

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.

Q9Which of these is both an input and an output device?

  1. AKeyboard
  2. BPrinter
  3. CTouchscreen
  4. DScanner
Show answer

Correct answer: C — Touchscreen

It displays information and senses where the user touches, performing both functions in one unit.

Q10A sensor produces:

  1. Aa digital value
  2. Ban analogue value
  3. Ca binary file
  4. Da decision
Show answer

Correct answer: B — an analogue value

The reading varies continuously, so an analogue-to-digital converter is needed before a processor can use it.

Q11The role of a sensor in a control system is to:

  1. Adecide what action to take
  2. Bmeasure a physical quantity
  3. Coperate a motor
  4. Dstore readings
Show answer

Correct answer: B — measure a physical quantity

Deciding is the microprocessor's job and acting is the actuator's. The sensor only measures.

Q12The most suitable sensor for an automatic door is:

  1. ApH sensor
  2. Binfrared or proximity sensor
  3. Cmoisture sensor
  4. Dpressure sensor in the ceiling
Show answer

Correct answer: B — infrared or proximity sensor

It detects a person approaching. A pressure mat would also work, but an infrared sensor detects them before they arrive.

Q13For printing 5000 pages a month, the better choice is:

  1. Ainkjet, because it is cheaper to buy
  2. Blaser, because of speed and cost per page
  3. Ca 3D printer
  4. Deither — there is no difference
Show answer

Correct answer: B — laser, because of speed and cost per page

At that volume the running cost dominates the purchase price, and an inkjet would be far slower as well.

Q14An actuator is:

  1. Aan input device
  2. Ban output device that performs a physical action
  3. Ca type of sensor
  4. Da converter
Show answer

Correct answer: B — an output device that performs a physical action

Motors, valves and heaters change something physical rather than presenting information to a person.

Q15An ADC is needed because:

  1. Asensors are slow
  2. Bprocessors cannot use analogue signals directly
  3. Cit saves power
  4. Dsensors are digital
Show answer

Correct answer: B — processors cannot use analogue signals directly

The sensor produces a continuously varying value and the processor works only in discrete digital values.

Q16A barcode is read by:

  1. Aweighing the product
  2. Bmeasuring light reflected from bars and spaces
  3. Ca magnetic strip
  4. Dtyping the number
Show answer

Correct answer: B — measuring light reflected from bars and spaces

Dark bars reflect less light than light spaces, and the resulting pattern is converted into the product number.

Q17Which is volatile?

  1. AROM
  2. BRAM
  3. Chard disk
  4. DDVD
Show answer

Correct answer: B — RAM

RAM loses its contents the moment power is removed, which is why unsaved work disappears in a power cut.

Q18ROM contains:

  1. Athe operating system
  2. Bthe start-up instructions
  3. Cthe user's files
  4. Dvirtual memory
Show answer

Correct answer: B — the start-up instructions

It holds the small boot program that finds and loads the operating system. The OS itself is far too large and lives on disk.

Q19Optical storage reads data using:

  1. Aa magnetic head
  2. Ba laser
  3. Ctrapped charge
  4. Da rotating drum
Show answer

Correct answer: B — a laser

A laser is reflected differently by pits and flat areas, and that difference is read as the bit pattern.

Q20The main disadvantage of solid-state storage is:

  1. Ait is slow
  2. Bit has moving parts
  3. Ccost per gigabyte and limited write endurance
  4. Dit is volatile
Show answer

Correct answer: C — cost per gigabyte and limited write endurance

It is fast, silent and has no moving parts. What it costs is money and a finite number of writes per cell.

Q21Virtual memory is located:

  1. Ainside the CPU
  2. Bin ROM
  3. Con secondary storage
  4. Din cache
Show answer

Correct answer: C — on secondary storage

It is disk space treated as though it were RAM, which is exactly why using it is so much slower than real memory.

Q22A machine paging heavily shows:

  1. Ahigh CPU usage only
  2. Ba slow response with constant disk activity
  3. Ca full screen
  4. Dno symptoms
Show answer

Correct answer: B — a slow response with constant disk activity

The processor is waiting on the disk rather than computing, so the disk light is busy while the CPU is not.

Q23The best remedy for constant paging is:

  1. Aa faster disk
  2. Bmore RAM
  3. Ca bigger monitor
  4. Ddefragmenting
Show answer

Correct answer: B — more RAM

More RAM means the pages never need to leave memory. A faster disk makes an expensive operation slightly less expensive.

Q24For an archive of rarely accessed files, the best value is:

  1. Asolid state
  2. Bmagnetic hard disks
  3. CRAM
  4. Dcache
Show answer

Correct answer: B — magnetic hard disks

Capacity per rupee is what matters when speed is irrelevant, and magnetic disks are far cheaper at large capacities.

Q25Data 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.

Q26Which 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.

Q27A 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.

Q28The 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.

Q29In 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.

Q30TCP 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.

Exam-style questions · 24

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]
Give one device that is both an input and an output device, and explain why.
Answer

A touchscreen. It displays information, which is output, and senses where the user touches, which is input — both functions in one device.

Q8[2 marks]
Why is an analogue-to-digital converter needed between a sensor and a microprocessor?
Answer

A sensor produces a continuously varying analogue reading, while a microprocessor can only work with digital values. The ADC converts the analogue signal into a number the processor can use.

Q9[2 marks]
Name a suitable sensor for an automatic greenhouse watering system and explain your choice.
Answer

A moisture sensor in the soil. It measures the water content directly, which is the quantity the system needs to control, so watering can be triggered when the soil dries below a preset level.

Q10[4 marks]
Compare inkjet and laser printers, recommending one for a business printing 2000 invoices a month.
Mark scheme
  1. An inkjet sprays ink droplets; it is cheap to buy and gives good colour quality, but is slow with a high cost per page[1]
  2. A laser uses toner and a drum; it is faster with a much lower cost per page, though dearer to buy[1]
  3. Recommend the laser printer[1]
  4. 2000 pages a month is high volume, so the lower cost per page and greater speed outweigh the higher purchase price, and invoices need no photographic colour qualitythe justification must use the figures given[1]

Laser — high volume makes speed and cost per page decisive, and invoices need no photo quality.

Q11[4 marks]
Describe how a barcode reader works and give two advantages over typing a product code by hand.
Mark scheme
  1. A light or laser is shone at the barcode and the reflection is measured — dark bars reflect less light than the light spaces[1]
  2. The pattern of reflections is converted into a number, which is looked up in the product database[1]
  3. Advantage: it is much faster than typing a long code[1]
  4. Advantage: it is far more accurate — no mistyping — and a check digit in the code catches any misread[1]

Reflected light is read as a pattern and converted to a number; faster and more accurate than typing.

Q12[6 marks]
An automatic car park barrier raises when a car approaches and a valid ticket is presented.
  1. Name two input devices the system would use and state what each detects.
  2. Name the output device that raises the barrier.
  3. Explain why the sensors alone cannot operate the barrier.
Mark scheme
  1. A proximity or infrared sensor to detect that a vehicle is present at the barrier[1]
  2. A barcode or card reader to read the ticket presented by the driveraccept a camera reading the number plate[1]
  3. An actuator — a motor — raises and lowers the barrier arm[1]
  4. Sensors only measure; they produce readings and make no decisions[1]
  5. A microprocessor must compare the ticket against stored valid tickets and check that a vehicle is actually present[1]
  6. Only then does it send a signal to the actuator, so the processor is what turns two readings into an action[1]

(a) a proximity sensor and a ticket reader (b) a motor as actuator (c) sensors only measure — the processor compares and decides

Q13[2 marks]
State two differences between RAM and ROM.
Answer

RAM is volatile and loses its contents when the power is removed; ROM is non-volatile and retains them. RAM can be written to freely and holds the programs currently running; ROM is not normally written to and holds the start-up instructions.

Q14[2 marks]
Why is secondary storage needed as well as RAM?
Answer

RAM is volatile, so everything in it is lost when the machine is switched off, and it is comparatively small and expensive. Secondary storage retains data permanently without power and provides far greater capacity at a much lower cost.

Q15[2 marks]
Explain one advantage of solid-state storage over magnetic storage.
Answer

It has no moving parts, so it accesses data much faster, uses less power, makes no noise and is far more resistant to damage from being dropped or vibrated.

Q16[4 marks]
Explain what virtual memory is and how it works.
Mark scheme
  1. Virtual memory is an area of secondary storage used as though it were additional RAM[1]
  2. It is used when the programs being run need more memory than the physical RAM provides[1]
  3. Pages of memory not currently in use are written out to disk, freeing real RAM for active data[1]
  4. When a page is needed again it is read back and another is written out — a process called paging or swapping[1]

Disk space used as extra RAM, with unused pages swapped out and read back when needed.

Q17[4 marks]
A computer becomes very slow when many applications are open, and its disk light stays on. Explain the cause and evaluate two possible remedies.
Mark scheme
  1. RAM has filled, so the operating system is using virtual memory and paging to diskthe constant disk activity is the clue[1]
  2. Disk access is thousands of times slower than RAM, so every switch between programs now waits on the disk[1]
  3. Installing more RAM is the better remedy: it removes the need to page at all[1]
  4. Fitting a faster SSD helps but only shortens each swap — it reduces the symptom while leaving the cause in placethe distinction is the mark[1]

RAM is full and the OS is paging. More RAM removes the cause; a faster disk only shortens each delay.

Q18[6 marks]
A hospital is specifying storage for three purposes: the machine that runs monitoring software, an archive of patient scans, and copies of records to be carried between sites.
  1. Recommend a storage type for each, with a reason.
  2. Explain why the monitoring machine should have enough RAM to avoid virtual memory.
  3. Explain why ROM is still needed in each machine.
Mark scheme
  1. Monitoring machine: solid state, for speed and because it has no moving parts to fail[1]
  2. Archive: magnetic hard disks, for the very large capacity at low cost per gigabyte[1]
  3. Between sites: optical or solid state portable media, as it must be carried and survive handlingeither accepted with justification[1]
  4. If it began paging, the machine would slow unpredictably as it waited on disk access[1]
  5. In a monitoring system a delayed response could be dangerous, so the timing must stay predictable — which means never depending on virtual memorythe safety point is the mark[1]
  6. ROM holds the start-up instructions that run before any disk is read, so the machine can find and load the operating system — without it nothing could boot at all[1]

(a) SSD, magnetic archive, portable media (b) paging would make response times unpredictable, which is unsafe here (c) ROM boots the machine before any disk is available

Q19[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.

Q20[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.

Q21[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.

Q22[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]
Q23[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]
Q24[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]
04

Software

Multiple choice · 8

Q1Which of these is system software?

  1. ASpreadsheet
  2. BWeb browser
  3. CAntivirus
  4. DPhoto editor
Show answer

Correct answer: C — Antivirus

Antivirus maintains and protects the machine rather than doing the user's own work, so it is a utility — a kind of system software. The other three are applications.

Q2A compiler differs from an interpreter in that it:

  1. Aruns one line at a time
  2. Btranslates the whole program before running
  3. Cneeds no translation
  4. Dworks only with assembly
Show answer

Correct answer: B — translates the whole program before running

The compiler produces a complete executable in advance. An interpreter translates each statement as it reaches it, every time the program runs.

Q3A device driver is needed because:

  1. Adevices are slow
  2. Bthe OS cannot know the commands of every device model
  3. Cdrivers save memory
  4. Dhardware is proprietary
Show answer

Correct answer: B — the OS cannot know the commands of every device model

There are thousands of printer and card models. The driver translates the OS's general request into the commands that one device understands, which is why a new printer needs new driver software.

Q4Which is a reason to run a server from a command line?

  1. Ait looks more professional
  2. Bit uses fewer system resources and can be scripted
  3. Cit is the only option
  4. DGUIs cannot manage files
Show answer

Correct answer: B — it uses fewer system resources and can be scripted

No desktop to draw means more memory and CPU for the server's real work, and commands can be saved as scripts and repeated automatically.

Q5An interpreter stops at the first error it encounters, which means:

  1. Aerrors are always fixed faster
  2. Ba program may run for a while before failing
  3. Cno errors are possible
  4. Dthe program never runs
Show answer

Correct answer: B — a program may run for a while before failing

Statements before the bad line have already been executed, so the program appears to work until it reaches the fault. A compiler would have reported the error before anything ran.

Q6Memory management by an operating system means:

  1. Aincreasing the amount of RAM
  2. Ballocating RAM to programs and keeping them separate
  3. Ccompressing files
  4. Ddeleting old data
Show answer

Correct answer: B — allocating RAM to programs and keeping them separate

The OS decides which program gets which region of memory and enforces the boundaries, which is what stops one crashing program from corrupting another.

Q7One disadvantage of open-source software for a business is:

  1. Ait cannot be modified
  2. Bsupport may be limited to community forums
  3. Cit costs more
  4. Dit has no source code
Show answer

Correct answer: B — support may be limited to community forums

There is no company contractually obliged to fix a fault. For a business that needs a guaranteed response time, that is a genuine risk, whatever the cost saving.

Q8An application wanting to save a file:

  1. Awrites to the disk directly
  2. Basks the operating system to do it
  3. Cuses the BIOS
  4. Dneeds a compiler
Show answer

Correct answer: B — asks the operating system to do it

Applications never touch hardware directly. The request goes to the OS, which handles the file system and the device driver — which is exactly why an OS must be installed first.

Exam-style questions · 6

Q1[2 marks]
Differentiate between system software and application software, giving one example of each.
Answer

System software manages and maintains the computer itself — for example Windows, an operating system. Application software performs tasks for the user — for example a word processor. The test is who the software serves: the machine, or the person using it.

Q2[2 marks]
State two functions of an operating system.
Answer

Any two of: process management (scheduling which program uses the CPU), memory management (allocating RAM and keeping programs separate), file management, device management through drivers, and providing a user interface.

Q3[2 marks]
What is utility software? Give one example.
Answer

Utility software is system software that maintains, analyses or protects the computer rather than doing the user's own work. Examples: antivirus, backup software, disk defragmenter, file compression.

Q4[4 marks]
Compare a compiler and an interpreter, giving two differences and one situation where each is preferable.
Mark scheme
  1. A compiler translates the entire program at once, producing an executable file; an interpreter translates and runs one line at a time[1]
  2. A compiler reports all errors together at the end of compilation; an interpreter halts at the first error it reaches[1]
  3. A compiler is preferable for finished software being distributed, since it runs faster and the source code need not be shipped[1]
  4. An interpreter is preferable while learning or testing, because a change can be run immediately with no compilation step[1]

Whole program vs line by line; all errors vs first error; compiled for distribution, interpreted for development.

Q5[4 marks]
A school is choosing between a proprietary office suite and an open-source one. Give two advantages of each.
Mark scheme
  1. Proprietary: professional technical support is guaranteed, with someone responsible for fixing faults[1]
  2. Proprietary: releases are formally tested, and compatibility with other schools and offices is more predictable[1]
  3. Open source: no licence cost, which for a school with many machines is a substantial saving[1]
  4. Open source: the source code can be inspected and modified, and the school is not locked into one supplier[1]

Proprietary: support and tested compatibility. Open source: no cost and freedom to modify.

Q6[6 marks]
A computer is being set up for a school computer laboratory.
  1. Explain why an operating system must be installed before any application software.
  2. Explain the role of a device driver, using a printer as an example.
  3. The laboratory manager wants to use a command-line interface on the server. Give two reasons this may be sensible.
Mark scheme
  1. Applications cannot access hardware directly — they make requests to the operating system, which carries them out[1]
  2. Without an OS there is nothing to load the application into memory, allocate it CPU time, or give it access to files[1]
  3. A device driver is software that translates general operating system requests into the specific commands one particular device understands[1]
  4. So the OS can say "print this page" without knowing anything about that printer model; installing a new printer means installing its driver[1]
  5. A CLI uses far fewer system resources than a graphical desktop, leaving more memory and CPU for the server's actual work[1]
  6. Commands can be written into scripts and repeated automatically, and a CLI works well over a slow remote connectioneither reason accepted[1]

(a) applications reach hardware only through the OS (b) a driver translates OS requests for one specific device (c) lighter on resources and scriptable

05

The internet and its uses

Multiple choice · 24

Q1The 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.

Q2DNS 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.

Q3A 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.

Q4A 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.

Q5HTTPS 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.

Q6The 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.

Q7Which 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.

Q8An 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.

Q9Renting server capacity by the hour over the internet is:

  1. Athe Internet of Things
  2. Bcloud computing
  3. Cblockchain
  4. Dbig data
Show answer

Correct answer: B — cloud computing

Cloud computing means renting computing resources from a provider instead of owning hardware.

Q10Gmail is an example of which cloud model?

  1. AIaaS
  2. BPaaS
  3. CSaaS
  4. DNone
Show answer

Correct answer: C — SaaS

You use the finished application without managing any platform or infrastructure — software as a service.

Q11The main security weakness of IoT devices is:

  1. Athey are too fast
  2. Bdefault passwords and a lack of updates
  3. Cthey use too much power
  4. Dthey cannot connect
Show answer

Correct answer: B — default passwords and a lack of updates

Cheap devices ship with known default credentials and often receive no firmware updates, leaving vulnerabilities open for the life of the device.

Q12In a blockchain, each block contains:

  1. Aa copy of all previous blocks
  2. Ba hash of the previous block
  3. Cthe user's password
  4. Dnothing but transactions
Show answer

Correct answer: B — a hash of the previous block

The chained hashes are what make tampering detectable: altering an old record changes its hash and breaks every block after it.

Q13Blockchain is a poor choice when:

  1. Ano party can be trusted
  2. Brecords must be tamper-evident
  3. Cone trusted organisation owns the data
  4. Dmany parties share a ledger
Show answer

Correct answer: C — one trusted organisation owns the data

Its whole purpose is removing the need for a trusted party. If you already have one, an ordinary database does the job far faster and more cheaply.

Q14Which is the strongest business argument for cloud computing?

  1. Ait is always cheaper
  2. Bcapacity can grow and shrink on demand
  3. Cit needs no internet
  4. Ddata is more private
Show answer

Correct answer: B — capacity can grow and shrink on demand

Scalability avoids buying hardware for a peak that lasts three days a year. It is not always cheaper, it requires connectivity, and privacy is a risk rather than a benefit.

Q15A key limitation of AI systems is that they:

  1. Awork too slowly
  2. Breflect the biases in their training data
  3. Ccannot store data
  4. Dneed no electricity
Show answer

Correct answer: B — reflect the biases in their training data

A model learns the patterns in what it was shown, including unfair ones, and generally cannot explain the reasoning behind a decision.

Q16Augmented reality differs from virtual reality in that it:

  1. Areplaces the real world entirely
  2. Boverlays information onto the real world
  3. Cneeds no hardware
  4. Dis only for games
Show answer

Correct answer: B — overlays information onto the real world

AR adds to what you can already see; VR substitutes a wholly simulated environment for it.

Q17Malware that spreads across a network without any user action is a:

  1. Avirus
  2. Bworm
  3. Ctrojan
  4. Dcookie
Show answer

Correct answer: B — worm

A worm is self-replicating and needs no host file or user. A virus requires someone to run the infected file.

Q18Malware disguised as useful software is a:

  1. Aworm
  2. Btrojan
  3. Ckeylogger
  4. Dfirewall
Show answer

Correct answer: B — trojan

The victim installs it deliberately, believing it to be something else — which is why the disguise is the whole attack.

Q19The most effective defence against brute force is:

  1. Aa longer password only
  2. Blocking the account after failed attempts
  3. Ca firewall
  4. Dencryption
Show answer

Correct answer: B — locking the account after failed attempts

Lockout makes exhaustive guessing impossible regardless of speed. A longer password only increases the time required.

Q20Pharming differs from phishing because:

  1. Ait uses email
  2. Bit redirects you even when you type the correct address
  3. Cit is legal
  4. Dit needs a firewall
Show answer

Correct answer: B — it redirects you even when you type the correct address

DNS settings are altered, so no link needs to be clicked — which is why the standard phishing advice does not protect against it.

Q21A firewall protects against:

  1. Asocial engineering
  2. Bunauthorised network traffic
  3. Ca user giving away a password
  4. Dphysical theft
Show answer

Correct answer: B — unauthorised network traffic

It filters traffic against rules. Attacks that bypass the network entirely, such as a phone call, are outside what it can see.

Q22A telephone call claiming to be from IT and requesting a password is:

  1. Aphishing
  2. Bsocial engineering
  3. Ca DDoS attack
  4. Dpharming
Show answer

Correct answer: B — social engineering

It manipulates a person directly with no technical component at all, which is why training rather than software is the defence.

Q23Two-factor authentication protects against:

  1. Aa stolen password being sufficient
  2. Bviruses
  3. CDDoS attacks
  4. Ddata interception
Show answer

Correct answer: A — a stolen password being sufficient

Even with the correct password, the attacker still needs the second factor, which is typically on a device the owner holds.

Q24The most common route for a successful attack is:

  1. Abreaking encryption
  2. Bpersuading a person to act
  3. Cphysically stealing a server
  4. Dguessing an IP address
Show answer

Correct answer: B — persuading a person to act

Modern encryption is impractical to break, so attackers target the person instead — which is why training belongs in every security answer.

Exam-style questions · 18

Q1[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.

Q2[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.

Q3[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.

Q4[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.

Q5[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.

Q6[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

Q7[2 marks]
Define cloud computing and state one advantage.
Answer

Cloud computing is the delivery of computing resources — storage, processing power, software — over the internet, rented from a provider rather than owned. One advantage is scalability: capacity can be increased for a busy period and reduced afterwards, so you pay only for what you use.

Q8[2 marks]
Give two disadvantages of cloud computing for a business.
Answer

It depends entirely on internet connectivity — an outage stops all work. And the data is stored on hardware the business does not control, raising security and legal questions about who can access it and in which country it is held.

Q9[2 marks]
What is the Internet of Things? Give one example.
Answer

The Internet of Things is the network of everyday physical objects fitted with sensors and network connections, which collect and exchange data automatically. Example: a smart thermostat that reports the temperature and can be adjusted remotely.

Q10[4 marks]
Explain why Internet of Things devices are a security concern, and state two measures that reduce the risk.
Mark scheme
  1. IoT devices are cheap and produced in huge numbers, and many ship with default passwords that users never change[1]
  2. They often receive no security updates after release, so a known vulnerability remains exploitable for the life of the devicethis is the core of the problem[1]
  3. Measure: change default credentials immediately and apply any firmware updates the manufacturer provides[1]
  4. Measure: place IoT devices on a separate network from computers holding important data, so a compromised device cannot reach themnetwork segmentation[1]

Default passwords and absent updates; fix with changed credentials and a separate network.

Q11[4 marks]
Explain how a blockchain makes records tamper-evident, and give one situation where an ordinary database would be a better choice.
Mark scheme
  1. Records are grouped into blocks, and each block stores a cryptographic hash of the previous block[1]
  2. Changing an old record changes its hash, which invalidates every block after it, so the alteration is immediately detectable[1]
  3. The ledger is copied across many computers, so a single altered copy disagrees with the rest and is rejecteddistribution is essential to the argument[1]
  4. An ordinary database is better when one trusted organisation owns the data — it is far faster, cheaper and uses vastly less energy[1]

Chained hashes plus many copies make tampering detectable; a normal database is better when there is a trusted owner.

Q12[6 marks]
A hospital is considering moving its patient records to a cloud provider.
  1. Give two benefits the hospital would gain.
  2. Give two risks it must consider.
  3. Suggest one measure that would reduce those risks.
Mark scheme
  1. Records become accessible from any authorised device in the hospital, and from other sites if a patient is transferred[1]
  2. The provider handles backup, redundancy and hardware maintenance, so the hospital needs no server room or specialist staff[1]
  3. Risk: a loss of internet connectivity would make patient records unavailable, which in a hospital could be dangerous[1]
  4. Risk: highly sensitive personal data is stored on a third party's hardware, possibly in another country with different privacy laws[1]
  5. Measure: encrypt all records both in transit and at rest, so intercepted or stolen data is unreadable[1]
  6. And keep a local cached or offline copy of critical records so care can continue during an outageaccept a contract specifying the country of storage[1]

(a) access anywhere, and no maintenance burden (b) outage risk and loss of control over sensitive data (c) encryption plus a local copy for outages

Q13[2 marks]
State the difference between a virus and a worm.
Answer

A virus attaches itself to a host file and requires a user to run that file in order to spread. A worm is self-replicating and spreads across a network by itself, needing no user action at all.

Q14[2 marks]
What is a brute force attack, and give one measure that defeats it?
Answer

An attacker tries every possible password in turn until one works. The most effective measure is to lock the account after a small number of failed attempts, which makes exhaustive guessing impossible however fast the attacker is.

Q15[2 marks]
What does a firewall do?
Answer

It examines data entering or leaving a network and blocks anything not permitted by its rules, preventing unauthorised access and filtering out unwanted traffic.

Q16[4 marks]
Explain the difference between phishing and pharming, and state a defence against each.
Mark scheme
  1. Phishing sends a fraudulent message imitating a trusted organisation, containing a link to a fake site the victim must click[1]
  2. Defence: check the sender and the true destination of any link, and never log in through a link — type the address yourself[1]
  3. Pharming uses malicious code to alter DNS settings so that typing the correct address still leads to a fake siteno link is clicked[1]
  4. Defence: anti-malware to prevent the DNS settings being altered, and checking the HTTPS certificate matches the site you intendedtyping the address does not help here[1]

Phishing needs a click; pharming redirects a correctly typed address. Different attacks, different defences.

Q17[4 marks]
A school network must be protected. Describe four security measures and the threat each addresses.
Mark scheme
  1. Firewall — filters incoming and outgoing traffic, preventing unauthorised access from outside[1]
  2. Anti-malware with automatic updates — detects and removes viruses, worms and spyware, and updates close known vulnerabilities[1]
  3. Access levels — each user sees only what they need, so a compromised student account cannot reach staff records[1]
  4. Two-factor authentication or strong password policy with lockout — protects against brute force and stolen passwordsaccept staff training against social engineering[1]

Firewall, anti-malware with updates, access levels, and strong authentication — each matched to its threat.

Q18[6 marks]
A company suffers two incidents: its website becomes unreachable for several hours, and separately an employee's password is obtained by an attacker who telephoned claiming to be from the IT department.
  1. Name and describe the attack in each case.
  2. Explain why a firewall would not have prevented the second incident.
  3. Recommend one measure against each.
Mark scheme
  1. The website incident is a DDoS attack — the server is flooded with requests from many machines until it cannot respond to genuine users[1]
  2. The password incident is social engineering — the attacker manipulated a person into revealing the password, with no technical attack at all[1]
  3. A firewall filters network traffic against a set of rules[1]
  4. The employee volunteered the password over the telephone, which never touched the network — no traffic rule could have detected itthe reason is the mark[1]
  5. Against DDoS: traffic filtering at the firewall, rate limiting, or a service that absorbs and distributes the load[1]
  6. Against social engineering: staff training and a strict procedure that credentials are never given out over the phone, with any such request verified by calling back on a known number[1]

(a) DDoS and social engineering (b) the password never crossed the network (c) traffic filtering, and training with a call-back verification policy

06

Automated and emerging technologies

Multiple choice · 16

Q1The component that performs the physical action is the:

  1. Asensor
  2. BADC
  3. Cmicroprocessor
  4. Dactuator
Show answer

Correct answer: D — actuator

Motors, heaters and valves change the physical quantity. The sensor measures and the processor decides.

Q2What distinguishes a control system from a monitoring system?

  1. Ait uses sensors
  2. Bit acts on the reading through an actuator
  3. Cit is digital
  4. Dit is faster
Show answer

Correct answer: B — it acts on the reading through an actuator

Both measure. Only a control system compares against a preset and then changes the quantity it measured.

Q3An ADC is needed because:

  1. Asensors are slow
  2. Bthe processor cannot use analogue values
  3. Cactuators are digital
  4. Dit saves power
Show answer

Correct answer: B — the processor cannot use analogue values

The sensor reading varies continuously and the processor works in discrete digital values, so a conversion is required between them.

Q4Feedback in a control system means:

  1. Athe user reports faults
  2. Bthe action changes what the sensor measures
  3. Cthe data is logged
  4. Dthe system beeps
Show answer

Correct answer: B — the action changes what the sensor measures

The loop is closed: the actuator alters the quantity and the sensor reads the altered value, which is what allows steady control.

Q5A weather station that records temperature but changes nothing is:

  1. Aa control system
  2. Ba monitoring system
  3. Ca robot
  4. Dan actuator
Show answer

Correct answer: B — a monitoring system

It measures and reports with no actuator, so it cannot affect what it measures.

Q6Robots are most suited to tasks that are:

  1. Acreative and varied
  2. Bdull, dirty or dangerous
  3. Crequiring judgement
  4. Dunpredictable
Show answer

Correct answer: B — dull, dirty or dangerous

Repetitive, hazardous and precision work plays to their strengths. Variation and judgement are exactly what they handle badly.

Q7A disadvantage of replacing workers with robots is:

  1. Alower quality output
  2. Bhigh initial cost and job displacement
  3. Cthey cannot work at night
  4. Dthey need frequent breaks
Show answer

Correct answer: B — high initial cost and job displacement

Quality is usually more consistent and they work continuously. Cost and the effect on employment are the genuine drawbacks.

Q8In an automated heating system, the preset temperature is stored:

  1. Ain the sensor
  2. Bin the microprocessor
  3. Cin the actuator
  4. Din the ADC
Show answer

Correct answer: B — in the microprocessor

The processor holds the target and does the comparison. The sensor only measures and the actuator only acts.

Q9In 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.

Q10Training 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.

Q11Grouping 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.

Q12A 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.

Q13Algorithmic 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.

Q14The 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.

Q15The "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.

Q16Reinforcement 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.

Exam-style questions · 12

Q1[2 marks]
State the difference between a monitoring system and a control system.
Answer

A monitoring system measures a quantity and reports or records it, taking no action. A control system also compares the reading with a preset value and acts through an actuator to change the quantity.

Q2[2 marks]
Why is an ADC required in an automated system?
Answer

Sensors produce analogue readings that vary continuously, while a microprocessor can only work with digital values. The analogue-to-digital converter translates between the two.

Q3[2 marks]
Give two reasons for using robots in a car factory.
Answer

They work continuously without fatigue, giving consistent quality on repetitive tasks, and they can operate in conditions hazardous to people such as paint spraying or welding.

Q4[4 marks]
Describe how an automatic street lighting system works, naming each component.
Mark scheme
  1. A light sensor continuously measures the ambient brightness[1]
  2. An ADC converts the analogue reading into a digital value for the processor[1]
  3. The microprocessor compares the value with a stored preset brightness levelthe comparison is essential[1]
  4. If the reading falls below the preset it signals the actuator to switch the lamps on; the loop then repeats so they switch off again at dawn[1]

Light sensor, ADC, microprocessor comparing with a preset, and an actuator switching the lamps.

Q5[4 marks]
Explain what feedback means in an automated system and why it is necessary.
Mark scheme
  1. The action taken by the actuator changes the physical quantity being measured[1]
  2. The sensor then measures that changed quantity, so the system responds to its own effect — a closed loop[1]
  3. Without feedback the system would act blindly, for example heating for a fixed time regardless of conditions[1]
  4. It would then overshoot on a mild day and undershoot on a cold one; feedback lets it stop at exactly the right moment whatever the conditionsthe example is what earns this mark[1]

The action changes what is measured, so the system responds to the actual state rather than an assumption.

Q6[6 marks]
A factory is replacing part of its assembly line with robots.
  1. Give two advantages and two disadvantages of this change.
  2. Explain why the robots still need sensors.
  3. Explain one situation the robots would handle worse than a human worker.
Mark scheme
  1. Advantage: consistent quality with no fatigue, and the ability to work continuously without breaks[1]
  2. Advantage: they can work safely in conditions hazardous to people, such as welding fumes or heavy lifting[1]
  3. Disadvantage: high initial purchase and installation cost, and skilled staff needed to program and maintain them[1]
  4. Disadvantage: existing workers lose their jobs, and retraining rarely reaches the same people[1]
  5. Sensors let the robot detect the position and presence of components, so it responds to what is actually there rather than assumingwithout them a misplaced part would be handled as though correctly positioned[1]
  6. An unfamiliar situation — a component of the wrong shape, or an obstruction — would be handled badly, because the robot follows a program covering only anticipated cases, whereas a person would notice something was wrong and stop[1]

(a) consistency and safety against cost and job losses (b) so it responds to actual positions rather than assumptions (c) anything unanticipated — a person notices and stops

Q7[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.

Q8[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.

Q9[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.

Q10[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.

Q11[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.

Q12[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

07

Algorithm design and problem-solving

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]
08

Programming

Multiple choice · 30

Q1What does input() return?

  1. Aan integer
  2. Ba string
  3. Ca float
  4. Dwhatever type was typed
Show answer

Correct answer: B — a string

Always a string. Python cannot know what you intended, so it hands back the characters and leaves the conversion to you.

Q2If the user types 4 and 6 into a = input(); b = input(); print(a + b), the output is:

  1. A10
  2. B46
  3. Can error
  4. D4 6
Show answer

Correct answer: B — 46

Both are strings, so + joins them into "46". No error is raised, which is why this bug is so easy to miss.

Q39 // 4 evaluates to:

  1. A2.25
  2. B2
  3. C1
  4. D2.0
Show answer

Correct answer: B — 2

Integer division discards the fractional part and returns a whole number. 9 / 4 would give 2.25.

Q410 % 3 evaluates to:

  1. A3
  2. B1
  3. C3.33
  4. D0
Show answer

Correct answer: B — 1

10 divided by 3 is 3 remainder 1, and % returns the remainder. This is how you test divisibility: a remainder of 0 means it divides exactly.

Q5Which is a valid Python variable name?

  1. A2marks
  2. Btotal marks
  3. Ctotal_marks
  4. Dprint
Show answer

Correct answer: C — total_marks

Names cannot start with a digit or contain spaces, and print is a built-in that should not be reused. Underscores are the usual way to join words.

Q6x = 5 followed by x = 8 results in:

  1. Atwo variables
  2. Bx holding 8
  3. Can error
  4. Dx holding 13
Show answer

Correct answer: B — x holding 8

The second assignment points the same name at a new value. The 5 is simply discarded.

Q7To compare whether two values are equal you use:

  1. A=
  2. B==
  3. C=>
  4. D!=
Show answer

Correct answer: B — ==

A single = assigns. A double == compares and produces True or False; != tests for inequality.

Q8Swapping the values of a and b requires:

  1. Aa = b then b = a
  2. Ba third temporary variable
  3. Cnothing — Python swaps automatically
  4. Da loop
Show answer

Correct answer: B — a third temporary variable

After a = b the original value of a is gone, so b = a just copies b back to itself. Saving the old value in temp first is what makes the swap work.

Q9How many times does for i in range(3, 8): repeat?

  1. A3
  2. B5
  3. C8
  4. D6
Show answer

Correct answer: B — 5

i takes the values 3, 4, 5, 6, 7 — five values. The upper bound 8 is where it stops and is never used.

Q10Which loop suits "keep asking until the password is correct"?

  1. Afor
  2. Bwhile
  3. Cif
  4. Drange
Show answer

Correct answer: B — while

The number of attempts is unknown in advance and depends on what the user types, which is exactly the condition-controlled case.

Q11In Python, what determines which lines are inside an if block?

  1. Acurly brackets
  2. Bsemicolons
  3. Cindentation
  4. Dthe end keyword
Show answer

Correct answer: C — indentation

Indentation is grammatical in Python. Moving a line by four spaces changes which block it belongs to and therefore what the program does.

Q12With m = 90, the chain if m>=40 … elif m>=80 … prints the grade for 40 because:

  1. A90 is not 80
  2. BPython stops at the first true condition
  3. Celif is not allowed
  4. Dthe indentation is wrong
Show answer

Correct answer: B — Python stops at the first true condition

The first test succeeds, so the chain ends there and the later branches are never examined. Conditions must run from most restrictive to least.

Q13A while loop that never ends usually means:

  1. Athe condition is too complex
  2. Bnothing inside changes the condition variable
  3. Cthe loop is nested
  4. Drange was used
Show answer

Correct answer: B — nothing inside changes the condition variable

If the variable the condition tests is never modified, the condition stays true for ever. Every while loop needs something inside it that moves towards stopping.

Q14Two nested loops each running 5 times execute the inner body:

  1. A5 times
  2. B10 times
  3. C25 times
  4. Dunknown
Show answer

Correct answer: C — 25 times

The inner loop runs completely for every pass of the outer one, so 5 × 5 = 25.

Q15Where should total = 0 be placed when summing values in a loop?

  1. Ainside the loop
  2. Bbefore the loop
  3. Cafter the loop
  4. Dit does not matter
Show answer

Correct answer: B — before the loop

Inside, it would reset to zero on every pass and the final total would be just the last value added.

Q16break in a loop:

  1. Askips one pass
  2. Bexits the loop immediately
  3. Crestarts the loop
  4. Dcauses an error
Show answer

Correct answer: B — exits the loop immediately

It leaves the loop entirely. continue is the one that skips only the current pass.

Q17Why 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.

Q18You 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.

Q19A 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.

Q20An 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.

Q21Inserting 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.

Q22Breadth-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.

Q23Opening an existing file with mode "w":

  1. Aappends to it
  2. Berases its contents
  3. Cfails with NULL
  4. Dopens it read-only
Show answer

Correct answer: B — erases its contents

It truncates the file to zero length at the moment of opening, before anything has been written.

Q24To add a record without losing existing ones, use mode:

  1. A"r"
  2. B"w"
  3. C"a"
  4. D"x"
Show answer

Correct answer: C — "a"

Append preserves the contents and writes at the end. "w" would destroy every previous record.

Q25fopen returns NULL when:

  1. Athe file is empty
  2. Bthe file cannot be opened
  3. Cthe file is large
  4. Dreading succeeds
Show answer

Correct answer: B — the file cannot be opened

It may be missing, locked, or in a location you lack permission for. Using the NULL pointer afterwards crashes the program.

Q26Which is the file version of printf?

  1. Afput
  2. Bfprintf
  3. Cwritef
  4. Dprintfile
Show answer

Correct answer: B — fprintf

It takes the file pointer as its first argument and is otherwise identical in use.

Q27while (!feof(fp)) typically causes:

  1. Aan infinite loop
  2. Bthe last record to be processed twice
  3. Ca compile error
  4. Dthe file to be erased
Show answer

Correct answer: B — the last record to be processed twice

feof only becomes true after a read has already failed, so the body executes once more using the values from the previous successful read.

Q28The reliable way to loop until the end of a file is to:

  1. Acount the lines first
  2. Btest the return value of the read
  3. Cuse feof
  4. Dread the file twice
Show answer

Correct answer: B — test the return value of the read

The read itself reports how many items it obtained, so the loop ends exactly when a read fails rather than one pass later.

Q29Omitting fclose after writing may result in:

  1. Anothing at all
  2. Bbuffered data never reaching the disk
  3. Cthe file being deleted
  4. Da compile error
Show answer

Correct answer: B — buffered data never reaching the disk

Writes are buffered for speed. fclose flushes the buffer, and without it the most recent data may be lost when the program ends.

Q30A file pointer is declared as:

  1. Aint fp;
  2. BFILE *fp;
  3. Cchar fp[];
  4. Dfile fp;
Show answer

Correct answer: B — FILE *fp;

FILE is a type defined in stdio.h, and fopen returns a pointer to it.

Exam-style questions · 24

Q1[2 marks]
What is a variable, and what does x = 10 do?
Answer

A variable is a named location in memory holding a value. x = 10 creates the name x and assigns the integer value 10 to it. Assigning again later replaces the value rather than creating a second variable.

Q2[2 marks]
Why must int() often be used with input()?
Answer

Because input() always returns a string, even when the user types digits. Without conversion, + would join the text instead of adding — "5" + "3" gives "53" — and comparisons would compare text rather than numeric value.

Q3[2 marks]
State the difference between = and ==.
Answer

= is the assignment operator, storing a value in a variable. == is the comparison operator, testing whether two values are equal and producing True or False.

Q4[4 marks]
Write a Python program that asks the user for the length and width of a rectangle and prints its area.
Mark scheme
  1. length = float(input("Enter length: "))float rather than int allows decimal measurements[1]
  2. width = float(input("Enter width: "))[1]
  3. area = length * widtha meaningful variable name is expected[1]
  4. print("The area is", area)output must be labelled, not a bare number[1]

Read both values as floats, multiply, and print with a label.

Q5[4 marks]
State the output of each: (i) print(7 // 2) (ii) print(7 % 2) (iii) print(7 / 2) (iv) print(2 ** 3)
Mark scheme
  1. (i) 3 — integer division discards the remaindernot 3.5[1]
  2. (ii) 1 — the remainder when 7 is divided by 2[1]
  3. (iii) 3.5 — / always produces a floatnote the decimal point[1]
  4. (iv) 8 — ** is the power operator2 cubed[1]

(i) 3 (ii) 1 (iii) 3.5 (iv) 8

Q6[6 marks]
A student writes this program to calculate a average of two test marks: a = input("Mark 1: "), b = input("Mark 2: "), avg = a + b / 2, print(avg)
  1. Identify two errors in this program.
  2. Write a corrected version.
  3. Explain how you would test that your corrected version works.
Mark scheme
  1. Error 1: the inputs are strings, so they are joined rather than addedint() or float() is missing[1]
  2. Error 2: operator precedence — a + b / 2 divides b by 2 first, so brackets are needed: (a + b) / 2this error survives even after the type is fixed[1]
  3. Corrected input lines using float(input(…))[1]
  4. avg = (a + b) / 2 followed by a labelled print[1]
  5. Test with normal data, such as 60 and 80, and check the answer is 70a value you can verify by hand[1]
  6. Test with boundary data such as 0 and 100, and with erroneous data such as text, to see how it behavesall three kinds of test data[1]

(a) inputs not converted, and missing brackets (b) float(input(…)) and (a+b)/2 (c) normal, boundary and erroneous data

Q7[2 marks]
Name the three control structures and give one Python keyword for each.
Answer

Sequence — statements written one after another, needing no keyword. Selectionif. Iterationfor or while.

Q8[2 marks]
When should a while loop be used instead of a for loop?
Answer

When the number of repetitions is not known in advance and depends on a condition evaluated during the loop — for example repeating until the user enters valid input or types "quit". A for loop is used when the count is fixed beforehand.

Q9[2 marks]
How many times does the body of for i in range(2, 7): execute?
Answer

Five times, with i taking the values 2, 3, 4, 5 and 6. The upper bound 7 is where the sequence stops and is not itself used.

Q10[4 marks]
Write a Python program that prints the numbers from 1 to 20 that are divisible by 3.
Mark scheme
  1. for n in range(1, 21): — the upper bound must be 21 to include 20the off-by-one is examined here[1]
  2. if n % 3 == 0:the remainder test for divisibility[1]
  3. print(n) correctly indented inside the ifindentation is part of the mark[1]
  4. Output: 3, 6, 9, 12, 15, 18[1]

A for loop over range(1, 21) with an if n % 3 == 0 test inside.

Q11[4 marks]
This code is intended to count down from 5 to 1 but instead runs for ever. Identify the fault and correct it. count = 5 / while count > 0: / print(count)
Mark scheme
  1. Nothing inside the loop changes count[1]
  2. So the condition count > 0 is true on every pass and never becomes false — an infinite loopnaming it as infinite is expected[1]
  3. Add count = count - 1 inside the loopaccept count -= 1[1]
  4. It must be indented inside the loop; placed outside it would run only once, after the loopthe indentation point is a mark[1]

The loop variable is never decremented. Add count = count - 1 indented inside the loop.

Q12[6 marks]
A program should read ten test marks, count how many are 50 or above, and print both the count and the average.
  1. State which loop type is appropriate and why.
  2. Write the program.
  3. Explain where the print statements must be placed and why.
Mark scheme
  1. A for loop, because the number of marks is known in advance to be tenthe reason must be given[1]
  2. Initialise total = 0 and passes = 0 before the loopaccumulators must start outside the loop[1]
  3. for i in range(10): then read a mark and add it to total[1]
  4. if mark >= 50: passes = passes + 1, correctly indented inside the loop[1]
  5. After the loop: print(passes) and print(total / 10)[1]
  6. The prints must be outside the loop, because inside they would run on every pass and print ten partial results instead of one final answerthe reason is the mark[1]

(a) for, since ten is known (b) accumulators before, loop reads and tests, prints after (c) outside, or they print ten partial results

Q13[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.

Q14[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.

Q15[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.

Q16[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]
Q17[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

Q18[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]
Q19[2 marks]
Why are files needed when a program already has variables?
Answer

Variables are held in RAM, which is volatile — their contents are lost the moment the program ends or the power fails. A file is stored on secondary storage, so the data persists and can be read by the same program on another day or by a different program entirely.

Q20[2 marks]
What does fopen return if it fails, and why must this be checked?
Answer

It returns NULL. Using a NULL file pointer in any subsequent read or write causes the program to crash, so the check turns an unexplained failure into a clear message such as "cannot open file".

Q21[2 marks]
State the difference between opening a file in "w" mode and "a" mode.
Answer

"w" erases the entire contents of an existing file the moment it is opened, then writes from the beginning. "a" preserves the contents and adds new data at the end. Both create the file if it does not exist.

Q22[4 marks]
Write a C fragment that opens "data.txt" for reading, checks it opened, reads and prints integers until the end, and closes it.
Mark scheme
  1. FILE *fp; int n; fp = fopen("data.txt", "r");[1]
  2. if (fp == NULL) { printf("Cannot open file\n"); return 1; }the NULL check is a mark[1]
  3. while (fscanf(fp, "%d", &n) == 1) { printf("%d\n", n); }testing the return value, not feof[1]
  4. fclose(fp);[1]

Open, check NULL, loop while fscanf returns 1, close.

Q23[4 marks]
A program should add a new record to an existing file but instead the file contains only the newest record. Explain the fault and its correction.
Mark scheme
  1. The file has been opened in "w" mode instead of "a"[1]
  2. "w" truncates the file to zero length as soon as it is opened, destroying every existing recordthe truncation happens on opening[1]
  3. The new record is then written into an empty file, which is why only it remains[1]
  4. Correct it by opening with "a", which preserves the contents and appends at the end[1]

The file was opened with "w", which truncates it. Use "a" to append.

Q24[6 marks]
A school stores student marks in a text file, one record per line as a name followed by a mark.
  1. Write the code to read the file and count how many students scored 50 or above.
  2. Explain why fclose must be called.
  3. Explain why while (!feof(fp)) is an unreliable loop condition.
Mark scheme
  1. Opens the file in "r" mode and checks the pointer is not NULL[1]
  2. while (fscanf(fp, "%s %d", name, &marks) == 2) {two items requested, two expected back[1]
  3. if (marks >= 50) count++; } then prints the count after the loopcount initialised before the loop[1]
  4. fclose flushes the output buffer, so data still held in memory is actually written to disk[1]
  5. It also releases the file handle, a limited operating-system resource that would otherwise run out[1]
  6. feof becomes true only after a read has already failed, so the loop body runs one extra time and the previous values are processed twicetesting the read's return value avoids this[1]

(a) open, check, loop on fscanf == 2 counting passes (b) flushes the buffer and releases the handle (c) feof is set after a failed read, so the last record is processed twice

09

Databases

Multiple choice · 16

Q1A field that uniquely identifies each record is the:

  1. Aforeign key
  2. Bprimary key
  3. Ccomposite field
  4. Dindex
Show answer

Correct answer: B — primary key

The primary key must be unique and never empty. A foreign key refers to another table's primary key.

Q2ClassID appearing in the STUDENT table, referring to CLASS, is a:

  1. Aprimary key
  2. Bforeign key
  3. Ccandidate key
  4. Dcomposite key
Show answer

Correct answer: B — foreign key

It holds the primary key value of another table, which is exactly what makes it a foreign key and what links the two tables.

Q3A many-to-many relationship is implemented using:

  1. Atwo tables only
  2. Ba third linking table
  3. Ca composite field
  4. Dno keys
Show answer

Correct answer: B — a third linking table

A field holds a single value, so neither side can store a list of the other. The linking table turns it into two one-to-many relationships.

Q4In a one-to-many relationship, the foreign key is placed:

  1. Aon the "one" side
  2. Bon the "many" side
  3. Cin both tables
  4. Din a third table
Show answer

Correct answer: B — on the "many" side

Each record on the many side refers to exactly one record on the one side, which is a single value and therefore fits in a field.

Q5A student's grade in a course should be stored in:

  1. Athe STUDENT table
  2. Bthe COURSE table
  3. Cthe linking ENROLMENT table
  4. Da separate file
Show answer

Correct answer: C — the linking ENROLMENT table

The grade needs both keys to identify it — it belongs to that student in that course, so it is an attribute of the relationship.

Q6Which is the best primary key for a student record?

  1. AFull name
  2. BDate of birth
  3. CAn auto-generated roll number
  4. DHome address
Show answer

Correct answer: C — An auto-generated roll number

It is guaranteed unique and has no reason ever to change. Names repeat, dates of birth repeat, and addresses change.

Q7Concurrency control exists to:

  1. Aspeed up queries
  2. Bstop simultaneous updates corrupting data
  3. Ccompress the database
  4. Dencrypt records
Show answer

Correct answer: B — stop simultaneous updates corrupting data

Without it, two users saving changes to the same record at the same moment can leave the data in an inconsistent state or lose one update entirely.

Q8A composite primary key is needed when:

  1. Athe table is large
  2. Bno single field is unique
  3. Cthere are two tables
  4. Dforeign keys are used
Show answer

Correct answer: B — no single field is unique

In an ENROLMENT table neither StudentID nor CourseID is unique alone, but the pair together identifies exactly one enrolment.

Q9A query in Access stores:

  1. Aa copy of the selected records
  2. Bthe question only
  3. Cthe whole table
  4. Dnothing at all
Show answer

Correct answer: B — the question only

It saves the criteria and re-runs them against the tables, which is why its results are always current.

Q10Criteria written on the same row of the design grid are combined with:

  1. AOR
  2. BAND
  3. CNOT
  4. DLIKE
Show answer

Correct answer: B — AND

Same row means all must be satisfied. Different rows are ORed, so a record need satisfy only one of them.

Q11Which returns the most records?

  1. AMarks>60 AND Class="10A"
  2. BMarks>60 OR Class="10A"
  3. CMarks>60 only
  4. DClass="10A" only
Show answer

Correct answer: B — Marks>60 OR Class="10A"

OR accepts a record satisfying either condition, so its result always contains at least as many rows as either condition alone.

Q12To find names beginning with S you would write:

  1. ALike "*S"
  2. BLike "S*"
  3. C="S"
  4. DIs Null
Show answer

Correct answer: B — Like "S*"

The asterisk stands for any characters that follow, so the S must come first. Option A finds names ending in S.

Q13To sort marks from highest to lowest you write:

  1. AORDER BY Marks
  2. BORDER BY Marks ASC
  3. CORDER BY Marks DESC
  4. DSORT Marks DOWN
Show answer

Correct answer: C — ORDER BY Marks DESC

ORDER BY defaults to ascending, so descending order must be requested explicitly with DESC.

Q14A blank Marks field and a Marks field of 0 differ because:

  1. Athey are the same
  2. Bblank means unknown, 0 means a known score of nothing
  3. C0 is invalid
  4. Dblank is faster
Show answer

Correct answer: B — blank means unknown, 0 means a known score of nothing

An average ignores blanks but includes zeros, so entering 0 for an absent student would wrongly lower the class average.

Q15A query needs two tables when:

  1. Athe tables are large
  2. Bthe required columns are stored in different tables
  3. Cthere are many records
  4. Da sort is needed
Show answer

Correct answer: B — the required columns are stored in different tables

Normalisation deliberately spread the data. A join on the shared key brings the required columns back together.

Q16Storing Total as well as Price and Quantity in a table is poor design because:

  1. Ait uses space
  2. Bthe three can disagree after an edit
  3. Ctotals cannot be stored
  4. Dqueries would fail
Show answer

Correct answer: B — the three can disagree after an edit

A derived value stored separately is redundancy: change the quantity and the stored total is silently wrong. Calculate it in the query instead.

Exam-style questions · 12

Q1[2 marks]
Define a primary key and state two properties it must have.
Answer

A primary key is a field, or combination of fields, that uniquely identifies each record in a table. It must be unique across all records and must never be empty. It should also never change.

Q2[2 marks]
What is a foreign key?
Answer

A field in one table that holds the primary key value of another table, creating the link between them. For example, ClassID stored in the STUDENT table refers to the primary key of the CLASS table.

Q3[2 marks]
Why is a student's name unsuitable as a primary key?
Answer

Names are not unique — two students may share one — and they can change, which would break every foreign key referring to that record. A primary key should be a meaningless, stable identifier such as a roll number.

Q4[4 marks]
State four services provided by a database management system.
Mark scheme
  1. Data integrity — validation rules and constraints reject invalid data[1]
  2. Security — access permissions per user, per table, or per field[1]
  3. Concurrency control — simultaneous updates by different users cannot corrupt the data[1]
  4. Backup and recovery, and a query language for answering unanticipated questionseither earns the mark[1]

Integrity, security, concurrency control, backup and recovery, and a query language.

Q5[4 marks]
A driving school records instructors and students. Each student is taught by one instructor; each instructor teaches many students. Design the tables, identifying keys.
Mark scheme
  1. Relationship identified as one to many, from instructor to student[1]
  2. INSTRUCTOR(InstructorID, Name, Phone)primary key underlined or stated[1]
  3. STUDENT(StudentID, Name, Address, InstructorID)[1]
  4. InstructorID in STUDENT is a foreign key referring to INSTRUCTOR — the key goes on the "many" sideplacing it on the wrong side is the standard error[1]

Two tables, with InstructorID as a foreign key in STUDENT.

Q6[6 marks]
A college needs a database recording which students are enrolled in which courses, and the grade each student achieved in each course.
  1. Identify the relationship between STUDENT and COURSE and explain why it cannot be stored in two tables.
  2. Design the tables, showing primary and foreign keys.
  3. Explain where the grade must be stored and why.
Mark scheme
  1. Many to many — a student takes many courses and a course has many students[1]
  2. A field holds a single value, so neither table can hold a list of the other; a third table is requiredthe reason, not just the assertion[1]
  3. STUDENT(StudentID, Name) and COURSE(CourseID, Title)[1]
  4. ENROLMENT(StudentID, CourseID, Grade) with a composite primary key, both fields also being foreign keysaccept a separate EnrolmentID[1]
  5. The grade belongs in ENROLMENT[1]
  6. Because it is a property of that particular student's enrolment in that particular course — not of the student, who has many grades, nor of the course, which awards manythe reasoning is the mark[1]

(a) many to many — a field cannot hold a list (b) STUDENT, COURSE and an ENROLMENT linking table (c) the grade goes in ENROLMENT, since it belongs to the relationship

Q7[2 marks]
What is a query, and does it store data?
Answer

A query is a saved question that selects, filters, sorts or calculates from one or more tables. It stores no data — only the question — and produces its results afresh from the tables each time it runs, so the answer is always current.

Q8[2 marks]
State the difference between AND and OR in query criteria.
Answer

AND requires a record to satisfy every condition, so the result is smaller than either condition alone. OR requires only one, so the result is larger. In the Access design grid, criteria on the same row are ANDed and criteria on different rows are ORed.

Q9[2 marks]
What does the criterion Like "A*" select?
Answer

All records whose value in that field begins with A. The asterisk is a wildcard standing for any sequence of characters, so Like "*A*" would instead find values containing A anywhere.

Q10[4 marks]
Write an SQL query listing the Name and Marks of all students in the STUDENT table who scored above 50, sorted from highest to lowest.
Mark scheme
  1. SELECT Name, Marksonly the requested columns[1]
  2. FROM STUDENT[1]
  3. WHERE Marks > 50no quotation marks — Marks is numeric[1]
  4. ORDER BY Marks DESCDESC is required for highest first[1]

SELECT Name, Marks FROM STUDENT WHERE Marks > 50 ORDER BY Marks DESC

Q11[4 marks]
Explain the difference between a field that is Null and a field containing 0, and state a criterion to find each.
Mark scheme
  1. A Null field is empty — the value is unknown or was never entered[1]
  2. A field containing 0 holds a known value, namely zeroa real mark of nothing, not a missing one[1]
  3. Criterion Is Null finds the empty ones; =0 finds the zeros[1]
  4. The distinction matters because an average ignores nulls but includes zeros, giving two different answers from the same columnthe consequence is the fourth mark[1]

Null is unknown, 0 is a known value. Is Null and =0 respectively; averages treat them differently.

Q12[6 marks]
A library database has BOOK(ISBN, Title, Author) and LOAN(LoanID, ISBN, MemberID, DateDue).
  1. Write a query listing the Title and DateDue of all books due before 1 March 2026.
  2. Explain why this query needs both tables.
  3. Describe how you would produce a count of loans per member.
Mark scheme
  1. SELECT Title, DateDue[1]
  2. FROM BOOK INNER JOIN LOAN ON BOOK.ISBN = LOAN.ISBNjoined on the shared key[1]
  3. WHERE DateDue < #1/3/2026#dates enclosed in hash symbols[1]
  4. Title is stored only in BOOK and DateDue only in LOAN, so neither table alone can produce both columnsa direct consequence of normalisation[1]
  5. Use a totals query: group by MemberID[1]
  6. and apply Count to LoanID, giving one row per member with their number of loansaccept SELECT MemberID, Count(LoanID) FROM LOAN GROUP BY MemberID[1]

(a) a join on ISBN with a date criterion (b) the two columns live in different tables (c) a totals query grouping by MemberID with Count

10

Boolean logic

Multiple choice · 8

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.

Exam-style questions · 6

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

These questions come from the O Level Computer Science (2210) lessons — each topic has its own notes, worked examples and an interactive diagram.