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.
340 multiple-choice questions and 254 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 A Level Computer Science (9618) 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
Q1Data 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.
Q2Which 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.
Q3A 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.
Q4The 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.
Q5In 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.
Q6TCP 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.
Q7The 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.
Q8DNS 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.
Q9A 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.
Q10A 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.
Q11HTTPS 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.
Q12The 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.
Q13Which 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.
Q14An 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.
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.
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
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.
Q25A 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.
Q26A 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.
Q27The 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.
Q28A 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.
Q29Simplify 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.
Q30In 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.
Q31Which 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.
Q32NAND 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.
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
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
Q1In the von Neumann architecture, programs and data are:
Correct answer: B — stored in the same memory
Sharing one memory is the defining feature, and it is what allows a machine to be reprogrammed by loading different data.
Q2The program counter holds:
Correct answer: B — the address of the next instruction
It holds an address, not an instruction — and the address of the next one, which is why it can be incremented early.
Q3During the fetch stage, the instruction is copied from the MDR into the:
Correct answer: C — CIR
The current instruction register holds the instruction while the control unit decodes it.
Q4The address bus is unidirectional because:
Correct answer: B — only the processor generates addresses
Memory never sends an address back to the processor, so there is no need for the bus to run both ways.
Q5The von Neumann bottleneck arises because:
Correct answer: B — instructions and data share one bus
Sharing a single bus means instruction fetches and data transfers cannot happen simultaneously.
Q6A single-threaded program on a quad-core processor runs:
Correct answer: B — at about the same speed
Extra cores only help when the software divides its work between them. A single thread uses one core.
Q7A graphics processor applying the same operation to millions of pixels is an example of:
Correct answer: B — SIMD
One instruction is applied to many data items simultaneously — Single Instruction, Multiple Data.
Q8A disadvantage of running software in a virtual machine is:
Correct answer: B — reduced performance from the extra layer
Isolation and easy backup are advantages. The cost is that everything passes through an additional software layer.
Q9In assembly language, each instruction corresponds to:
Correct answer: B — exactly one machine instruction
The one-to-one correspondence is what defines assembly and what makes an assembler sufficient to translate it.
Q10LDM #7 places into the accumulator:
Correct answer: B — the value 7
The # marks immediate addressing, so the operand is the value itself rather than an address.
Q11To test whether bit 0 is set, you would:
Correct answer: B — AND with 00000001
AND clears every bit the mask has a 0 in, leaving only bit 0 — a non-zero result means it was set.
Q12To set bit 5 without changing any other bit, you would:
Correct answer: B — OR with 00100000
OR forces a 1 where the mask is 1 and leaves other bits alone. XOR would toggle it rather than set it.
Q13XOR with 11111111 has the effect of:
Correct answer: C — inverting every bit
XOR flips each bit where the mask holds a 1, so an all-ones mask inverts the whole byte.
Q14A logical left shift of 2 places multiplies an unsigned value by:
Correct answer: B — 4
Each place doubles, so two places multiply by 2² = 4 — provided no 1 bits are lost off the end.
Q15An arithmetic right shift differs from a logical one because it:
Correct answer: B — preserves the sign bit
It replicates the sign bit as it shifts, so negative numbers remain negative after the division.
Q16In a cyclic shift, bits moved off one end:
Correct answer: C — reappear at the other end
A cyclic shift wraps the bits around, so no information is lost — unlike logical and arithmetic shifts.
In the von Neumann architecture, program instructions and data are held in the same memory and travel over the same bus. The limitation is the von Neumann bottleneck: instructions and data cannot be transferred simultaneously, so the processor is often left waiting for memory.
The address in the PC is copied to the MAR. The PC is then incremented. The contents of the memory location addressed by the MAR are read into the MDR, and from there the instruction is copied into the CIR ready for decoding.
A jump instruction writes a new address into the PC during execution. If the increment happened afterwards, that new address would be increased by one and the jump would land at the wrong instruction. Incrementing during the fetch means a jump can simply overwrite the PC and execution continues correctly.
(a) address one-way, data two-way; (b) fewer slow memory accesses; (c) single-threaded; (d) isolation vs overhead
SIMD applies a single instruction to multiple data items at the same time — used by graphics processors operating on many pixels identically. MIMD executes different instructions on different data simultaneously — used by multi-core processors running separate tasks.
Assembly language uses short mnemonics in place of binary machine code, with one instruction corresponding to one machine instruction. Because the relationship is one-to-one, translation is a matter of substituting each mnemonic for its opcode — a much simpler task than compiling a high-level language, where one statement may become many machine instructions.
LDM #20 uses immediate addressing: the value 20 itself is loaded into the accumulator. LDD 20 uses direct addressing: the contents of memory address 20 are loaded, which could be any value.
(a) 00000110 (b) 11110110 (c) 01001001 (d) 01101100
(a) AND 00000100, non-zero means set; (b) OR 00000100; (c) AND 11111011; (d) preserves the sign bit
It multiplies the value by 2³ = 8. The result would be wrong if any bits shifted off the left-hand end were 1s, since those bits are lost — the value would then have overflowed the available word length.
Q1The always-resident core of an operating system is called the:
Correct answer: B — kernel
The kernel manages the CPU, memory and devices and stays in memory throughout. The shell is the user interface and can be replaced.
Q2Twenty programs appear to run at once on one core because the OS:
Correct answer: B — switches between them very quickly
Time-slicing gives each a few milliseconds in turn. Only one instruction actually executes at any moment.
Q3A slow machine with constant disk activity most likely indicates:
Correct answer: B — RAM is full and the OS is paging
The disk is busy because memory pages are being written out and read back. If the CPU were the bottleneck the processor, not the disk, would be saturated.
Q4Which operating system type guarantees a maximum response time?
Correct answer: B — Real-time
A real-time OS is used where a late response is as dangerous as a wrong one — patient monitors, vehicle control, industrial machinery.
Q5File permissions typically control:
Correct answer: B — read, write and execute rights
Each is granted separately to the owner, a group and everyone else, which is how a system lets some users read a file while preventing them from changing it.
Q6Emptying the recycle bin means the data is:
Correct answer: B — still on the disk until overwritten
Only the index entry is removed. Recovery software can retrieve the contents, which is why a disk being sold must be securely wiped.
Q7Virtual memory addressing allows the OS to:
Correct answer: B — give each program a private address space mapped onto real RAM
Programs are written without knowing where they will sit in memory, and the mapping is what prevents one program from reading another's data.
Q8Adding RAM helps a heavily paging machine more than a faster SSD because it:
Correct answer: A — removes the need to page at all
A faster disk shortens each swap; more RAM means the swap never has to happen. Removing the cause beats reducing the symptom.
Q9An interpreter differs from a compiler in that it:
Correct answer: B — translates and runs one statement at a time
It translates as it executes and produces no output file, which is why it must be present every time the program runs.
Q10Which stage removes comments and whitespace?
Correct answer: B — lexical analysis
Lexical analysis breaks the source into tokens, discarding anything the later stages do not need.
Q11A missing closing bracket would be reported during:
Correct answer: B — syntax analysis
It breaks the grammar of the language, which is exactly what syntax analysis checks.
Q12Using a variable that was never declared is caught during:
Correct answer: C — semantic analysis
The statement can be grammatically perfect while still being meaningless, which is what semantic analysis tests for.
Q13Which translator must be present every time the program runs?
Correct answer: C — interpreter
An interpreter translates during execution, so it is required each run. A compiled executable is independent of its compiler.
Q14The main advantage of bytecode is:
Correct answer: B — it is portable across platforms
One compiled file runs anywhere a suitable virtual machine exists. It is slightly slower than native machine code, not faster.
Q15A compiler is usually preferred for released software because:
Correct answer: B — the executable runs faster and hides the source
Translation has already happened, so it runs faster, and only the executable is distributed rather than the source code.
Q16Optimisation during compilation aims to:
Correct answer: B — produce faster or smaller code
It improves the generated code. Error finding and tokenising belong to earlier stages.
The core of the OS, permanently resident in memory, which manages the CPU, memory and devices and controls access to them. Other parts of the OS such as the user interface can be restarted or replaced; the kernel cannot.
Through time-slicing: the operating system gives each program a few milliseconds of CPU time in turn and switches between them far faster than a person can perceive. Only one instruction is ever executing, so the simultaneity is an illusion.
Any program that runs inherits the permissions of the account that started it. Malware launched from an administrator account can therefore alter system files and install itself permanently, whereas the same malware run from a standard account is confined to that user's own files.
Process, memory, file and device management — plus security and the user interface.
RAM is full and the OS is paging to disk. Close programs, or add RAM.
(a) multi-tasking for the office, real-time for the monitor (b) a guaranteed maximum response time (c) separate read and write rights per group
A compiler translates the whole program before it runs and produces an executable file, whereas an interpreter translates and executes one statement at a time and produces no file. A compiler also reports all errors together at the end, while an interpreter halts at the first error it meets.
Lexical analysis breaks the source into tokens, removes comments and whitespace, and builds the symbol table. Syntax analysis checks that the sequence of tokens obeys the grammar of the language, building a parse tree and reporting errors such as a missing bracket.
Semantic analysis. The statement is grammatically well-formed, so it passes syntax analysis, but it is meaningless because a string cannot be added to an integer and assigned to an integer variable — a type mismatch.
(a) fast feedback vs speed and privacy; (b) faster or smaller code; (c) portable intermediate form
In assembly language each mnemonic corresponds to exactly one machine instruction, so translation is largely a matter of substituting opcodes and resolving addresses. A compiler must translate high-level statements that may each become many machine instructions, and must also perform syntax, semantic and optimisation work.
Q1Malware 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.
Q2Malware 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.
Q3The 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.
Q4Pharming 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.
Q5A 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.
Q6A 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.
Q7Two-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.
Q8The 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.
Q9Encryption 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.
Q10In 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.
Q11The 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.
Q12A 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.
Q13Encryption 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.
Q14Real 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.
Q15Adding 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.
Q16Entering 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.
Q17Under 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.
Q18A 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.
Q19Which 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.
Q20A 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.
Q21A 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.
Q22In 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.
Q23An 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.
Q24Attenuation 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.
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
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
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
Q1Selling users' data in a way disclosed only in clause 47 of long terms is:
Correct answer: B — possibly legal but ethically questionable
Disclosure in the terms may satisfy the law, but consent buried where nobody reads it is not meaningful agreement — the distinction between legal and ethical is exactly the point.
Q2The most reliable defence against ransomware is:
Correct answer: C — offline backups
A disconnected backup cannot be encrypted, so files can be restored without paying. Paying is unreliable — there is no guarantee a key is supplied.
Q3Phishing works primarily by attacking:
Correct answer: C — the person
It relies on deceiving a human into handing over credentials. No software vulnerability is required, which is why training matters as much as technical defences.
Q4Data minimisation means:
Correct answer: B — collecting only what is needed for the stated purpose
It is a privacy principle, not a storage technique. Data never collected cannot be leaked, misused or stolen.
Q5Copyright on a piece of software:
Correct answer: B — exists automatically when the work is created
Copyright arises automatically on creation. A licence is separate — it states what others are permitted to do with the copyrighted work.
Q6Two-factor authentication protects against:
Correct answer: A — a stolen password being enough to log in
Even with the correct password, an attacker still needs the second factor — typically a code on the owner's phone.
Q7The digital divide describes:
Correct answer: B — the gap between those with and without access to technology
It is about access to devices, connectivity and skills. It matters most when essential services move online and assume everyone can reach them.
Q8Using an image from the internet in your own published work without permission is:
Correct answer: B — copyright infringement unless licensed or permitted
The image is copyrighted from the moment it was created. Altering it slightly does not create a new work you own, and "it was on the internet" is not a licence.
A legal issue concerns what the law permits — for example copying licensed software without paying, which breaches copyright. An ethical issue concerns what is right regardless of the law — for example a company legally selling users' browsing histories to advertisers without making that clear.
Phishing is an attempt to obtain personal information such as passwords by sending a message that imitates a trusted organisation. Recognise it by checking the sender's actual address and the real destination of any link, and by treating urgency — "your account will be closed today" — as a warning sign rather than a reason to hurry.
The digital divide is the gap between people who have reliable access to computers and the internet and those who do not — whether because of cost, location, or lack of skills. It matters because as services move online, those without access are excluded from them.
Minimise, use only for the stated purpose, keep secure and accurate, and delete when done.
It encrypts files and demands payment; only a disconnected backup is out of its reach.
(a) probably legal but ethically poor (b) plain language, in advance, a genuine choice (c) stalking or burglary from routine data; blackmail or discrimination
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.
Q9Which design stage depends on the DBMS chosen?
Correct answer: C — Physical
Data types, indexes and storage differ between products. The conceptual and logical designs are deliberately product-independent.
Q10In a description, nouns are most likely to be:
Correct answer: B — entities and attributes
Nouns name things; verbs describe how they relate. Sorting nouns into entities and attributes is the next step.
Q11"One student takes many subjects; one subject has many students" is:
Correct answer: C — M:N
Both directions are "many", so it is many-to-many and requires a linking table.
Q12"One doctor has many appointments; one appointment has one doctor" is:
Correct answer: B — 1:M
One direction is many and the other is one. This becomes a foreign key on the appointment table.
Q13An M:N relationship requires:
Correct answer: B — a linking table
A field can hold only one value, so neither side can reference many rows on the other. The linking table turns it into two 1:M relationships.
Q14A noun should be modelled as an entity when it:
Correct answer: B — has properties of its own to store
If the only thing you store about it is the value itself, it is an attribute. If it has its own attributes, it needs its own table.
Q15The date of an appointment belongs in:
Correct answer: C — the APPOINTMENT table
It describes that meeting, not the patient or the doctor, both of whom have many appointments on different dates.
Q16Designing directly in the software rather than on paper usually leads to:
Correct answer: B — a structure that becomes hard to change
Decisions get made implicitly and are then embedded in forms, queries and reports. Changing the structure afterwards means changing all of them.
Q17A rule that a mark must be between 0 and 100 is a:
Correct answer: B — range check
It tests whether the value lies within allowed limits, which is exactly what a range check does.
Q18A date of birth typed as 1995 instead of 1985 would be caught by:
Correct answer: B — verification
1995 is a perfectly reasonable date, so it passes every validation rule. Only checking it against the source — verification — reveals the error.
Q19Preventing a class from being deleted while students still refer to it is:
Correct answer: B — referential integrity
Referential integrity ensures foreign keys always point at records that exist, so deleting the referenced record is refused or cascaded.
Q20A table with a column holding "Maths, Physics" is not in:
Correct answer: A — 1NF
A cell containing more than one value is a repeating group, which 1NF forbids. Later forms cannot even be assessed until this is fixed.
Q21A dependency on part of a composite key is a:
Correct answer: B — partial dependency
Partial dependencies are removed at 2NF. They can only exist where the primary key is made of more than one field.
Q22In STUDENT(RollNo, Name, ClassID, ClassTeacher), ClassTeacher depending on ClassID is a:
Correct answer: B — transitive dependency
RollNo → ClassID → ClassTeacher is a chain through a non-key field, which 3NF removes by splitting out a CLASS table.
Q23Having to change a customer name in fifty rows is an:
Correct answer: C — update anomaly
One fact stored in fifty places means fifty edits, and missing one leaves the database holding two different names for the same customer.
Q24One genuine cost of normalising a database is:
Correct answer: B — queries need joins across more tables
Normalisation reduces storage and removes inconsistency. What it costs is query complexity — assembling a full record now means joining several tables.
Q25CREATE TABLE is an example of:
Correct answer: B — DDL
It defines structure rather than manipulating data, so it belongs to the Data Definition Language.
Q26Which clause filters rows before any grouping takes place?
Correct answer: B — WHERE
WHERE is applied to individual rows first. HAVING acts on groups after aggregation.
Q27To show only groups whose total exceeds 100, you use:
Correct answer: B — HAVING SUM(x) > 100
A condition on an aggregate must come after grouping, which is what HAVING does.
Q28Which is NOT an aggregate function?
Correct answer: C — ORDER
ORDER BY sorts the output; it does not compute a value across a group.
Q29UPDATE Employee SET Salary = 0; will:
Correct answer: C — change every row
With no WHERE clause every row matches, so the whole table is updated. This is the classic destructive mistake.
Q30DROP TABLE Student differs from DELETE FROM Student because it:
Correct answer: B — removes the table structure as well
DELETE empties the table but leaves it usable; DROP removes the table entirely.
Q31A FOREIGN KEY constraint ensures that:
Correct answer: B — a referenced row actually exists
It enforces referential integrity, preventing a reference to a key that is not present in the other table.
Q32WHERE Surname LIKE 'Kh%' matches:
Correct answer: C — anything starting with Kh
The % wildcard stands for any sequence of characters following, so the pattern anchors at the start.
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
Conceptual design — identifying entities, attributes and relationships. Logical design — converting these to tables with keys and normalising them. Physical design — choosing data types, indexes and storage for the particular DBMS.
A noun with properties of its own that must be stored is an entity and becomes a table. A noun that is simply a single property of something else is an attribute and becomes a field. "Address" is usually an attribute of a customer, but becomes an entity if the system must store a district, postcode and access notes for each one.
The number of records on each side of a relationship that may be associated with one record on the other — written 1:1, 1:M or M:N. It determines the table structure, since a 1:M becomes a foreign key while an M:N requires an additional linking table.
TITLE and PUBLISHER, in a 1:M relationship, with PublisherID as a foreign key in TITLE.
A field holds one value, so a linking table with both foreign keys is required, giving two 1:M relationships.
(a) MEMBER, CLASS, INSTRUCTOR (b) instructor–class 1:M, member–class M:N (c) four tables, with ATTENDANCE linking members to classes
Validation is an automatic check that entered data is reasonable — within range, of the right type, in the right format. Verification checks that the data was entered correctly, for example by double entry or by reading it back. A date typed as 1995 instead of 1985 passes validation but fails verification.
The rule that a foreign key must either be empty or match an existing primary key in the related table. It prevents orphaned records — a student enrolled in a class that does not exist, or left pointing at a class after it is deleted.
It contains no repeating groups — every cell holds a single, indivisible value, and there are no columns such as Subject1, Subject2, Subject3. Every record is also uniquely identifiable by a primary key.
Insertion, deletion and update anomalies, all caused by storing a fact in more than one row.
A transitive dependency; split into STUDENT and CLASS tables.
(a) redundancy and update anomalies (b) MEMBER, BOOK and LOAN (c) single-point updates, at the cost of joins
DDL defines or alters the structure of the database — for example CREATE TABLE. DML operates on the data held in the rows — for example SELECT or INSERT.
WHERE is applied to individual rows before grouping, so at that point no counting has taken place and there is nothing to compare. A condition on an aggregate must appear in a HAVING clause, which is applied to the groups after aggregation.
CREATE TABLE Book (ISBN VARCHAR(13) PRIMARY KEY, Title VARCHAR(100) NOT NULL, YearPublished INTEGER);
(a) WHERE + ORDER BY; (b) JOIN + GROUP BY; (c) HAVING; (d) every row is changed
DELETE FROM Student; removes every row but leaves the table structure in place, so it can still be used. DROP TABLE Student; removes the table itself — structure and data — so it no longer exists.
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]Q1All the details of one student form a:
Correct answer: B — record
A record is every field describing one entity. A field is one of those items; a table is many records.
Q2A student's roll number should be stored as:
Correct answer: B — text
No arithmetic is done on a roll number, and it may have leading zeros or letters. The test is always whether you would ever add two of them.
Q3The same address stored in three files is an example of:
Correct answer: B — data redundancy
Redundancy is duplication. Its dangerous consequence is inconsistency, when the copies stop agreeing.
Q4Which is the most serious consequence of redundancy?
Correct answer: B — inconsistent conflicting values
Storage is cheap. Conflicting values mean no report can be trusted, because there is no way to tell which copy is correct.
Q5Data dependence means:
Correct answer: B — programs contain the file structure, so structural changes require rewriting them
Each program embeds the layout of the file it reads, so adding a single field means editing and retesting every one of them.
Q6A price of Rs 249.99 is best stored as:
Correct answer: C — currency or decimal
It has a fractional part and arithmetic will be done on it. A currency or fixed-decimal type also avoids the rounding errors a floating-point type can introduce in money.
Q7Storing a date as text causes problems because:
Correct answer: B — it sorts alphabetically rather than chronologically
As text, "01/12/2025" sorts before "02/01/2024", so the system cannot determine which date came first or calculate an interval.
Q8A database centralises data, which means an incorrectly typed address is now:
Correct answer: B — wrong in every system at once
Centralisation removes inconsistency but also removes the accidental second opinion. Validation at the point of entry becomes more important, not less.
Q9Why 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.
Q10You 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.
Q11A 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.
Q12An 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.
Q13Inserting 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.
Q14Breadth-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.
Q15Opening 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.
Q16To 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.
Q17fopen 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.
Q18Which 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.
Q19while (!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.
Q20The 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.
Q21Omitting 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.
Q22A 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.
A field is a single item of data, such as a student's name. A record is the complete set of fields describing one entity — all the details of one student. A table is a collection of records of the same type.
A numeric type would discard a leading zero, could not store spaces or dashes, and might round the value. No arithmetic is ever performed on a telephone number, so nothing is gained by making it numeric.
Redundancy is the same data stored in more than one place. Inconsistency is what happens when one copy is updated and another is not, so the system holds conflicting values. Redundancy wastes storage, which is cheap; inconsistency means no report can be trusted, because there is no way to tell which copy is correct.
Redundancy, inconsistency, data dependence, and poor security or difficult queries.
Text, integer, currency, date — each justified by what will be done with it.
(a) redundancy and inconsistency (b) one stored copy, seen by all, with per-table permissions (c) it cannot prevent wrong data being entered — and now the error is everywhere
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
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.
Q17In int square(int n) called as square(4), the argument is:
Correct answer: B — 4
4 is the actual value supplied at the call. n is the parameter that receives it.
Q18C passes arguments to functions:
Correct answer: B — by value
The function receives a copy, which is why changing a parameter leaves the caller's variable untouched.
Q19void f(int x) { x = 99; } called with f(a) where a is 5 leaves a as:
Correct answer: B — 5
x is a copy. Assigning to it changes only that copy, which is discarded when the function returns.
Q20To let a function modify the caller's variable you pass:
Correct answer: B — the address
The address gives the function a route back to the original storage, which is exactly what the & in scanf provides.
Q21A function prototype is placed:
Correct answer: B — before main
It must appear before any call, and C reads the file from the top, so above main is the conventional place.
Q22A variable declared inside a function is:
Correct answer: B — local, existing only during the call
It is created when the function starts and destroyed when it returns, which is what keeps functions independent of each other.
Q23Global variables are discouraged because:
Correct answer: B — any function can change them, making faults hard to trace
When a global holds a wrong value, the culprit could be any function in the program. Parameters and return values keep the effects visible.
Q24A recursive function without a base case will:
Correct answer: B — run until memory is exhausted
Each call makes another, and every one consumes stack space. Eventually the stack overflows and the program crashes.
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
Reusability — code written once can be called many times, so a correction is made in one place. Testability and readability — each function can be understood and tested on its own, and a long program becomes a set of short comprehensible pieces.
A parameter is the variable named in the function definition, which receives a value. An argument is the actual value supplied at the point of call. In square(6) calling int square(int n), n is the parameter and 6 is the argument.
C processes a file from top to bottom, so a function called before its definition appears has not yet been seen by the compiler. A prototype placed above main declares the name, return type and parameter types in advance, allowing the call to be checked.
int larger(int a, int b) { — correct return type and two int parameters[1] if (a > b) return a;[1] else return b; }every path must return a value[1]int max = larger(7, 3); with the returned value stored or usedcalling it without using the result wastes it[1]int larger(int a, int b) with an if-else returning a or b, called as larger(7, 3).
&, and declare the parameter as a pointer[1]*, reaching the caller's variable — which is exactly what scanf doesthe scanf connection earns the mark[1]Pass by value means the function gets a copy. Pass the address instead and write through the pointer.
#define PI 3.14159 or const float PI = 3.14159;[1]float area(float r) { return PI * r * r; }float return type and parameter[1](a) float area(float r) returning PI * r * r (b) local for working values; parameters for input (c) an error, or in older C a silent wrong result from an assumed int return
Q1Which stage is most often skipped and most expensive to skip?
Correct answer: B — Requirements gathering
Skipping it means building the wrong thing correctly, and the error surfaces only at the end when change costs most.
Q2"The report must be produced within five seconds" is:
Correct answer: B — a non-functional requirement
It describes how well the system performs, not what it does. It is also testable, which is what makes it a good non-functional requirement.
Q3The waterfall model is best suited to projects where:
Correct answer: B — requirements are stable and well understood
Its sequential structure only works if the early decisions hold. Changing requirements are exactly what it handles badly.
Q4Integration testing checks:
Correct answer: B — that separate units work together
Units that pass individually frequently fail when combined, because each made assumptions about the others. That is where most faults appear.
Q5For a field accepting 1 to 100, boundary test data would be:
Correct answer: B — 1, 100, 0 and 101
Boundary testing uses the limits and the values immediately outside them, which is where off-by-one errors live. Option A is normal data and letters are erroneous data.
Q6Acceptance testing is carried out by:
Correct answer: B — the customer
It decides whether the system meets what the customer meant, and a developer testing their own interpretation cannot detect a misinterpretation.
Q7Passing all tests means the software is:
Correct answer: B — free of known faults, but not proved correct
Testing can show the presence of faults but never their absence. A program may pass every test written and still fail on the case nobody thought of.
Q8Maintenance in the life cycle refers to:
Correct answer: B — fixing, adapting and improving the system after deployment
It typically consumes more of a system's total cost than the original development, because software must keep changing as the world it serves changes.
Requirements gathering, analysis, design, implementation, testing, deployment and maintenance. Different models order or repeat them differently, but these are the stages every project passes through.
A functional requirement states what the system must do — "the system shall calculate each student's attendance percentage". A non-functional requirement states how well it must do it — "each report shall be produced within five seconds".
By deployment the fault is embedded in written code that other parts depend on, users have been trained on the incorrect behaviour, and any damage it caused must also be repaired. During design it costs only a change to a document before anything was built on it.
Sequential and documented against cyclic and adaptable; waterfall for stable requirements, iterative for uncertain ones.
Normal 12; boundary 8, 16, 7, 17; erroneous empty.
(a) interviews for needs, observation for the unspoken exceptions (b) attendance percentage; report within five seconds (c) only the customer can say whether it does what they meant
Q1In floating-point representation, the exponent determines the:
Correct answer: B — range
The exponent says how far the binary point shifts, setting how large or small a value can be. Precision comes from the mantissa.
Q2For a fixed word length, giving more bits to the mantissa:
Correct answer: B — increases precision and decreases range
The bits have to come from the exponent, so precision improves while range shrinks. The trade-off cannot be avoided.
Q3Which mantissa is correctly normalised for a positive number?
Correct answer: B — 0.1011
A positive normalised mantissa begins 0.1. The third option is a normalised negative; the others are unnormalised.
Q4A negative normalised mantissa begins:
Correct answer: B — 1.0
The sign bit is 1 and the next bit must differ from it, so it is 0.
Q5Shifting a mantissa left by two places requires the exponent to:
Correct answer: B — decrease by 2
Each left shift multiplies the mantissa by 2, so the exponent must fall by one per shift to preserve the value.
Q60.1 cannot be stored exactly in binary because:
Correct answer: B — its denominator is not a power of two
Binary fractions terminate only for denominators that are powers of two. One tenth recurs forever.
Q7Two floating-point values should be compared by:
Correct answer: B — checking the difference is below a tolerance
Stored values are approximations, so numbers that should match may differ in their final bits. A tolerance test handles that.
Q8A value too close to zero to be represented causes:
Correct answer: B — underflow
Underflow is the small-magnitude case; overflow is when a value is too large for the exponent.
Precision increases, because more significant bits are stored. Range decreases, because fewer bits remain for the exponent, so the binary point cannot be shifted as far.
The first two bits of the mantissa must differ. A positive normalised number begins 0.1; a negative one begins 1.0.
Mantissa 0.110100, exponent 0010
(a) recurring binary, truncated; (b) accumulating drift; (c) compare against a tolerance; (d) too large / too small
It removes leading zeros (or leading ones for negatives) from the mantissa, so no bits are wasted and the maximum precision is retained for a given word length. It also gives each value a unique representation, which makes comparison and arithmetic straightforward.
Q1Data 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.
Q2Which 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.
Q3A 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.
Q4The 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.
Q5In 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.
Q6TCP 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.
Q7Which 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.
Q8Serial 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.
Q9Skew 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.
Q10A 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.
Q11A 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.
Q12If 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.
Q13USB 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.
Q14Parallel 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.
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.
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
Q1In the von Neumann architecture, programs and data are:
Correct answer: B — stored in the same memory
Sharing one memory is the defining feature, and it is what allows a machine to be reprogrammed by loading different data.
Q2The program counter holds:
Correct answer: B — the address of the next instruction
It holds an address, not an instruction — and the address of the next one, which is why it can be incremented early.
Q3During the fetch stage, the instruction is copied from the MDR into the:
Correct answer: C — CIR
The current instruction register holds the instruction while the control unit decodes it.
Q4The address bus is unidirectional because:
Correct answer: B — only the processor generates addresses
Memory never sends an address back to the processor, so there is no need for the bus to run both ways.
Q5The von Neumann bottleneck arises because:
Correct answer: B — instructions and data share one bus
Sharing a single bus means instruction fetches and data transfers cannot happen simultaneously.
Q6A single-threaded program on a quad-core processor runs:
Correct answer: B — at about the same speed
Extra cores only help when the software divides its work between them. A single thread uses one core.
Q7A graphics processor applying the same operation to millions of pixels is an example of:
Correct answer: B — SIMD
One instruction is applied to many data items simultaneously — Single Instruction, Multiple Data.
Q8A disadvantage of running software in a virtual machine is:
Correct answer: B — reduced performance from the extra layer
Isolation and easy backup are advantages. The cost is that everything passes through an additional software layer.
Q9In Boolean algebra, A + A equals:
Correct answer: B — A
The idempotent law. Variables hold only 0 or 1, so there is nothing to accumulate — unlike ordinary algebra.
Q10(A · B)‾ is equivalent to:
Correct answer: B — Ā + B̄
De Morgan: break the bar and change the AND to an OR.
Q11Karnaugh map headings use Gray code so that adjacent cells:
Correct answer: B — differ in exactly one variable
Single-variable adjacency is what allows a variable to be eliminated when cells are grouped.
Q12A valid Karnaugh map group may contain:
Correct answer: B — only powers of two
Groups must be 1, 2, 4, 8 … cells and rectangular. A group of three cannot eliminate a variable cleanly.
Q13A group of 4 cells on a K-map eliminates how many variables?
Correct answer: B — 2
Each doubling of the group size removes one more variable, so 4 cells remove two.
Q14The four corner cells of a 4×4 Karnaugh map:
Correct answer: B — form a valid group of 4
The map wraps in both directions, so the corners are all adjacent to one another.
Q15A + Ā·B simplifies to:
Correct answer: C — A + B
Expanding gives (A + Ā)(A + B) = 1·(A + B) = A + B.
Q16NAND is functionally complete, which means:
Correct answer: B — any circuit can be built from NAND gates alone
NOT, AND and OR can all be constructed from NAND gates, so anything at all can be. NOR shares this property.
In the von Neumann architecture, program instructions and data are held in the same memory and travel over the same bus. The limitation is the von Neumann bottleneck: instructions and data cannot be transferred simultaneously, so the processor is often left waiting for memory.
The address in the PC is copied to the MAR. The PC is then incremented. The contents of the memory location addressed by the MAR are read into the MDR, and from there the instruction is copied into the CIR ready for decoding.
A jump instruction writes a new address into the PC during execution. If the increment happened afterwards, that new address would be increased by one and the jump would land at the wrong instruction. Incrementing during the fetch means a jump can simply overwrite the PC and execution continues correctly.
(a) address one-way, data two-way; (b) fewer slow memory accesses; (c) single-threaded; (d) isolation vs overhead
SIMD applies a single instruction to multiple data items at the same time — used by graphics processors operating on many pixels identically. MIMD executes different instructions on different data simultaneously — used by multi-core processors running separate tasks.
(A · B)‾ = Ā + B̄ and (A + B)‾ = Ā · B̄. In words: break the bar and change the operation between the terms.
This is Gray code order, in which adjacent headings differ in exactly one variable. That adjacency is what makes grouping valid: within a group only one variable changes, so it can be eliminated. With ordinary binary order, neighbouring cells would differ in two variables and grouping would not simplify correctly.
Groups must contain a number of cells that is a power of two (1, 2, 4, 8…); groups must be rectangular and as large as possible; groups may overlap, and the map wraps round so opposite edges are adjacent.
(a) A; (b) A + B; (c) any circuit from one gate type; NAND(A,A) = NOT A
A simpler expression needs fewer gates, which makes the circuit cheaper to manufacture, smaller, and lower in power consumption. Fewer gates in a signal path also means less propagation delay, so the circuit runs faster.
Q1The always-resident core of an operating system is called the:
Correct answer: B — kernel
The kernel manages the CPU, memory and devices and stays in memory throughout. The shell is the user interface and can be replaced.
Q2Twenty programs appear to run at once on one core because the OS:
Correct answer: B — switches between them very quickly
Time-slicing gives each a few milliseconds in turn. Only one instruction actually executes at any moment.
Q3A slow machine with constant disk activity most likely indicates:
Correct answer: B — RAM is full and the OS is paging
The disk is busy because memory pages are being written out and read back. If the CPU were the bottleneck the processor, not the disk, would be saturated.
Q4Which operating system type guarantees a maximum response time?
Correct answer: B — Real-time
A real-time OS is used where a late response is as dangerous as a wrong one — patient monitors, vehicle control, industrial machinery.
Q5File permissions typically control:
Correct answer: B — read, write and execute rights
Each is granted separately to the owner, a group and everyone else, which is how a system lets some users read a file while preventing them from changing it.
Q6Emptying the recycle bin means the data is:
Correct answer: B — still on the disk until overwritten
Only the index entry is removed. Recovery software can retrieve the contents, which is why a disk being sold must be securely wiped.
Q7Virtual memory addressing allows the OS to:
Correct answer: B — give each program a private address space mapped onto real RAM
Programs are written without knowing where they will sit in memory, and the mapping is what prevents one program from reading another's data.
Q8Adding RAM helps a heavily paging machine more than a faster SSD because it:
Correct answer: A — removes the need to page at all
A faster disk shortens each swap; more RAM means the swap never has to happen. Removing the cause beats reducing the symptom.
Q9An interpreter differs from a compiler in that it:
Correct answer: B — translates and runs one statement at a time
It translates as it executes and produces no output file, which is why it must be present every time the program runs.
Q10Which stage removes comments and whitespace?
Correct answer: B — lexical analysis
Lexical analysis breaks the source into tokens, discarding anything the later stages do not need.
Q11A missing closing bracket would be reported during:
Correct answer: B — syntax analysis
It breaks the grammar of the language, which is exactly what syntax analysis checks.
Q12Using a variable that was never declared is caught during:
Correct answer: C — semantic analysis
The statement can be grammatically perfect while still being meaningless, which is what semantic analysis tests for.
Q13Which translator must be present every time the program runs?
Correct answer: C — interpreter
An interpreter translates during execution, so it is required each run. A compiled executable is independent of its compiler.
Q14The main advantage of bytecode is:
Correct answer: B — it is portable across platforms
One compiled file runs anywhere a suitable virtual machine exists. It is slightly slower than native machine code, not faster.
Q15A compiler is usually preferred for released software because:
Correct answer: B — the executable runs faster and hides the source
Translation has already happened, so it runs faster, and only the executable is distributed rather than the source code.
Q16Optimisation during compilation aims to:
Correct answer: B — produce faster or smaller code
It improves the generated code. Error finding and tokenising belong to earlier stages.
The core of the OS, permanently resident in memory, which manages the CPU, memory and devices and controls access to them. Other parts of the OS such as the user interface can be restarted or replaced; the kernel cannot.
Through time-slicing: the operating system gives each program a few milliseconds of CPU time in turn and switches between them far faster than a person can perceive. Only one instruction is ever executing, so the simultaneity is an illusion.
Any program that runs inherits the permissions of the account that started it. Malware launched from an administrator account can therefore alter system files and install itself permanently, whereas the same malware run from a standard account is confined to that user's own files.
Process, memory, file and device management — plus security and the user interface.
RAM is full and the OS is paging to disk. Close programs, or add RAM.
(a) multi-tasking for the office, real-time for the monitor (b) a guaranteed maximum response time (c) separate read and write rights per group
A compiler translates the whole program before it runs and produces an executable file, whereas an interpreter translates and executes one statement at a time and produces no file. A compiler also reports all errors together at the end, while an interpreter halts at the first error it meets.
Lexical analysis breaks the source into tokens, removes comments and whitespace, and builds the symbol table. Syntax analysis checks that the sequence of tokens obeys the grammar of the language, building a parse tree and reporting errors such as a missing bracket.
Semantic analysis. The statement is grammatically well-formed, so it passes syntax analysis, but it is meaningless because a string cannot be added to an integer and assigned to an integer variable — a type mismatch.
(a) fast feedback vs speed and privacy; (b) faster or smaller code; (c) portable intermediate form
In assembly language each mnemonic corresponds to exactly one machine instruction, so translation is largely a matter of substituting opcodes and resolving addresses. A compiler must translate high-level statements that may each become many machine instructions, and must also perform syntax, semantic and optimisation work.
Q1Encryption 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.
Q2In 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.
Q3The 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.
Q4A 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.
Q5Encryption 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.
Q6Real 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.
Q7Adding 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.
Q8Entering 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.
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
Q1In 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.
Q2Training 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.
Q3Grouping 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.
Q4A 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.
Q5Algorithmic 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.
Q6The 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.
Q7The "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.
Q8Reinforcement 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.
Q9AI is best suited to tasks involving:
Correct answer: B — finding patterns in large amounts of data
That single capability underlies every successful application. The other three are precisely where these systems are weakest.
Q10Using AI to flag scans for a radiologist to review is an example of:
Correct answer: B — triage
The system sorts by likely urgency and the human still decides, so its errors are caught while the speed benefit is kept.
Q11A legitimate transaction blocked by a fraud system is a:
Correct answer: B — false positive
The system positively identified fraud where there was none. A false negative would be real fraud allowed through.
Q12A model trained on data from one country may fail elsewhere because:
Correct answer: B — the population it learned from differs from the one it is used on
A model reproduces patterns from its training data. If the new population differs in ways that matter, those patterns may not hold.
Q13The strongest argument against fully automating a benefits decision is:
Correct answer: B — the applicant could not be told why they were refused
A consequential decision affecting a person requires a reason they can understand and challenge. Speed and consistency do not compensate for its absence.
Q14Deskilling means:
Correct answer: B — a skill is lost because it is always automated
A capability nobody exercises eventually disappears, which matters most at the moment the automated system fails and someone must step in.
Q15Which is a genuine environmental cost of AI?
Correct answer: B — the electricity used to train large models
Training a large model consumes a substantial amount of electricity, which is an increasingly common point in exam answers about drawbacks.
Q16When AI applies the same rule to every applicant, the benefit is:
Correct answer: B — consistency
Human assessors vary between themselves and across a working day. Consistency is a real advantage — though it also means a flawed rule is applied uniformly to everyone.
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
AI can analyse medical images such as chest X-rays and flag those most likely to show disease, so a radiologist reviews the urgent cases first. The benefit is speed and consistency: it works continuously without fatigue, letting a small number of specialists cover a large population.
It usually cannot explain how it reached a decision, so a person affected cannot be told why. And it reproduces the biases in its training data while appearing objective, which can make unfair outcomes harder to challenge.
A farmer can photograph an affected leaf with a phone and a model identifies the crop disease and suggests treatment. This reaches farms that an agricultural extension officer could not visit often enough, and gives an answer within seconds rather than days.
Benefits: no fatigue or distraction, and mobility for non-drivers. Risks: unfamiliar situations, and unclear liability.
The volume and the pattern-matching suit AI; the cost is blocked legitimate transactions with no explanation.
(a) speed and consistency (b) inherited bias and no explanation (c) AI prioritises, humans decide — keeping the benefit and the accountability
Q1An 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).
Q2Binary 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.
Q3Which 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.
Q4Quicksort 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.
Q5Why 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.
Q6Two 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.
Q7A recursive routine must always contain:
Correct answer: B — a base case
The base case is what allows the recursion to stop. Without it the calls never end.
Q8A recursive function with no base case will:
Correct answer: B — cause a stack overflow
Every call pushes a frame and none ever returns, so the stack memory is exhausted.
Q9A stack frame stores:
Correct answer: B — the return address, parameters and local variables
It holds everything needed to resume the suspended call once the deeper one returns.
Q10For F(n) = n × F(n−1) with F(1) = 1, calling F(4) pushes how many frames?
Correct answer: C — 4
Frames are pushed for F(4), F(3), F(2) and F(1) — four in total. 24 is the result, not the depth.
Q11During recursion, calculations happen:
Correct answer: B — on the way back up after the base case
Each call is suspended at the recursive call. The work is completed as the frames are popped.
Q12Recursive calls complete in which order?
Correct answer: B — last in, first out
The stack is LIFO, so the most recently pushed frame is the first to be popped and completed.
Q13The main disadvantage of recursion compared with iteration is:
Correct answer: B — it uses more memory for stack frames
Anything recursive can be written iteratively; the cost is one stack frame per level of depth.
Q14Recursion is most naturally suited to:
Correct answer: B — traversing a tree
A tree is itself defined recursively, so a recursive traversal matches the structure. Simple repetition is better served by a loop.
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]It must have a base case that returns a value without calling itself, and each recursive call must make progress towards that base case — typically by reducing the parameter.
Each call pushes a stack frame containing the return address, the parameters and any local variables, so the suspended call can be resumed. Frames accumulate as the recursion descends. When the base case returns, the frames are popped in reverse order — last in, first out — with each completing its calculation as it goes.
It calls itself indefinitely, pushing a new stack frame each time and never returning. The stack eventually runs out of memory and the program terminates with a stack overflow error.
(a) S(1)=1 and S(n)=n+S(n−1); (b) S(5) = 15; (c) clarity vs stack memory
Recursion is preferable for recursive data structures such as traversing a tree, or for divide-and-conquer algorithms like quicksort, where an iterative version would need an explicit stack of its own. Iteration is preferable for simple repetition such as summing a list, where recursion would waste memory on stack frames for no gain in clarity.
Q1SQL is an example of which paradigm?
Correct answer: B — declarative
A query states the result required without describing how to obtain it — the defining feature of declarative programming.
Q2Encapsulation means:
Correct answer: B — bundling data with its methods and restricting access
The data is kept private so every change goes through a method that can validate it.
Q3The same method call producing different behaviour on different object types is:
Correct answer: C — polymorphism
Polymorphism resolves the call according to the actual type of the object receiving it.
Q4A subclass gaining the members of a superclass is:
Correct answer: B — inheritance
Inheritance lets shared behaviour be written once in the superclass and reused by every subclass.
Q5Code that must run whether or not an exception occurred belongs in:
Correct answer: C — FINALLY
FINALLY executes on both paths, which is why resource cleanup such as closing a file belongs there.
Q6Catching all exceptions in one generic handler is poor practice because it:
Correct answer: B — can hide genuine bugs and loses specificity
Different errors deserve different responses, and an unexpected error gets silently swallowed rather than noticed.
Q7Which paradigm would suit writing a device driver?
Correct answer: B — low-level
Direct access to hardware registers and precise timing control are required, which higher-level paradigms deliberately abstract away.
Q8An advantage of exception handling over checking every operation with an if is that:
Correct answer: B — the normal logic stays readable
The error path is separated from the main flow, so the normal logic is not interrupted by a check after every statement.
Q9What is the difference between a class and an object?
Correct answer: B — A class is a blueprint; an object is one instance built from it
The class defines the structure and behaviour once. Each object created from it gets its own copy of the data. One Student class can produce a thousand student objects, each with different names and marks.
Q10Why make a field private and expose it through methods?
Correct answer: B — It lets the class validate every change and protect its own invariants
That is encapsulation. If balance can only change through withdraw(), you have exactly one place to enforce "never go below zero". A public field can be corrupted from anywhere, and finding the culprit later is painful.
Q11Circle and Rectangle both extend Shape and both define area(). This is:
Correct answer: B — Polymorphism
Polymorphism means "many forms": one method name resolving to different implementations depending on the actual object type. It is what lets a single loop over a mixed list of shapes call area() on each without checking what type it is.
Q12Which relationship is better modelled by composition than inheritance?
Correct answer: B — A Car has an Engine
A car is not a kind of engine — it contains one. Inheritance expresses "is a", composition expresses "has a". Using inheritance for a has-a relationship produces classes that inherit members that make no sense for them.
Q13What is the main benefit of abstraction?
Correct answer: B — Callers depend on what a class does, not how, so internals can change safely
Abstraction draws a line between interface and implementation. As long as the public methods keep their promises, you can rewrite the internals completely and every caller keeps working — which is what makes large codebases maintainable.
Q14A subclass provides its own version of a method that already exists in its parent. This is called:
Correct answer: B — Overriding
Overriding replaces the inherited behaviour with the subclass's own, using the same name and signature. Overloading is different: it means several methods sharing a name but taking different parameter lists, resolved at compile time.
An imperative program specifies how to obtain the result, as an ordered sequence of statements that change the program state. A declarative program specifies what result is required and leaves the method of obtaining it to the system — SQL being the standard example.
Encapsulation means bundling data together with the methods that operate on it inside a class, and making the data private so it can only be accessed through those methods. The benefit is that the data cannot be set to an invalid value by unrelated code, since every change passes through a method that can validate it — so the object stays in a consistent state.
Polymorphism means the same method call behaves differently depending on the object it is applied to. For example, calling Area() on a Circle runs the circle's formula while the same call on a Rectangle runs a different one — the calling code does not need to know which type it holds.
(a) separates normal and error paths; (b) files close either way; (c) loses specificity and hides bugs; (d) readability
Writing a device driver or code for an embedded microcontroller. Direct access to specific registers, memory addresses and hardware timing is required, and the precise number of clock cycles may matter — control a high-level language deliberately abstracts away.
A class is the template that defines the attributes and methods. An object is a particular instance of that class, created at run time, with its own values for those attributes.
Attributes are made private and are accessed only through public methods. This prevents other code from setting an attribute to an invalid value.
Overriding replaces an inherited method in a subclass with a new version having the same signature. Overloading defines several methods with the same name but different parameter lists in the same class.
Shape s = new Circle(5) where Circle inherits from Shape.π × radius²[1]These questions come from the A Level Computer Science (9618) lessons — each topic has its own notes, worked examples and an interactive diagram.