An original Thinka practice paper modelled on the structure and difficulty of the Jun 2026 (V3) Cambridge IGCSE Computer Science (0478) paper. Not affiliated with or reproduced from Cambridge.
Paper 1: Computer Systems
Answer all questions. Calculators must not be used. Write answers clearly in black or dark blue pen.
26 Question · 62.599999999999994 marks
Question 1 · multiple_choice
1 marks
Which register in the Central Processing Unit (CPU) holds the address of the next instruction to be fetched from memory?
A.Accumulator (ACC)
B.Current Instruction Register (CIR)
C.Memory Data Register (MDR)
D.Program Counter (PC)
Show answer & marking schemeHide answer & marking scheme
Worked solution
The Program Counter (PC) holds the memory address of the next instruction to be fetched from primary storage (RAM) during the fetch–decode–execute cycle. Once the address is copied to the Memory Address Register (MAR), the PC is incremented to point to the subsequent instruction.
Marking scheme
Award 1 mark for D (Program Counter (PC)). All other options score 0.
Question 2 · Short Answer & Recall
1.7 marks
State what is meant by an overflow error when performing binary addition in an 8-bit register.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An 8-bit register can store values from 0 to 255 (or 2^8 - 1). When the sum of two numbers exceeds 255 (or produces a 9th carry bit), the extra most significant bit is lost or cannot be accommodated by the 8-bit register, resulting in an overflow error.
Marking scheme
Award 1 mark for identifying that the calculation exceeds register capacity / result is greater than 255; award 1 mark for stating that the 9th bit / carry bit cannot be stored or causes an incorrect result (scaled to 1.7 marks).
Question 3 · Short Answer & Recall
1.7 marks
Explain one difference between the ASCII character set and the Unicode character set.
Show answer & marking schemeHide answer & marking scheme
Worked solution
ASCII uses standard 7 or 8 bits per character, limiting it to 128 or 256 unique characters (primarily English alphabet and basic punctuation). Unicode uses 16 or 32 bits per character, enabling representation of millions of characters across diverse world languages, scripts, and emojis.
Marking scheme
Award 1 mark for comparing bit length / storage per character (e.g. Unicode uses 16/32 bits whereas ASCII uses 7/8 bits); award 1 mark for explaining that Unicode can represent more symbols/languages/characters worldwide (scaled to 1.7 marks).
Question 4 · Short Answer & Recall
1.7 marks
Identify two items of data that are contained in the header of a data packet.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A standard packet header contains essential metadata required for routing and reassembly, including the destination IP address, sender (originator) IP address, and the packet sequence/order number.
Marking scheme
Award 1 mark for each valid item from: Destination IP address, Sender/Originator IP address, Packet sequence number / packet ID, Packet length / size (to a maximum of 2 points, scaled to 1.7 marks).
Question 5 · Short Answer & Recall
1.7 marks
Describe the function of a timeout in an Automatic Repeat reQuest (ARQ) error-detection protocol.
Show answer & marking schemeHide answer & marking scheme
Worked solution
In ARQ, after transmitting a packet, the sender starts a countdown timer. If the recipient does not return a positive acknowledgement before the timeout period finishes (due to packet loss or corruption), the sender assumes the transmission failed and sends the packet again.
Marking scheme
Award 1 mark for stating that the timeout is the predetermined waiting time for an acknowledgement; award 1 mark for stating that data is automatically resent if the timer expires before receipt of an ACK (scaled to 1.7 marks).
Question 6 · Short Answer & Recall
1.7 marks
State the role of the Program Counter (PC) during the fetch stage of the fetch-decode-execute cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
During the fetch stage, the address in the Program Counter is copied to the MAR. The Program Counter is then incremented by one so that it points to the subsequent instruction in memory.
Marking scheme
Award 1 mark for holding the address of the next instruction to be fetched; award 1 mark for stating it is incremented / updated to point to the next instruction in sequence (scaled to 1.7 marks).
Question 7 · Short Answer & Recall
1.7 marks
Outline what happens within the central processing unit (CPU) when a hardware interrupt is generated.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Upon receiving an interrupt signal, the CPU checks its priority. If accepted, it halts the current instruction sequence, stores the state and registers in memory, and jumps to the relevant Interrupt Service Routine (ISR). Once the ISR completes, the CPU restores the previous state and resumes the original task.
Marking scheme
Award 1 mark for stating current execution is suspended and registers/state are saved; award 1 mark for stating the CPU runs the Interrupt Service Routine (ISR) / interrupt handler (scaled to 1.7 marks).
Question 8 · Short Answer & Recall
1.7 marks
State the difference between a session cookie and a persistent cookie.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Session cookies exist only during the active browsing session and are erased when the user terminates the browser session. Persistent cookies are written to the client hard disk/storage and remain active across multiple sessions until their predefined expiration date passes or they are deleted.
Marking scheme
Award 1 mark for session cookie deleted when browser is closed / temporary; award 1 mark for persistent cookie stored on hard disk / retained across sessions until expiry (scaled to 1.7 marks).
Question 9 · Short Answer & Recall
1.7 marks
Identify two key components that make up an expert system in artificial intelligence.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An expert system is composed of a knowledge base (repository of facts and data), a rule base (set of IF-THEN rules), an inference engine (the reasoning mechanism that applies rules to data), and a user interface.
Marking scheme
Award 1 mark for each valid component from: Knowledge base, Inference engine, Rule base, User interface / explanation facility (to a maximum of 2 points, scaled to 1.7 marks).
Question 10 · short_answer
2 marks
Describe the role of the Program Counter (PC) during the fetch stage of the fetch-decode-execute cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. The Program Counter stores the address of the next instruction to be fetched from main memory. 2. The address is transferred to the Memory Address Register (MAR). 3. The Program Counter is then incremented by 1 so that it points to the subsequent instruction in sequence.
Marking scheme
Award 1 mark for each valid point up to a maximum of 2 marks: - Holds / stores the memory address of the next instruction to be fetched [1] - Increments (by 1) after the address is copied to MAR [1]
Question 11 · short_answer
2 marks
State two events that will cause a sender to retransmit a data packet when using an Automatic Repeat reQuest (ARQ) protocol.
Show answer & marking schemeHide answer & marking scheme
Worked solution
ARQ uses acknowledgements and timeouts. Retransmission is triggered if: 1. The receiver detects corrupted data and sends back a negative acknowledgement (NACK). 2. The packet (or acknowledgement) is lost in transit, causing the sender's timer to expire (timeout) before receiving any acknowledgement.
Marking scheme
Award 1 mark for each valid point (max 2 marks): - Receiving a negative acknowledgement / NACK [1] - A timeout occurs / time limit expires before receiving an acknowledgement [1]
Question 12 · short_answer
2 marks
Convert the denary number \(-43\) into an 8-bit two's complement binary integer. Show your working.
Show answer & marking schemeHide answer & marking scheme
Step 2: Invert all bits (one's complement): \(00101011 \rightarrow 11010100\)
Step 3: Add 1 to the result (two's complement): \(11010100 + 1 = 11010101_2\)
Alternative check using place values: \(-128 + 64 + 16 + 4 + 1 = -128 + 85 = -43\).
Marking scheme
Award 1 mark for correct working (e.g. converting 43 to 00101011 and showing inversion / addition of 1, or correct place-value evaluation) [1] Award 1 mark for the correct final 8-bit binary representation: 11010101 [1]
Question 13 · short_answer
2 marks
State two reasons why a hardware device or running program would generate an interrupt signal to the CPU.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Interrupts are signals sent from a device or program to the CPU to request immediate attention. Common causes include: - Hardware I/O completion (e.g. data transfer finished from storage) - Hardware faults/warnings (e.g. out of paper, power fluctuation) - Software execution errors (e.g. illegal operation, arithmetic overflow, divide by zero) - User input events (e.g. key press or mouse click)
Marking scheme
Award 1 mark for each valid reason up to a maximum of 2 marks: - Hardware error / device fault (e.g. paper jam, disk read failure) [1] - I/O operation completion / data ready to be processed [1] - Software exception / runtime error (e.g. division by zero, null pointer) [1] - User interaction / hardware input event (e.g. key pressed, mouse movement) [1]
Question 14 · short_answer
2 marks
Explain how pharming redirects a user to a fraudulent website without the user clicking a malicious link.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Pharming is a cyber attack that modifies DNS resolution tables or local host files. When a victim types a legitimate URL into their browser, the altered DNS table translates the valid domain name into the attacker's server IP address, seamlessly redirecting the user to a bogus website designed to capture login details.
Marking scheme
Award 1 mark for the mechanism and 1 mark for the effect/outcome: - Malicious code alters DNS server records / local host file [1] - When user enters a legitimate URL/domain name, they are redirected to a fraudulent/fake IP address [1]
Question 15 · short_answer
2 marks
An expert system is a form of artificial intelligence. Identify two internal components of an expert system, excluding the user interface.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An expert system consists of four primary components: 1. User Interface (allows interaction) 2. Knowledge Base (stores factual information and domain data) 3. Rule Base (contains IF-THEN rules and logic relationships) 4. Inference Engine (applies rules to the knowledge base to deduce solutions and make decisions)
Marking scheme
Award 1 mark for each valid component up to a maximum of 2 marks: - Knowledge base [1] - Inference engine [1] - Rule base [1] (Do NOT accept User Interface as it is excluded in the question)
Question 16 · Structured Explanation
4 marks
A user enters a website URL into their browser.
Explain how the Domain Name System (DNS) is used to locate and retrieve the requested webpage.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. The web browser sends the domain name (requested by the user) to a DNS server (resolver/lookup). 2. The DNS server looks up its database of domain names and matching IP addresses. 3. The DNS server returns the specific IP address back to the user's web browser (or forwards the query to other DNS servers if not found). 4. The browser then uses this resolved IP address to establish communication and request the webpage directly from the target web server hosting the files.
Marking scheme
Award 1 mark for each valid step explained, up to a maximum of 4 marks: - Browser sends the domain name/URL to a DNS server [1] - DNS server searches / queries its database / records for matching IP address [1] - If not found locally, the request is passed/forwarded to higher-level/other DNS servers [1] - DNS server returns the IP address to the browser [1] - Browser uses the IP address to send a request (via HTTP/HTTPS) to the web server [1]
Question 17 · Structured Explanation
4 marks
During program execution, an interrupt signal is sent to the Central Processing Unit (CPU).
Explain how the operating system handles this interrupt.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. The CPU finishes executing the current instruction in the fetch-decode-execute cycle. 2. The current state and register contents (such as Program Counter and accumulator) are saved onto a stack or temporary memory area. 3. The operating system checks the priority/source of the interrupt and loads the relevant Interrupt Service Routine (ISR) / interrupt handler. 4. Once the ISR has finished execution, the saved register values and program state are restored, allowing the original task to resume seamlessly.
Marking scheme
Award 1 mark per valid point up to a maximum of 4 marks: - CPU completes the current execution cycle / instruction [1] - The current contents of the registers / program state / Program Counter are saved (to a stack / memory) [1] - The operating system / CPU determines the source / priority of the interrupt [1] - The corresponding Interrupt Service Routine (ISR) / interrupt handler is loaded/executed [1] - After the ISR finishes, the saved register values/state are restored [1] - The previous process / original task resumes execution [1]
Question 18 · Structured Explanation
4 marks
A company uses asymmetric encryption to securely receive confidential files from clients over the internet.
Explain how asymmetric encryption ensures the confidentiality of these files during transmission.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Asymmetric encryption uses a pair of mathematically linked but non-identical keys: a public key and a private key. 2. The receiving company distributes its public key openly to any client wishing to send files, while strictly keeping its corresponding private key confidential. 3. The client encrypts the plaintext data using the recipient's public key before sending it across the network. 4. Once encrypted, the ciphertext can only be decrypted using the corresponding private key held solely by the company, ensuring unauthorized interceptors cannot decrypt or read the file.
Marking scheme
Award 1 mark for each valid explanation point up to a maximum of 4 marks: - Uses a pair of mathematically linked keys / a public key and a private key [1] - Public key is made available to everyone/the sender; private key is kept secret/confidential by the recipient [1] - Sender/client encrypts the file/data using the recipient's public key [1] - Only the recipient can decrypt the file using their corresponding private key [1] - Data cannot be decrypted with the public key / unauthorized parties cannot read the ciphertext [1]
Question 19 · Structured Explanation
4 marks
A modern computer system uses Solid State Drives (SSDs) rather than Hard Disk Drives (HDDs) for secondary storage.
Explain how an SSD stores data and why this makes it more durable than an HDD.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Storage mechanism: An SSD stores data in non-volatile flash memory using millions of microscopic transistors configured with floating gates and control gates. 2. The presence or absence of trapped electrical charge (electrons) in the floating gate alters the threshold voltage, representing binary bits (0s and 1s). 3. Durability aspect: Unlike an HDD, which relies on physical spinning magnetic platters and moving mechanical read/write actuator arms, an SSD has zero moving mechanical parts. 4. Consequently, SSDs are much more resistant to mechanical failure, physical shock, and drops (eliminating the risk of a head crash).
Marking scheme
Award 1 mark per valid point up to a maximum of 4 marks (maximum 2 marks for operation, maximum 2 marks for durability):
Operation: - Uses flash / non-volatile NAND memory [1] - Uses floating gate / control gate transistors [1] - Traps / controls electrical charge (electrons) to represent binary states / 0s and 1s [1]
Durability: - SSD has no moving / mechanical parts [1] - HDD has moving read/write heads / spinning magnetic platters [1] - SSD is not vulnerable to head crashes / physical shock / dropping / vibration [1]
Question 20 · Structured Explanation
4 marks
An automated temperature control system is installed in a commercial greenhouse.
Explain how sensors, a microprocessor, and actuators work together to maintain the temperature at a preset level.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Temperature sensors continuously monitor the ambient conditions in the greenhouse and send analog data, which is converted to digital data (via an ADC) for processing. 2. The microprocessor receives the digitized data and compares it against preset target temperature thresholds stored in memory. 3. If the reading is outside the acceptable range (e.g. too cold), the microprocessor generates an output control signal sent to an actuator (e.g., activating a heating unit). 4. If the reading is too high, the microprocessor activates actuators to open motorised roof vents or run cooling fans; the entire monitoring-comparison-action cycle repeats continuously.
Marking scheme
Award 1 mark per valid point up to a maximum of 4 marks: - Temperature sensor measures/records the environmental temperature continuously [1] - Sensor sends data to the microprocessor (ADC converts analogue sensor data to digital) [1] - Microprocessor compares received reading with preset / stored threshold value(s) [1] - If temperature is below threshold, microprocessor signals an actuator to turn on heating [1] - If temperature is above threshold, microprocessor signals an actuator to open vents / turn on cooling fans [1] - The process repeats continuously / in a loop [1]
Question 21 · Structured Explanation
4 marks
A digital audio track is recorded using sound sampling.
Explain how sample rate and sample resolution affect both the quality of the recorded sound and the resulting file size.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Sample rate refers to how many audio samples are captured per second (measured in Hz/kHz). A higher sample rate samples the analogue wave more frequently, reproducing the original analogue waveform more accurately and resulting in higher sound quality. 2. Sample resolution (bit depth) refers to the number of bits allocated per sample. A higher sample resolution provides more discrete amplitude levels, resulting in closer approximation of volume levels and higher fidelity. 3. File size is directly proportional to both parameters (File size = sample rate × sample resolution × duration × number of channels). 4. Increasing either sample rate or sample resolution causes more data bits to be stored per unit of time, which increases the total file size.
Marking scheme
Award 1 mark per valid point up to a maximum of 4 marks: - Sample rate: increasing sample rate captures more samples per second / closer approximation to original wave / improves quality [1] - Sample resolution: increasing sample resolution allocates more bits per sample / gives finer amplitude levels / reduces quantization error / improves quality [1] - Increasing sample rate increases the total number of samples stored, thus increasing file size [1] - Increasing sample resolution increases bits stored per sample, thus increasing file size [1] - Stating the relationship: higher quality / fidelity leads to larger file size (or vice versa) [1]
Question 22 · Cloze Paragraph Completion
5 marks
Complete the paragraph describing the fetch stage of the Fetch–Decode–Execute (FDE) cycle by choosing the correct terms from the list.
Not all terms will be used.
• Accumulator (ACC) • Address bus • Arithmetic Logic Unit (ALU) • Control bus • Current Instruction Register (CIR) • Data bus • Memory Address Register (MAR) • Memory Data Register (MDR) • Program Counter (PC)
At the start of the cycle, the address of the next instruction is copied from the (1) .................................................... to the (2) .................................................... .
This memory address is transmitted to primary memory using the (3) .................................................... .
The instruction stored at this location is transferred into the (4) .................................................... along the data bus.
Finally, the instruction is copied from there into the (5) .................................................... where it is held ready to be decoded.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Program Counter (PC) holds the memory address of the next instruction to be fetched. 2. Memory Address Register (MAR) receives the address from the PC. 3. Address bus carries the memory address from the MAR to primary storage (RAM). 4. Memory Data Register (MDR) temporarily stores the instruction fetched from RAM. 5. Current Instruction Register (CIR) holds the fetched instruction ready for the Control Unit to decode.
Marking scheme
1 mark for each correct term placed in the corresponding gap: • (1) Program Counter / PC [1] • (2) Memory Address Register / MAR [1] • (3) Address bus [1] • (4) Memory Data Register / MDR [1] • (5) Current Instruction Register / CIR [1]
Question 23 · short_answer
1.75 marks
Convert the denary integer \(-77\) into an 8-bit two's complement binary integer. Show your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Method 1 (Invert and add 1): 1. Convert positive \(+77\) to 8-bit binary: \(64 + 8 + 4 + 1 = 01001101\). 2. Invert all bits (one's complement): \(10110010\). 3. Add 1 to get two's complement: \(10110010 + 1 = 10110011\).
1 mark for correct method shown (e.g. converting \(+77\) to \(01001101\) and inverting/adding 1, or correct place value addition). 0.75 marks for the correct final 8-bit binary value: 10110011.
Question 24 · short_answer
1.75 marks
Convert the 8-bit two's complement binary integer \(11010110\) into its denary value. Show your working.
Show answer & marking schemeHide answer & marking scheme
1 mark for showing valid working (e.g. \(-128 + 64 + 16 + 4 + 2\) or inverting and adding 1 to get \(+42\)). 0.75 marks for the correct final denary answer: -42.
Question 25 · short_answer
1.75 marks
Convert the denary integer \(-105\) into an 8-bit two's complement binary integer. Show your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Method 1 (Invert and add 1): 1. Convert positive \(+105\) to 8-bit binary: \(64 + 32 + 8 + 1 = 01101001\). 2. Invert all bits (one's complement): \(10010110\). 3. Add 1 to the result: \(10010110 + 1 = 10010111\).
1 mark for correct method shown (e.g. converting \(+105\) to \(01101001\) and inverting bits, or using \(-128\) base weight). 0.75 marks for the correct final 8-bit binary value: 10010111.
Question 26 · short_answer
1.75 marks
Convert the 8-bit two's complement binary integer \(10101100\) into its denary value. Show your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Method 1 (Direct place value calculation): Place value weights: \(-128, 64, 32, 16, 8, 4, 2, 1\) Bits: \(1, 0, 1, 0, 1, 1, 0, 0\) Calculation: \(-128 + 32 + 8 + 4 = -128 + 44 = -84\).
1 mark for showing correct working (e.g. \(-128 + 32 + 8 + 4\) or inverting and adding 1 to find \(84\)). 0.75 marks for the correct final denary answer: -84.
Ready to test yourself?
Turn these notes into exam-style practice. Get unlimited AI questions on this topic with instant marking and explanations.
Answer all questions. Calculators must not be used. Write pseudocode following standard syllabus conventions.
18 Question · 68 marks
Question 1 · Multiple Choice
1 marks
Consider the following pseudocode segment:
```text DECLARE Subject : STRING DECLARE Result : STRING
Subject <- "CHEMISTRY" Result <- SUBSTRING(Subject, 3, 4) ```
Identify the string stored in the variable `Result` after execution.
A."EMIS"
B."HEMI"
C."EMIST"
D."MIST"
Show answer & marking schemeHide answer & marking scheme
Worked solution
In Cambridge IGCSE pseudocode, string indexing begins at position 1. The function `SUBSTRING(string, start, length)` extracts a substring beginning at character index `start` for a total of `length` characters.
In the string `"CHEMISTRY"`: - Index 1: `C` - Index 2: `H` - Index 3: `E` - Index 4: `M` - Index 5: `I` - Index 6: `S` - Index 7: `T` - Index 8: `R` - Index 9: `Y`
Starting at index 3 with a length of 4 characters extracts indices 3, 4, 5, and 6, which gives `"EMIS"`.
Marking scheme
1 mark for A ("EMIS"). Accept only A.
Question 2 · Multiple Choice
1 marks
A database table named `PRODUCT` stores details of items in a warehouse. It contains the fields `ProductCode`, `Description`, `Category`, and `UnitPrice`.
Identify the SQL statement that displays only the description and unit price of all products in the 'Electronics' category, ordered from highest price to lowest price.
A.SELECT Description, UnitPrice FROM PRODUCT WHERE Category = 'Electronics' ORDER BY UnitPrice DESCENDING;
B.SELECT Description, UnitPrice FROM PRODUCT WHERE Category = 'Electronics' ORDER BY UnitPrice ASCENDING;
C.SELECT ProductCode, Description, UnitPrice FROM PRODUCT WHERE Category = 'Electronics' ORDER BY UnitPrice DESCENDING;
D.SELECT * FROM PRODUCT WHERE Category = 'Electronics' ORDER BY UnitPrice DESCENDING;
Show answer & marking schemeHide answer & marking scheme
Worked solution
To select only the description and unit price, the `SELECT` clause must specify `Description, UnitPrice`. The table is specified by `FROM PRODUCT`. The condition to filter for the category 'Electronics' is `WHERE Category = 'Electronics'`. To order results from highest price to lowest price (descending order), the clause is `ORDER BY UnitPrice DESCENDING`.
Therefore, the correct SQL query is: `SELECT Description, UnitPrice FROM PRODUCT WHERE Category = 'Electronics' ORDER BY UnitPrice DESCENDING;`
Marking scheme
1 mark for A. Accept only A.
Question 3 · short-answer
4 marks
Identify the most suitable pseudocode data type for each of the following pieces of data:
(a) The number of students registered for an exam (e.g. 28) (b) The mass of a package in kilograms (e.g. 12.45) (c) A single character indicating an exam grade (e.g. 'A') (d) Whether a library book is currently on loan (e.g. FALSE)
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) The count of students is a whole number with no fractional part, so INTEGER is required. (b) The mass contains a fractional/decimal component, so REAL is required. (c) A single character enclosed in quotes is represented by CHAR. (d) A flag indicating one of two states (TRUE or FALSE) is represented by BOOLEAN.
Marking scheme
1 mark for each correct data type: (a) INTEGER (b) REAL (c) CHAR (accept CHARACTER) (d) BOOLEAN
Question 4 · short-answer
2 marks
Explain the difference between validation and verification when entering data into a computer program.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Validation checks if input data follows set criteria (e.g. range, type, length, presence) automatically by the system. Verification checks that data input is identical to the source document, performed either by double data entry or visual checking.
Marking scheme
1 mark for a correct explanation of validation: - Automated check / check by software to ensure data is acceptable / sensible / within rules / valid format.
1 mark for a correct explanation of verification: - Check that data matches the original source / is entered correctly without transcription errors (e.g., via visual check or double entry).
Note: Reject answers stating validation checks that data is 'correct' or 'true'.
Question 5 · short-answer
2 marks
State the purpose of a primary key in a database table and give one reason why a person's surname is not suitable to be used as a primary key.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A primary key ensures every record has a unique identifier so that specific rows can be referenced and retrieved unambiguously. Surnames cannot serve this purpose because two or more distinct individuals may share the exact same surname, violating the uniqueness constraint.
Marking scheme
1 mark for stating the purpose: - Uniquely identifies each record / row / entity in a table.
1 mark for the reason: - Surnames are not unique / duplicates can exist / different people can share the same surname.
Question 6 · short-answer
2 marks
Compare the use of a count-controlled loop (FOR ... NEXT) and a pre-condition loop (WHILE ... ENDWHILE) by stating when it is appropriate to use each type.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A FOR loop is predetermined (fixed iterations), whereas a WHILE loop is condition-controlled and checks the condition at the start, meaning it will not execute at all if the initial condition is false.
Marking scheme
1 mark for FOR loop: - When the number of iterations / repetitions is known / fixed in advance.
1 mark for WHILE loop: - When the number of iterations is unknown / depends on a condition (being met) / when the loop body might need to execute zero times.
Question 7 · short-answer
2 marks
A programmer uses standard pseudocode file handling commands.
(a) State what happens to any existing data in a text file when it is opened in WRITE mode. (b) State why a file must be closed after writing to it is completed.
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Opening a file in WRITE mode truncates the file, clearing any previous contents. (b) Closing a file flushes write buffers to disk, prevents file locking or corruption, and releases operating system resources.
Marking scheme
(a) 1 mark for: - Existing data is deleted / overwritten / wiped / lost / a new empty file is created.
(b) 1 mark for any one of: - To save / write all buffered data to storage / disk. - To release system memory / file handle / allow other processes to access the file. - To prevent data loss / corruption.
Question 8 · short-answer
3 marks
The string variable `CourseCode` is assigned the value `"CS2026P2"`.
State the result returned by each of the following pseudocode operations:
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) The total number of characters in "CS2026P2" is 8. (b) SUBSTRING starting at index 3 with length 4 extracts characters at positions 3, 4, 5, and 6: "2026". (c) SUBSTRING at index 1 with length 2 extracts "CS", and LCASE converts it to lowercase: "cs".
Marking scheme
1 mark for each correct result: (a) 8 (b) "2026" (accept 2026) (c) "cs" (quotes optional, must be lowercase)
Question 9 · Trace Table & Algorithm Analysis
3.5 marks
Consider the following pseudocode algorithm:
```text DECLARE Num, Rem, Count : INTEGER Count <- 0 INPUT Num WHILE Num > 0 DO Rem <- MOD(Num, 10) IF Rem > 4 THEN Count <- Count + 1 ENDIF Num <- DIV(Num, 10) ENDWHILE OUTPUT "Result: ", Count ```
Complete the trace table for the algorithm using the input value `7283`.
1 mark for correct values in `Rem` column in correct order (3, 8, 2, 7). 1 mark for correct sequence of values in `Num` column (7283, 728, 72, 7, 0). 1 mark for correct sequence of values in `Count` column (0, 1, 2). 0.5 marks for correct final output `Result: 2` (allow `2` or `"Result: ", 2`).
Question 10 · Trace Table & Algorithm Analysis
3.5 marks
An algorithm is written to process elements of a 1D array `Values` containing 5 integers:
```text DECLARE Total, Index, CurrentVal : INTEGER // Array Values contains: [12, 5, 18, 7, 14] Total <- 0 FOR Index <- 1 TO 5 CurrentVal <- Values[Index] IF MOD(CurrentVal, 3) = 0 THEN Total <- Total + CurrentVal ENDIF NEXT Index OUTPUT Total ```
1 mark for correct `Index` values from 1 to 5 and corresponding `CurrentVal` values (12, 5, 18, 7, 14). 1 mark for initial `Total` of 0 and correct updates to `Total` (12, 30). 1 mark for no incorrect updates in `Total` on iterations where condition is false. 0.5 marks for correct final output `30`.
Question 11 · Logic Circuit Drawing & Truth Table
4 marks
Complete the truth table for the following logic expression:
$$X = (\text{A} \text{ OR } \text{NOT } \text{B}) \text{ AND } (\text{B} \text{ XOR } \text{C})$$
4 marks total: - 4 marks for all 8 correct outputs in column X - 3 marks for 6 or 7 correct outputs - 2 marks for 4 or 5 correct outputs - 1 mark for 2 or 3 correct outputs - 0 marks for 0 or 1 correct output
A warehouse security system activates an alarm ($X = 1$) based on the states of three inputs:
- Motion sensor detects movement ($M = 1$) - Door sensor detects open door ($D = 1$) - System is armed by key switch ($S = 1$)
The alarm is activated ($X = 1$) if: - movement is detected $\text{AND}$ the system is armed $$\text{OR}$$ - the door is open $\text{AND}$ the system is armed $\text{AND}$ movement is $\text{NOT}$ detected.
(a) Write a logic expression for the alarm system output $X$. [2]
(b) Complete the truth table for the alarm system. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Deriving the logic expression: - First condition: movement detected AND system armed $\rightarrow (M \text{ AND } S)$ - Second condition: door open AND system armed AND movement NOT detected $\rightarrow (D \text{ AND } S \text{ AND NOT } M)$ - Combined with OR: $X = (M \text{ AND } S) \text{ OR } (D \text{ AND } S \text{ AND NOT } M)$
(b) Completing the truth table: - Row 1 ($0, 0, 0$): $(0 \text{ AND } 0) \text{ OR } (0 \text{ AND } 0 \text{ AND } 1) = 0 \text{ OR } 0 = 0$ - Row 2 ($0, 0, 1$): $(0 \text{ AND } 1) \text{ OR } (0 \text{ AND } 1 \text{ AND } 1) = 0 \text{ OR } 0 = 0$ - Row 3 ($0, 1, 0$): $(0 \text{ AND } 0) \text{ OR } (1 \text{ AND } 0 \text{ AND } 1) = 0 \text{ OR } 0 = 0$ - Row 4 ($0, 1, 1$): $(0 \text{ AND } 1) \text{ OR } (1 \text{ AND } 1 \text{ AND } 1) = 0 \text{ OR } 1 = 1$ - Row 5 ($1, 0, 0$): $(1 \text{ AND } 0) \text{ OR } (0 \text{ AND } 0 \text{ AND } 0) = 0 \text{ OR } 0 = 0$ - Row 6 ($1, 0, 1$): $(1 \text{ AND } 1) \text{ OR } (0 \text{ AND } 1 \text{ AND } 0) = 1 \text{ OR } 0 = 1$ - Row 7 ($1, 1, 0$): $(1 \text{ AND } 0) \text{ OR } (1 \text{ AND } 0 \text{ AND } 0) = 0 \text{ OR } 0 = 0$ - Row 8 ($1, 1, 1$): $(1 \text{ AND } 1) \text{ OR } (1 \text{ AND } 1 \text{ AND } 0) = 1 \text{ OR } 0 = 1$
(a) 2 marks: - 1 mark for $(M \text{ AND } S)$ - 1 mark for $(D \text{ AND } S \text{ AND NOT } M)$ correctly joined with $\text{OR}$ Accept equivalent correct expressions such as: $X = (M \text{ AND } S) \text{ OR } ((D \text{ AND } S) \text{ AND NOT } M)$
(b) 2 marks: - 2 marks for all 8 rows correct (0, 0, 0, 1, 0, 1, 0, 1) - 1 mark for 6 or 7 rows correct
Question 13 · short_answer
5 marks
A garden nursery stores details of its plants in a database table named `PLANT_STOCK`.
Complete the Structured Query Language (SQL) script to display the plant name and price of all plants where the plant type is `'Perennial'` and the quantity in stock is at least 10.
The output must be sorted in ascending order of price.
ORDER BY .................................................................................................................. ```
Show answer & marking schemeHide answer & marking scheme
Worked solution
To construct the SQL statement according to the requirements:
1. SELECT clause: We need to output the plant name and price. `SELECT PlantName, Price`
2. FROM clause: The data is retrieved from the `PLANT_STOCK` table. `FROM PLANT_STOCK`
3. WHERE clause: We must filter for plants of type `'Perennial'` AND a stock level of at least 10 (≥ 10 or > 9). `WHERE PlantType = 'Perennial'` `AND QuantityInStock >= 10`
4. ORDER BY clause: The list must be sorted by price in ascending order. `ORDER BY Price ASCENDING` (or `ORDER BY Price ASC` / `ORDER BY Price`)
Marking scheme
1 mark per correct line / section (total 5 marks):
- 1 mark for `PlantName, Price` (accept fields in either order) - 1 mark for `PLANT_STOCK` - 1 mark for `PlantType = 'Perennial'` (accept double quotes `"Perennial"`) - 1 mark for `AND QuantityInStock >= 10` (accept `AND QuantityInStock > 9`) - 1 mark for `Price ASCENDING` (accept `Price ASC` or `Price`)
Note: SQL keywords are case-insensitive. Allow follow-through if WHERE and AND lines are swapped or written on one line.
Question 14 · Short Pseudocode Writing
4 marks
Write an algorithm in pseudocode that repeatedly prompts the user to enter an examination mark as an integer until a valid mark between 0 and 100 inclusive is entered.
Your algorithm must: - repeatedly input the mark until it is valid - output the message `"Invalid mark, please re-enter"` whenever an invalid mark is entered - output the message `"Mark accepted"` once a valid mark has been entered.
Show answer & marking schemeHide answer & marking scheme
Worked solution
```text // Alternative 1: REPEAT ... UNTIL loop REPEAT OUTPUT "Enter mark (0 - 100): " INPUT Mark IF Mark < 0 OR Mark > 100 THEN OUTPUT "Invalid mark, please re-enter" ENDIF UNTIL Mark >= 0 AND Mark <= 100 OUTPUT "Mark accepted"
// Alternative 2: WHILE loop OUTPUT "Enter mark (0 - 100): " INPUT Mark WHILE Mark < 0 OR Mark > 100 DO OUTPUT "Invalid mark, please re-enter" INPUT Mark ENDWHILE OUTPUT "Mark accepted" ```
Marking scheme
1 mark for each point (max 4 marks): - 1 mark: Initial prompt and `INPUT` of mark. - 1 mark: Correct loop structure (e.g. `REPEAT ... UNTIL` or `WHILE ... DO`) with correct condition to continue while invalid / stop when valid. - 1 mark: Correct conditional check and output of error message `"Invalid mark, please re-enter"` when `Mark < 0 OR Mark > 100`. - 1 mark: Output of `"Mark accepted"` only after exiting the loop.
Question 15 · Short Pseudocode Writing
4 marks
A 1D array `DailyRainfall` contains 30 `REAL` values representing rainfall measurements in millimetres for each day of a month (indices 1 to 30).
Write an algorithm in pseudocode to: - iterate through all 30 elements of `DailyRainfall` - count how many days had a rainfall measurement strictly greater than 15.0 mm - calculate the total rainfall recorded on those specific days - output the total rainfall and the count with suitable accompanying messages.
Show answer & marking schemeHide answer & marking scheme
Worked solution
```text DECLARE Count : INTEGER DECLARE Total : REAL DECLARE Day : INTEGER
Count <- 0 Total <- 0.0 FOR Day <- 1 TO 30 IF DailyRainfall[Day] > 15.0 THEN Count <- Count + 1 Total <- Total + DailyRainfall[Day] ENDIF NEXT Day OUTPUT "Days with rainfall > 15mm: ", Count OUTPUT "Total rainfall on these days: ", Total ```
Marking scheme
1 mark for each point (max 4 marks): - 1 mark: Initialising both `Count` and `Total` to zero before the loop. - 1 mark: Correct loop iterating through the array from 1 to 30 (`FOR Day <- 1 TO 30 ... NEXT Day`). - 1 mark: Correct `IF` condition (`DailyRainfall[Day] > 15.0`) with correct incrementing of `Count` and accumulation of `Total`. - 1 mark: Output of both final `Count` and `Total` outside the loop with appropriate text messages.
Question 16 · Short Pseudocode Writing
4 marks
Write a function `CountVowels` in pseudocode that takes a single `STRING` parameter `Sentence` and returns the integer count of all vowel characters (`'A'`, `'E'`, `'I'`, `'O'`, `'U'`) present in the string, regardless of case.
You should use standard pseudocode string handling routines such as `LENGTH`, `SUBSTRING`, and/or `UCASE`.
Show answer & marking schemeHide answer & marking scheme
Worked solution
```text FUNCTION CountVowels(Sentence : STRING) RETURNS INTEGER DECLARE NumVowels, Index : INTEGER DECLARE NextChar : CHAR
NumVowels <- 0 FOR Index <- 1 TO LENGTH(Sentence) NextChar <- UCASE(SUBSTRING(Sentence, Index, 1)) IF NextChar = 'A' OR NextChar = 'E' OR NextChar = 'I' OR NextChar = 'O' OR NextChar = 'U' THEN NumVowels <- NumVowels + 1 ENDIF NEXT Index RETURN NumVowels ENDFUNCTION ```
Marking scheme
1 mark for each point (max 4 marks): - 1 mark: Correct function header with parameter and `RETURNS INTEGER`, and closing `ENDFUNCTION`. - 1 mark: Initialising counter variable to 0 and loop iterating from 1 to `LENGTH(Sentence)`. - 1 mark: Extracting single character using `SUBSTRING` and checking if vowel (handling uppercase/lowercase, e.g. via `UCASE` or checking both sets) and incrementing counter. - 1 mark: `RETURN` statement returning the vowel counter value.
Question 17 · Short Pseudocode Writing
4 marks
A text file named `"Scores.txt"` stores a sequence of positive integer test scores, one value per line. The end of data is marked by a rogue (sentinel) value of `-1`.
Write an algorithm in pseudocode to: - open the file `"Scores.txt"` in read mode - read all the test scores from the file until `-1` is encountered - calculate the average score of all the test scores (excluding `-1`) - close the file - output the calculated average score with an appropriate message.
Assume there is at least one valid test score in the file before `-1`.
Show answer & marking schemeHide answer & marking scheme
Worked solution
```text DECLARE Score, Total, Count : INTEGER DECLARE Average : REAL
OPENFILE "Scores.txt" FOR READ Total <- 0 Count <- 0 READFILE "Scores.txt", Score WHILE Score <> -1 DO Total <- Total + Score Count <- Count + 1 READFILE "Scores.txt", Score ENDWHILE CLOSEFILE "Scores.txt"
Average <- Total / Count OUTPUT "The average score is: ", Average ```
Marking scheme
1 mark for each point (max 4 marks): - 1 mark: `OPENFILE "Scores.txt" FOR READ` and `CLOSEFILE "Scores.txt"` correctly placed. - 1 mark: Reading initial value with `READFILE` and repeating with a `WHILE Score <> -1` loop reading subsequent values. - 1 mark: Totalling the scores and counting the number of scores inside the loop. - 1 mark: Correctly calculating average (`Total / Count`) after loop and outputting it with a suitable message.
A local sports club manages a youth summer camp with 40 available places.
The following one-dimensional (1D) arrays are used to store details of the registered campers, where the index represents each camper (from 1 to 40): - `CamperName[1:40]` stores the name of each camper (STRING) - `CamperAge[1:40]` stores the age of each camper (INTEGER) - `CamperSport[1:40]` stores the chosen sport code (STRING: "T" for Tennis, "S" for Swimming, "A" for Athletics) - `CamperFee[1:40]` stores the final calculated fee for each camper in dollars (REAL)
Write an algorithm using pseudocode or program code to meet the following requirements:
1. Input and Validation: - Prompt and input data for all 40 campers. - Ensure the name is not empty (presence check). - Validate that the age is an integer between 7 and 14 inclusive (range check). - Validate that the sport code is either "T", "S", or "A". - Prompt the user again if any input is invalid until valid data is entered.
2. Fee Calculation: - The standard base fee is $120.00. - If the camper is under 10 years old (age < 10), a discount of $15.00 is subtracted from the base fee. - If the chosen sport is Tennis ("T"), an equipment surcharge of $20.00 is added to the fee. - Store the calculated fee in `CamperFee`.
3. Display and Summary Statistics: - Output the name, age, sport code, and calculated fee for each of the 40 campers. - Calculate and output: - The total revenue collected across all 40 campers. - The average age of all campers. - The total number of campers enrolled in each sport ("T", "S", and "A"). - The name of the camper(s) who paid the highest fee.
Show answer & marking schemeHide answer & marking scheme
Worked solution
// Declare arrays DECLARE CamperName : ARRAY[1:40] OF STRING DECLARE CamperAge : ARRAY[1:40] OF INTEGER DECLARE CamperSport : ARRAY[1:40] OF STRING DECLARE CamperFee : ARRAY[1:40] OF REAL
// Declare variables DECLARE Index : INTEGER DECLARE TotalRevenue : REAL DECLARE TotalAge : INTEGER DECLARE AverageAge : REAL DECLARE CountTennis : INTEGER DECLARE CountSwimming : INTEGER DECLARE CountAthletics : INTEGER DECLARE MaxFee : REAL
// 1. Input, validation, fee calculation and array storage FOR Index <- 1 TO 40 // Input and validate name REPEAT OUTPUT "Enter name for camper ", Index, ": " INPUT CamperName[Index] UNTIL CamperName[Index] <> ""
// Input and validate age REPEAT OUTPUT "Enter age (7-14) for camper ", Index, ": " INPUT CamperAge[Index] UNTIL CamperAge[Index] >= 7 AND CamperAge[Index] <= 14
// Input and validate sport code REPEAT OUTPUT "Enter sport code (T for Tennis, S for Swimming, A for Athletics): " INPUT CamperSport[Index] UNTIL CamperSport[Index] = "T" OR CamperSport[Index] = "S" OR CamperSport[Index] = "A"
// 2. Fee Calculation CamperFee[Index] <- 120.00 IF CamperAge[Index] < 10 THEN CamperFee[Index] <- CamperFee[Index] - 15.00 ENDIF IF CamperSport[Index] = "T" THEN CamperFee[Index] <- CamperFee[Index] + 20.00 ENDIF
IF CamperSport[Index] = "T" THEN CountTennis <- CountTennis + 1 ELSE IF CamperSport[Index] = "S" THEN CountSwimming <- CountSwimming + 1 ELSE CountAthletics <- CountAthletics + 1 ENDIF ENDIF
// Track maximum fee IF CamperFee[Index] > MaxFee THEN MaxFee <- CamperFee[Index] ENDIF NEXT Index
// 3. Display individual camper records OUTPUT "--- CAMPER DETAILS ---" FOR Index <- 1 TO 40 OUTPUT "Name: ", CamperName[Index], " | Age: ", CamperAge[Index], " | Sport: ", CamperSport[Index], " | Fee: $", CamperFee[Index] NEXT Index
// Calculate average age AverageAge <- TotalAge / 40.0
// Display summary statistics OUTPUT "--- SUMMARY STATISTICS ---" OUTPUT "Total revenue collected: $", TotalRevenue OUTPUT "Average age of campers: ", AverageAge OUTPUT "Campers in Tennis: ", CountTennis OUTPUT "Campers in Swimming: ", CountSwimming OUTPUT "Campers in Athletics: ", CountAthletics
// Display camper(s) with the highest fee OUTPUT "Camper(s) paying the highest fee of $", MaxFee, ":" FOR Index <- 1 TO 40 IF CamperFee[Index] = MaxFee THEN OUTPUT CamperName[Index] ENDIF NEXT Index
Marking scheme
Marking is split into two assessment objectives: AO2 (Application & Technique - 9 marks) and AO3 (Evaluation, Logic & Structure - 6 marks).
### AO2: Specific Functional Marks (Max 9 marks) - Input & Validation (3 marks): - 1 mark: Loop with presence check for non-empty camper name. - 1 mark: Loop with range check for age (≥ 7 AND ≤ 14). - 1 mark: Loop validating sport code ("T", "S", or "A"). - Fee Calculation & Storage (2 marks): - 1 mark: Base fee ($120) adjusted correctly for age < 10 (-$15) and Tennis (+$20). - 1 mark: Correctly storing name, age, sport code, and calculated fee in parallel arrays. - Totals & Counting (2 marks): - 1 mark: Totalling overall revenue and accumulating age/counting per sport. - 1 mark: Correct calculation of average age (`TotalAge / 40`). - Output & Highest Fee Search (2 marks): - 1 mark: Iterating and displaying individual camper details and summary statistics. - 1 mark: Correct algorithm to identify and output the name(s) of camper(s) paying the maximum fee.
### AO3: Programming Logic & Structure (Max 6 marks) - Level 3 (5–6 marks): - The algorithm is fully functional, robust, and well-structured. - Appropriate control structures (FOR, REPEAT...UNTIL / WHILE, IF/CASE) used effectively. - Meaningful identifier names throughout, clear comments, and consistent indentation. - Level 2 (3–4 marks): - The algorithm addresses most requirements but may have minor logical flaws (e.g., slight off-by-one errors or minor logic omissions in max search). - Readable code with mostly consistent naming conventions and structure. - Level 1 (1–2 marks): - Partial solution addressing only isolated parts of the scenario. - Weak control structures, syntax inconsistent with standard pseudocode, lack of commenting/indentation. - 0 marks: No creditable response.
Wondering how well you actually know this?
thinka is an AI practice app for IGCSE & IB students: unlimited questions, instant auto-marking, and detailed step-by-step solutions. 100,000+ students use it to confirm they actually know it, not just think they do.