Q11011₂ in decimal is:
- A9
- B11
- C13
- D23
Show answer
Correct answer: B — 11
Place values 8, 4, 2, 1: 8 + 0 + 2 + 1 = 11.
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.
Q11011₂ in decimal is:
Correct answer: B — 11
Place values 8, 4, 2, 1: 8 + 0 + 2 + 1 = 11.
Q2How many values can 6 bits represent?
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:
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:
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:
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:
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:
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?
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?
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:
Correct answer: C — 128 characters
2⁷ = 128. Extended ASCII adds an eighth bit to reach 256.
Q11The file size of a bitmap depends on:
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:
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:
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:
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:
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:
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:
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?
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:
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:
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:
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:
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:
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:
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.
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.
11010₂ to decimal.Place values 16, 8, 4, 2, 1: 16 + 8 + 0 + 2 + 0 = 26.
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.
2C₁₆ to binary and then to decimal.2 in hex is 0010 in binaryfour bits per hex digit[1]C is 12 in decimal, which is 1100A=10, B=11, C=12, D=13, E=14, F=15[1]00101100₂concatenate the groups, do not add them[1]32 + 8 + 4 = 44or 2×16 + 12 = 44 directly from hex[1]2C₁₆ = 00101100₂ = 44₁₀
11001010 and 01110011. State whether overflow occurs.01000010 with a carry out of the leftmost column[1]202 + 115 = 317, which exceeds the 8-bit maximum of 255[1]Carry out of the final column; overflow occurs because 317 > 255.
2⁷ = 128 characters[1]2²⁴ = 16 777 216 coloursaccept "about 16.7 million"[1]= 100 × 200 = 20 000[1]20 000 × 3 = 60 000 bytesconverting bits to bytes is the step most often missed[1]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
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.
2⁸ = 256 colours.
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.
= 1024 × 768 = 786 432[1]= 786 432 × 16 = 12 582 912[1]= 12 582 912 ÷ 8 = 1 572 864dividing by 8 is the step most often missed[1]= 1 572 864 ÷ 1024 = 1536 KB[1]1536 KB (1.5 MB)
= 44 100 × 16 × 30rate × resolution × seconds[1]= 21 168 000 bits[1]= 2 646 000, so ÷ 1 048 576 = 2.52 MBaccept 2.65 MB using 1 000 000[1]About 2.5 MB mono, doubling to about 5 MB in stereo
(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
It uses less storage space, and it transmits faster over a network while using less bandwidth — which reduces cost on a metered connection.
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.
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.
RRRRRGGGBBBBBBBB and comment on when this method works poorly.5R 3G 8B — six items instead of sixteen characters[1]5R3G8B; it fails on data with little repetition, where it can increase the file size.
Magnetic cheap and large, optical portable, solid-state fast but dearer with limited write endurance.
(a) lossy — the loss is imperceptible (b) lossless — every value must be exact (c) once repetition is removed there is nothing left to compress
Q1Which part of a packet contains the receiver's address?
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:
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:
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:
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:
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:
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:
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:
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:
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:
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?
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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.
Any two of: the sender's address, the receiver's address, the packet number, and the total number of packets making up the file.
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.
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.
Split into numbered packets, routed independently, reassembled by number — allowing resends and rerouting.
(i) serial full duplex (ii) serial half duplex (iii) parallel
(a) skew and crosstalk over distance (b) universal, one-way connector, plug and play, supplies power (c) that packet alone is requested again
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.
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.
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.
The failing row and failing column intersect at the corrupted bit, which is then flipped back.
Acknowledgements handle corrupted packets; a timeout handles ones that never arrive.
(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
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.
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.
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.
Symmetric: one key, fast. Asymmetric: a public/private pair, no shared secret needed.
Public scrutiny finds weaknesses; secrecy rests on the key alone, not on the method.
(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
Q1Which of these is volatile?
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:
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?
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:
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:
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?
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:
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:
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?
Correct answer: C — Touchscreen
It displays information and senses where the user touches, performing both functions in one unit.
Q10A sensor produces:
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:
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:
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:
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:
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:
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:
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?
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:
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:
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:
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:
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:
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:
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:
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:
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?
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:
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:
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:
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:
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.
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.
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.
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.
Fetch, decode, execute, store — repeated for every instruction.
Address = where (one-way), data = what (two-way), control = read or write.
(a) Laptop B — more cores, far more RAM, and an SSD (b) twice the storage capacity (c) clock speed ignores cores, cache and RAM
A touchscreen. It displays information, which is output, and senses where the user touches, which is input — both functions in one device.
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.
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.
Laser — high volume makes speed and cost per page decisive, and invoices need no photo quality.
Reflected light is read as a pattern and converted to a number; faster and more accurate than typing.
(a) a proximity sensor and a ticket reader (b) a motor as actuator (c) sensors only measure — the processor compares and decides
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.
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.
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.
Disk space used as extra RAM, with unused pages swapped out and read back when needed.
RAM is full and the OS is paging. More RAM removes the cause; a faster disk only shortens each delay.
(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
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.
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.
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.
Q1Which of these is system software?
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:
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:
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?
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:
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:
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:
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:
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.
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.
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.
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.
Whole program vs line by line; all errors vs first error; compiled for distribution, interpreted for development.
Proprietary: support and tested compatibility. Open source: no cost and freedom to modify.
(a) applications reach hardware only through the OS (b) a driver translates OS requests for one specific device (c) lighter on resources and scriptable
Q1The world wide web is:
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:
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:
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:
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:
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:
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?
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:
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:
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?
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:
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:
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:
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?
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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.
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.
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.
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.
DNS lookup → HTTP request → server response → further resource requests → parse and render.
Encryption in transit plus a certificate proving identity; the padlock says nothing about the site's honesty.
(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
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.
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.
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.
Default passwords and absent updates; fix with changed credentials and a separate network.
Chained hashes plus many copies make tampering detectable; a normal database is better when there is a trusted owner.
(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
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.
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.
It examines data entering or leaving a network and blocks anything not permitted by its rules, preventing unauthorised access and filtering out unwanted traffic.
Phishing needs a click; pharming redirects a correctly typed address. Different attacks, different defences.
Firewall, anti-malware with updates, access levels, and strong authentication — each matched to its threat.
(a) DDoS and social engineering (b) the password never crossed the network (c) traffic filtering, and training with a call-back verification policy
Q1The component that performs the physical action is the:
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?
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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.
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.
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.
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.
Light sensor, ADC, microprocessor comparing with a preset, and an actuator switching the lamps.
The action changes what is measured, so the system responds to the actual state rather than an assumption.
(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
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.
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.
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.
Labelled data, unlabelled data, and reward feedback respectively.
The model learns historical unfairness. Audit the data, test outcomes per group, and keep human oversight.
(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
Q1Breaking a large problem into smaller parts is called:
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?
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:
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:
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:
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:
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?
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:
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?
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?
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?
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²)?
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?
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?
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.
A finite sequence of unambiguous instructions that solves a problem or completes a task, with clearly defined inputs and outputs.
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.
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.
INPUT mark[1]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]IF mark >= 40 THEN OUTPUT "Pass"the >= is required; > alone fails a mark of exactly 40[1]ELSE OUTPUT "Fail" ENDIF[1]Input with a validation loop, then IF mark >= 40 output Pass ELSE output Fail.
SET total = 0; SET i = 1; WHILE i <= n DO total = total + i; i = i + 1; ENDWHILE; OUTPUT totali = 2, total = 1; after pass 2: i = 3, total = 3[1]i = 4, total = 6; after pass 4: i = 5, total = 10[1]5 > 4; output is 10the algorithm sums 1 to n[1]Output 10 — the algorithm computes 1 + 2 + 3 + 4.
(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
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.
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.
About 10, because 2¹⁰ = 1024. Each comparison halves the remaining list, so the maximum is log₂ n rounded up.
O(n²)[1]low = 1 and high = 5000[1]low <= high[1]mid = (low + high) DIV 2[1]high = mid − 1 or low = mid + 1 correctly[1]low > high[1]2¹³ = 8192[1]O(n log n).O(n²) as n grows. [2]n log n[1]Q1What does input() return?
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:
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:
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:
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?
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:
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:
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:
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?
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"?
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?
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:
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:
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:
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?
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:
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?
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?
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?
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?
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?
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?
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":
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:
Correct answer: C — "a"
Append preserves the contents and writes at the end. "w" would destroy every previous record.
Q25fopen returns NULL when:
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?
Correct answer: B — fprintf
It takes the file pointer as its first argument and is otherwise identical in use.
Q27while (!feof(fp)) typically causes:
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:
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:
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:
Correct answer: B — FILE *fp;
FILE is a type defined in stdio.h, and fopen returns a pointer to it.
x = 10 do?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.
int() often be used with input()?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.
= and ==.= 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.
length = float(input("Enter length: "))float rather than int allows decimal measurements[1]width = float(input("Enter width: "))[1]area = length * widtha meaningful variable name is expected[1]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.
print(7 // 2) (ii) print(7 % 2) (iii) print(7 / 2) (iv) print(2 ** 3)3 — integer division discards the remaindernot 3.5[1]1 — the remainder when 7 is divided by 2[1]3.5 — / always produces a floatnote the decimal point[1]8 — ** is the power operator2 cubed[1](i) 3 (ii) 1 (iii) 3.5 (iv) 8
a = input("Mark 1: "), b = input("Mark 2: "), avg = a + b / 2, print(avg)a + b / 2 divides b by 2 first, so brackets are needed: (a + b) / 2this error survives even after the type is fixed[1]float(input(…))[1]avg = (a + b) / 2 followed by a labelled print[1](a) inputs not converted, and missing brackets (b) float(input(…)) and (a+b)/2 (c) normal, boundary and erroneous data
Sequence — statements written one after another, needing no keyword. Selection — if. Iteration — for or while.
while loop be used instead of a for loop?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.
for i in range(2, 7): execute?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.
for n in range(1, 21): — the upper bound must be 21 to include 20the off-by-one is examined here[1] if n % 3 == 0:the remainder test for divisibility[1] print(n) correctly indented inside the ifindentation is part of the mark[1]A for loop over range(1, 21) with an if n % 3 == 0 test inside.
count = 5 / while count > 0: / print(count)count[1]count > 0 is true on every pass and never becomes false — an infinite loopnaming it as infinite is expected[1]count = count - 1 inside the loopaccept count -= 1[1]The loop variable is never decremented. Add count = count - 1 indented inside the loop.
total = 0 and passes = 0 before the loopaccumulators must start outside the loop[1]for i in range(10): then read a mark and add it to total[1]if mark >= 50: passes = passes + 1, correctly indented inside the loop[1]print(passes) and print(total / 10)[1](a) for, since ten is known (b) accumulators before, loop reads and tests, prints after (c) outside, or they print ten partial results
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.
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.
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.
(b) 20, 30, 40, 50, 60, 70
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.
fopen return if it fails, and why must this be checked?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".
"w" mode and "a" mode."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.
FILE *fp; int n; fp = fopen("data.txt", "r");[1]if (fp == NULL) { printf("Cannot open file\n"); return 1; }the NULL check is a mark[1]while (fscanf(fp, "%d", &n) == 1) { printf("%d\n", n); }testing the return value, not feof[1]fclose(fp);[1]Open, check NULL, loop while fscanf returns 1, close.
"w" mode instead of "a"[1]"a", which preserves the contents and appends at the end[1]The file was opened with "w", which truncates it. Use "a" to append.
fclose must be called.while (!feof(fp)) is an unreliable loop condition.while (fscanf(fp, "%s %d", name, &marks) == 2) {two items requested, two expected back[1] if (marks >= 50) count++; } then prints the count after the loopcount initialised before the loop[1]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
Q1A field that uniquely identifies each record is the:
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:
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:
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:
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:
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?
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:
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:
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:
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:
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?
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:
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:
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:
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:
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:
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.
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.
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.
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.
Integrity, security, concurrency control, backup and recovery, and a query language.
Two tables, with InstructorID as a foreign key in STUDENT.
(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
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.
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.
Like "A*" select?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.
SELECT Name, Marksonly the requested columns[1]FROM STUDENT[1]WHERE Marks > 50no quotation marks — Marks is numeric[1]ORDER BY Marks DESCDESC is required for highest first[1]SELECT Name, Marks FROM STUDENT WHERE Marks > 50 ORDER BY Marks DESC
Is Null finds the empty ones; =0 finds the zeros[1]Null is unknown, 0 is a known value. Is Null and =0 respectively; averages treat them differently.
SELECT Title, DateDue[1]FROM BOOK INNER JOIN LOAN ON BOOK.ISBN = LOAN.ISBNjoined on the shared key[1]WHERE DateDue < #1/3/2026#dates enclosed in hash symbols[1]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
Q1A two-input AND gate outputs 1 when the inputs are:
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:
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:
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?
Correct answer: C — 16
2⁴ = 16. Each additional input doubles the number of combinations.
Q5Simplify A·B + A·B′.
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:
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?
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:
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.
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.
(A · B)′ = A′ + B′ and (A + B)′ = A′ · B′. Complementing a whole expression swaps AND for OR and complements each variable.
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.
X = A′ · B + A · B′ and state which single gate it is equivalent to.The table matches XOR: output 1 when A and B differ.
X = (A + B) · (A + B′) using Boolean laws, naming each law you use.A·A + A·B′ + B·A + B·B′distributive law[1]A·A = A (idempotent) and B·B′ = 0 (complement)[1]X = A + A·B′ + A·Bthe zero term disappears[1]A + A·anything = A, so X = Anaming the law is required by the question[1]X = A
(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.