Cambridge IGCSE · PastPaper.sampleTitle

MetadataPastPaper.sampleTitle

Thinka Nov 2025 (V2) Cambridge International A Level-Style Mock — Computer Science (0478)

150 PastPaper.marks210 PastPaper.minutes2025
An original Thinka practice paper modelled on the structure and difficulty of the Nov 2025 (V2) Cambridge International A Level Computer Science (0478) paper. Not affiliated with or reproduced from Cambridge.

Paper 1 Computer Systems

Answer all questions in the space provided. Calculators must not be used.
20 PastPaper.question · 75 PastPaper.marks
PastPaper.question 1 · Short Answer
2 PastPaper.marks
Convert the hexadecimal number B4 into a denary number. Show your working.
PastPaper.showAnswers

PastPaper.workedSolution

To convert hexadecimal B4 to denary: 1. Identify the place values: the rightmost digit has a weight of 1, and the leftmost digit has a weight of 16. 2. Convert the hex digit B to its denary equivalent: B = 11. 3. Multiply the digits by their weights: \(11 \times 16 = 176\) and \(4 \times 1 = 4\). 4. Sum the values: \(176 + 4 = 180\).

PastPaper.markingScheme

1 mark for correct working (e.g., showing the calculation \(11 \times 16\) or converting B4 to 8-bit binary 10110100 and then to denary). 1 mark for the correct final answer: 180.
PastPaper.question 2 · Short Answer
2 PastPaper.marks
Describe how a checksum is used to detect transmission errors.
PastPaper.showAnswers

PastPaper.workedSolution

1. Before transmission, the sender calculates a checksum value from the block of data using a specific algorithm. This checksum is sent along with the data. 2. Upon receipt, the receiving system recalculates the checksum from the received data using the same algorithm. 3. The receiver compares its calculated checksum with the received checksum. If they do not match, a transmission error is detected and a retransmission is requested.

PastPaper.markingScheme

1 mark: Explaining that the sender calculates a checksum using an algorithm and sends it with the data. 1 mark: Explaining that the receiver recalculates the checksum and compares it, with any mismatch indicating an error.
PastPaper.question 3 · Short Answer
2 PastPaper.marks
Describe the roles of the Program Counter (PC) and the Memory Address Register (MAR) during the Fetch stage of the fetch-decode-execute cycle.
PastPaper.showAnswers

PastPaper.workedSolution

During the fetch stage, the Program Counter (PC) holds the memory address of the next instruction to be fetched. This address is then copied to the Memory Address Register (MAR), which points the CPU to the specific memory location in RAM from which the instruction will be loaded.

PastPaper.markingScheme

1 mark: Stating that the PC holds the address of the next instruction to be fetched. 1 mark: Stating that this address is copied to the MAR to locate the instruction in RAM.
PastPaper.question 4 · Short Answer
2 PastPaper.marks
Explain the role of a Domain Name Service (DNS) server when a user requests a website by entering its URL.
PastPaper.showAnswers

PastPaper.workedSolution

When a URL is entered, the browser queries a DNS server. The DNS server searches its database to find the IP address that corresponds to the URL's domain name. It then sends this IP address back to the user's browser, allowing the browser to establish a direct connection to the correct web server.

PastPaper.markingScheme

1 mark: For explaining that the DNS server looks up the domain name (URL) and translates/resolves it to an IP address. 1 mark: For stating that the IP address is returned to the browser so it can connect to the target web server.
PastPaper.question 5 · Short Answer
2 PastPaper.marks
Identify two disadvantages of using parallel data transmission compared to serial data transmission.
PastPaper.showAnswers

PastPaper.workedSolution

Parallel data transmission sends multiple bits simultaneously over multiple physical wires. Disadvantages: 1. Data skewing: Over long distances, the electrical signals may travel at slightly different speeds, causing bits to arrive out of synchronization. 2. Cost: Parallel cables require multiple cores/wires, making them heavier, bulkier, and more expensive to manufacture and install over distance.

PastPaper.markingScheme

1 mark: Stating that bits can arrive out of synchronization (skewed) over long distances. 1 mark: Stating that it is more expensive or physically bulkier to implement because of multiple wires.
PastPaper.question 6 · Short Answer
2 PastPaper.marks
State two differences between lossy compression and lossless compression.
PastPaper.showAnswers

PastPaper.workedSolution

1. Lossy compression permanently discards redundant or less noticeable data, which reduces the file's overall quality and means the original file cannot be recreated. 2. Lossless compression reduces file size by reorganizing data (e.g., run-length encoding) without losing any information, allowing the original file to be reconstructed exactly. 3. Lossy compression yields significantly smaller file sizes compared to lossless compression.

PastPaper.markingScheme

1 mark: Stating that lossy permanently deletes data/reduces quality while lossless retains all original data/reconstructs perfectly. 1 mark: Stating that lossy achieves a much greater reduction in file size than lossless.
PastPaper.question 7 · Short Answer
2 PastPaper.marks
Explain how an interrupt is handled by a computer's Central Processing Unit (CPU).
PastPaper.showAnswers

PastPaper.workedSolution

When an interrupt signal is received: 1. The CPU finishes its current execution cycle and pauses the running program. 2. It saves the contents of its registers (current state). 3. It identifies the interrupt source and runs the corresponding Interrupt Service Routine (ISR). 4. After completing the ISR, the CPU restores the saved register states and resumes execution of the interrupted program.

PastPaper.markingScheme

1 mark: Stating that the CPU suspends current execution and saves the current state/registers. 1 mark: Stating that the CPU runs the Interrupt Service Routine (ISR) and restores the saved state to resume.
PastPaper.question 8 · Short Answer
2 PastPaper.marks
Describe the difference in key usage between symmetric and asymmetric encryption.
PastPaper.showAnswers

PastPaper.workedSolution

1. Symmetric encryption uses a single, identical secret key that must be kept secret and shared between the sender and receiver; this key is used to both encrypt and decrypt the plaintext. 2. Asymmetric encryption uses a key pair: a public key (distributed to anyone) to encrypt the data, and a mathematically linked private key (kept secret by the receiver) to decrypt the data.

PastPaper.markingScheme

1 mark: Stating that symmetric encryption uses a single shared key for both processes. 1 mark: Stating that asymmetric encryption uses a public key to encrypt and a private key to decrypt.
PastPaper.question 9 · Short Answer
2 PastPaper.marks
Identify one key difference in the functions of the Program Counter (PC) and the Memory Address Register (MAR) during the fetch stage of the fetch-decode-execute cycle.
PastPaper.showAnswers

PastPaper.workedSolution

During the fetch stage, the CPU uses the PC to keep track of what instruction is coming up next. This address is then copied to the MAR, which directly interfaces with the address bus to locate and read the current instruction from RAM. Thus, the PC looks ahead to the next instruction while the MAR holds the address of the memory location currently being read from.

PastPaper.markingScheme

1 mark for stating that the PC holds the address of the next instruction to be fetched. 1 mark for stating that the MAR holds the address of the current instruction or data being accessed/read from/written to memory.
PastPaper.question 10 · Short Answer
2 PastPaper.marks
Describe how a checksum is used to detect transmission errors.
PastPaper.showAnswers

PastPaper.workedSolution

A checksum is an error-detection value calculated from block data. The sending device calculates this value and appends it to the transmission. On receipt, the receiving device runs the same algorithm on the data block. If the calculated checksum matches the transmitted checksum, the data is assumed error-free; otherwise, a retransmission is requested.

PastPaper.markingScheme

1 mark for: Sender calculates checksum using an algorithm and transmits it with the data. 1 mark for: Receiver recalculates checksum and compares it; mismatch indicates error/retransmission request.
PastPaper.question 11 · Short Answer
2 PastPaper.marks
State two actions that the Central Processing Unit (CPU) takes when an interrupt signal is received.
PastPaper.showAnswers

PastPaper.workedSolution

When an interrupt occurs, the CPU must pause its current tasks safely without losing progress. It saves the contents of its registers (like the PC and accumulator) to a stack, identifies the source of the interrupt, and executes the appropriate Interrupt Service Routine (ISR). Once completed, it restores the register values and resumes the interrupted task.

PastPaper.markingScheme

Award 1 mark for each valid action up to a maximum of 2 marks: - Suspends/pauses execution of the current program - Saves the current status/registers/state - Identifies the source of the interrupt / loads the Interrupt Service Routine (ISR) - Resumes the original program after ISR finishes
PastPaper.question 12 · Short Answer
2 PastPaper.marks
Explain two reasons why computer systems programmers often prefer to write values in hexadecimal format rather than binary format.
PastPaper.showAnswers

PastPaper.workedSolution

Hexadecimal is a compact representation where one hex digit represents exactly four binary bits (a nibble). Programmers prefer it because it is much quicker to read and write than long strings of 1s and 0s, and it makes finding mistakes (such as typing errors in memory addresses or color codes) significantly easier.

PastPaper.markingScheme

Award 1 mark for each valid reason up to a maximum of 2 marks: - Hexadecimal is easier/quicker for humans to read/write/remember. - It is less prone to user input errors. - It is shorter/more compact (takes up less screen space). [Note: Do NOT accept 'takes up less memory/storage space in the computer'].
PastPaper.question 13 · Structured/Long Answer
6.375 PastPaper.marks
A register in a control system stores values as 12-bit two's complement signed binary integers. The current binary value stored in the register is:

1011 0110 1100

(a) Show how to convert this binary value to its denary equivalent. Show your working.
(b) Convert the binary value 1011 0110 1100 directly to hexadecimal. Show your working.
PastPaper.showAnswers

PastPaper.workedSolution

(a) For 12-bit signed two's complement, the most significant bit (MSB) has a weight of \(-2048\).
Using the bit weights:
\(-2048 + 512 + 256 + 64 + 32 + 8 + 4 = -1172\).
Alternatively, invert the bits of 1011 0110 1100 to get 0100 1001 0011, then add 1 to get 0100 1001 0100. Convert this to denary: \(1024 + 128 + 16 + 4 = 1172\). Since the original MSB was 1, the result is \(-1172\).

(b) Split the 12-bit binary number into groups of 4 bits from right to left:
1011 | 0110 | 1100
Convert each group to its hexadecimal equivalent:
1011 = 11 = B
0110 = 6 = 6
1100 = 12 = C
Combined result: B6C

PastPaper.markingScheme

Part (a): Total 3.375 marks
- 1 mark: Recognizing the negative weight of the MSB as \(-2048\) (or applying the correct inversion method).
- 1 mark: Showing a correct addition sequence (e.g., summing positive components or showing the inverted value with added 1).
- 1.375 marks: Correct final denary answer of \(-1172\).

Part (b): Total 3 marks
- 1 mark: Showing correct grouping of 4 bits (1011, 0110, 1100).
- 1 mark: Correctly converting at least two groups into hex digits.
- 1 mark: Correct final hexadecimal answer of B6C.
PastPaper.question 14 · Structured/Long Answer
6.375 PastPaper.marks
During the Fetch-Execute cycle, the central processing unit (CPU) moves instructions from main memory (RAM) to the processor. Explain the roles of the Program Counter (PC), the Memory Address Register (MAR), and the Memory Data Register (MDR) during the Fetch stage of this cycle. Make sure to describe the exact sequence of operations.
PastPaper.showAnswers

PastPaper.workedSolution

At the beginning of the Fetch stage:
1. The Program Counter (PC) holds the memory address of the next instruction to be fetched.
2. This address is copied from the PC to the Memory Address Register (MAR) via the address bus.
3. The Program Counter (PC) is then incremented by one to point to the address of the next sequential instruction.
4. A read signal is sent to main memory (RAM) via the control bus, and the content stored at the address in the MAR is retrieved.
5. This retrieved instruction/data is transferred via the data bus and loaded into the Memory Data Register (MDR).
6. Finally, the instruction is copied from the MDR to the Current Instruction Register (CIR) to be decoded.

PastPaper.markingScheme

Award marks up to 6.375 as follows:
- 1 mark: For stating that the PC contains/holds the address of the next instruction.
- 1 mark: For stating that the address in the PC is copied to the MAR.
- 1.375 marks: For stating that the PC is incremented (by one) to prepare for the next cycle.
- 1 mark: For stating that a read signal is sent to the memory location stored in the MAR.
- 1 mark: For stating that the instruction/data retrieved from RAM is copied into the MDR.
- 1 mark: For stating that the instruction is transferred from the MDR to the CIR (Current Instruction Register) for decoding.
PastPaper.question 15 · Structured/Long Answer
6.375 PastPaper.marks
A user enters the web address (URL) 'https://www.example-school.org/index.html' into their web browser. Describe how the web browser uses the Domain Name System (DNS) and IP addressing to retrieve and display the requested web page from the web server.
PastPaper.showAnswers

PastPaper.workedSolution

The sequence of steps is as follows:
1. The web browser extracts the domain name ('www.example-school.org') from the entered URL.
2. The browser checks its local cache for the IP address. If not found, it sends a request to a Domain Name System (DNS) server.
3. The DNS server looks up the domain name in its database of IP addresses. If it cannot find it, it queries other DNS servers higher up in the hierarchy.
4. Once found, the DNS server returns the unique IP address corresponding to the domain name back to the browser.
5. The browser uses this IP address to open a connection and send an HTTP/HTTPS request directly to the web server hosting the website.
6. The web server processes the request and sends the webpage files (e.g., 'index.html') back to the browser, which renders them for the user.

PastPaper.markingScheme

Award marks up to 6.375 as follows:
- 1 mark: Browser extracts the domain name from the URL.
- 1 mark: Browser queries a Domain Name System (DNS) server to find the matching IP address.
- 1.375 marks: DNS server resolves the domain to an IP address (optionally mentioning querying root/authoritative servers if not cached) and returns it to the browser.
- 1 mark: Browser sends an HTTP/HTTPS request directly to the web server using the resolved IP address.
- 1 mark: Web server retrieves the requested webpage files (HTML, CSS, images).
- 1 mark: Web server transmits the files back to the browser, which interprets and renders them on screen.
PastPaper.question 16 · Structured/Long Answer
6.375 PastPaper.marks
Data transmission can sometimes result in corrupted data. A system uses two-dimensional (2D) parity checks to detect and correct transmission errors.

(a) Explain how 2D parity checks can detect and correct a single-bit error.
(b) State one limitation of using a 2D parity check compared to a checksum.
PastPaper.showAnswers

PastPaper.workedSolution

(a) A two-dimensional (2D) parity check calculates an extra parity bit for each row and an extra parity bit for each column of a block of data. If a single bit is corrupted during transmission, it will cause a parity error in both its horizontal row and its vertical column. By looking at the intersection of the row and column containing the parity errors, the receiver can locate the exact coordinate of the corrupted bit and correct it by inverting it (changing a 0 to a 1, or vice versa).

(b) A 2D parity check has a limitation: if two bits change in the same row AND two bits change in the same column (even number of bit errors), the parity checks may not detect the errors. Additionally, it requires sending a high volume of extra redundant parity data (overhead) compared to a single checksum value representing the entire data packet.

PastPaper.markingScheme

Part (a): Total 4.375 marks
- 1 mark: Explaining that parity bits are added to both rows AND columns of a block of data.
- 1 mark: Explaining that the receiver recalculates parity for each row and column.
- 1 mark: Explaining that a single-bit error changes the parity values, resulting in one row mismatch and one column mismatch.
- 1.375 marks: Explaining that the intersection of the failed row and column locates the error, and the receiver corrects it by inverting (flipping) the bit value.

Part (b): Total 2 marks
- 1 mark: Explaining that multiple/even-numbered errors in the same row/column cannot be detected or corrected.
- 1 mark: Noting the high data overhead required to transmit the extra row and column parity bits.
PastPaper.question 17 · Structured/Long Answer
6.375 PastPaper.marks
An operating system manages interrupts to ensure the CPU can respond immediately to urgent events.

(a) Explain what is meant by an interrupt, and describe how the CPU processes an interrupt once it is detected.
(b) Give two distinct examples of hardware interrupts.
PastPaper.showAnswers

PastPaper.workedSolution

(a) An interrupt is a hardware or software signal sent to the CPU, indicating that a device or process requires immediate attention. At the end of every Fetch-Execute cycle, the CPU checks if any interrupt signals are present. If an interrupt is detected, the CPU saves its current state (such as the Program Counter and accumulator registers) onto a stack. It then loads the appropriate Interrupt Service Routine (ISR) address into the PC to execute the handler code. Once complete, the CPU restores the saved registers from the stack and resumes the interrupted task.

(b) Hardware interrupts include:
1. Keyboard input (e.g., a key is pressed by the user).
2. Printer status notification (e.g., paper out or paper jam error).

PastPaper.markingScheme

Part (a): Total 4.375 marks
- 1 mark: Defining an interrupt as a signal sent to the CPU requesting immediate processing/attention.
- 1 mark: Explaining that the CPU checks for interrupts at the end of each Fetch-Execute cycle.
- 1 mark: Explaining that the current registers/CPU state are saved to a stack to preserve progress.
- 1.375 marks: Explaining that the appropriate Interrupt Service Routine (ISR) is loaded and executed, after which the state is restored to resume the prior task.

Part (b): Total 2 marks
- 1 mark: Mentioning one valid hardware interrupt (e.g., keyboard input, mouse click, low battery, hardware timer).
- 1 mark: Mentioning a second, distinct valid hardware interrupt (e.g., peripheral error like a printer paper jam, disk controller ready).
PastPaper.question 18 · Structured/Long Answer
6.375 PastPaper.marks
An automated greenhouse ventilation window opens (W = 1) if any of the following conditions are met:
- The inside temperature is high (T = 1) AND the humidity is high (H = 1).
- The manual override switch is ON (M = 1) AND the rain sensor is OFF (R = 0).

(a) Write a Boolean expression to represent the conditions under which the window will open (W = 1).
(b) Calculate the state of W for each of the following four specific input combinations:
1) T = 1, H = 1, M = 0, R = 1
2) T = 0, H = 1, M = 1, R = 0
3) T = 1, H = 0, M = 1, R = 1
4) T = 0, H = 0, M = 1, R = 0
PastPaper.showAnswers

PastPaper.workedSolution

(a) The Boolean expression is:
\(W = (T \text{ AND } H) \text{ OR } (M \text{ AND NOT } R)\)

(b) Evaluate each combination:
1) \(T = 1, H = 1, M = 0, R = 1\):
\(W = (1 \text{ AND } 1) \text{ OR } (0 \text{ AND NOT } 1) = 1 \text{ OR } 0 = 1\).

2) \(T = 0, H = 1, M = 1, R = 0\):
\(W = (0 \text{ AND } 1) \text{ OR } (1 \text{ AND NOT } 0) = 0 \text{ OR } 1 = 1\).

3) \(T = 1, H = 0, M = 1, R = 1\):
\(W = (1 \text{ AND } 0) \text{ OR } (1 \text{ AND NOT } 1) = 0 \text{ OR } 0 = 0\).

4) \(T = 0, H = 0, M = 1, R = 0\):
\(W = (0 \text{ AND } 0) \text{ OR } (1 \text{ AND NOT } 0) = 0 \text{ OR } 1 = 1\).

PastPaper.markingScheme

Part (a): Total 2.375 marks
- 1 mark: Correct first term \(T \text{ AND } H\) (accept notation like \(T \cdot H\)).
- 1 mark: Correct second term \(M \text{ AND NOT } R\) (accept notation like \(M \cdot \overline{R}\)).
- 0.375 marks: Combining both terms correctly with an \(\text{OR}\) operator.

Part (b): Total 4 marks (1 mark per correct calculation)
- 1 mark: Correct calculation of W = 1 for combination 1.
- 1 mark: Correct calculation of W = 1 for combination 2.
- 1 mark: Correct calculation of W = 0 for combination 3.
- 1 mark: Correct calculation of W = 1 for combination 4.
PastPaper.question 19 · Structured/Long Answer
6.375 PastPaper.marks
An online streaming platform stores both music tracks (audio) and high-resolution album artwork (images).

(a) Explain the fundamental difference between lossy compression and lossless compression.
(b) Discuss why lossless compression is appropriate for the system's database structure or configuration files, whereas lossy compression is acceptable for streaming the audio tracks to end-users.
PastPaper.showAnswers

PastPaper.workedSolution

(a) Lossy compression permanently discards some of the original data (often targeting data that the human eye or ear cannot easily detect) to achieve significant reductions in file size. Once compressed, the original data cannot be reconstructed exactly. Lossless compression, on the other hand, reduces file size by identifying and rewriting patterns of redundant data without losing any details. It allows the original file to be reconstructed bit-for-bit with 100% accuracy.

(b) For database and configuration files, lossless compression is mandatory. Any permanent loss of text, identifiers, or configuration values would corrupt the database records, causing syntax errors or catastrophic software failures. For audio streaming, lossy compression (such as MP3 or AAC) is highly beneficial because it minimizes file sizes, drastically reducing the bandwidth required to stream music over mobile or broadband networks. This prevents buffering and speeds up transmission, while the lost audio details (very high frequencies or quieter sounds masked by louder ones) are mostly imperceptible to the average listener.

PastPaper.markingScheme

Part (a): Total 2.375 marks
- 1 mark: Explaining lossy compression as permanently removing details/data to achieve smaller file sizes.
- 1 mark: Explaining lossless compression as reducing file size without losing any original data, allowing exact reconstruction.
- 0.375 marks: Clear use of correct technical vocabulary (such as permanent data loss vs. exact reconstruction).

Part (b): Total 4 marks
- 1 mark: Stating that database/config files must be exact because minor file corruptions render them unusable.
- 1 mark: Explaining that lossless compression ensures executable instructions or alphanumeric data remain complete and functional.
- 1 mark: Stating that lossy compression is suitable for audio because streaming requires low bandwidth / fast transfer speeds to prevent buffering.
- 1 mark: Explaining that human sensory limitations mean discarded audio frequencies go largely unnoticed, presenting an acceptable quality trade-off.
PastPaper.question 20 · Structured/Long Answer
6.375 PastPaper.marks
Cyber security threats often trick users into revealing sensitive data. Two common methods used by attackers are phishing and pharming.

(a) Explain how phishing and pharming differ in terms of how a user is directed to a malicious website.
(b) State three distinct preventive measures or indicators a user should check to avoid falling victim to these attacks.
PastPaper.showAnswers

PastPaper.workedSolution

(a) Phishing relies on social engineering. An attacker sends a fraudulent communication (like an email or text) designed to look legitimate, containing a hyperlink. The user is directed to the malicious site only if they actively click on that fake link. Pharming is a technical exploit. The attacker infects a user's computer with malware or poisons a DNS server's cache. This causes the user to be automatically redirected to a malicious spoofed website, even if the user correctly typed the official, legitimate URL into their browser's address bar.

(b) Preventive measures and indicators include:
1. Carefully checking the address bar for spelling irregularities or domain discrepancies (e.g., 'paypa1.com' instead of 'paypal.com').
2. Verifying that the connection uses HTTPS and has a valid, trustworthy security certificate (often indicated by a padlock icon).
3. Installing and regularly updating anti-virus and anti-malware software to prevent local DNS redirection scripts from running.

PastPaper.markingScheme

Part (a): Total 3.375 marks
- 1.5 marks: Describing phishing as involving communication (emails) that trick the user into voluntarily clicking a malicious link.
- 1.5 marks: Describing pharming as a technical attack (DNS poisoning or malware redirection) that automatically reroutes a user's web traffic even when typing a correct URL.
- 0.375 marks: Clearly contrasting the user's active click (phishing) against technical automation (pharming).

Part (b): Total 3 marks
- 1 mark: Mentioning checking the URL address bar closely for spoofing or typographical variations.
- 1 mark: Mentioning inspecting the HTTPS padlock icon/security certificate details.
- 1 mark: Mentioning using anti-malware tools or avoiding links in unsolicited emails.

Paper 2 Algorithms, Programming and Logic

Answer all questions in the space provided. Show all your working.
8 PastPaper.question · 74.99000000000001 PastPaper.marks
PastPaper.question 1 · Structured
8.57 PastPaper.marks
A temperature monitoring system reads temperature sensor values.

Write a pseudocode algorithm that meets the following requirements:
- Repeatedly inputs temperature values.
- Validates each input: a temperature is valid if it is between -50.0 and +50.0 degrees Celsius (inclusive).
- Keeps a count of how many invalid temperatures were entered.
- Calculates the average of all valid temperatures.
- The input process terminates when the sentinel value 999.0 is entered.
- Outputs the average of the valid temperatures and the count of invalid temperatures at the end (ensure you handle the case where no valid temperatures are entered to avoid division by zero).
PastPaper.showAnswers

PastPaper.workedSolution

The pseudocode starts by declaring and initializing the necessary variables: `Sum` (for running total of valid temperatures), `ValidCount` (to count valid inputs for average calculation), and `InvalidCount` (to count inputs outside the range).

An initial `INPUT` statement obtains the first temperature before entering the `WHILE` loop, which is conditioned to run as long as `Temp` is not equal to `999.0`.

Inside the loop:
- An `IF` condition checks if the input is within the range \([-50.0, 50.0]\).
- If valid, the value is added to `Sum` and `ValidCount` is incremented.
- If invalid, `InvalidCount` is incremented.
- A subsequent `INPUT` updates `Temp` to allow the loop to progress.

After the loop finishes, an `IF` statement checks if `ValidCount` is greater than 0 to prevent a division-by-zero error. If true, the average is calculated and outputted. Finally, the count of invalid entries is printed.

PastPaper.markingScheme

Max 8.57 marks:
- 1 mark: Declaration/initialization of variables (Sum, ValidCount, InvalidCount) with appropriate starting values.
- 1 mark: Appropriate loop (e.g., WHILE) with the correct terminating condition (Temp <> 999.0).
- 1 mark: Correct placement of initial and subsequent INPUT statements inside and outside the loop.
- 1 mark: Correct IF statement validating the temperature range (>= -50.0 and <= 50.0).
- 1 mark: Correct updates to running Sum and count of valid inputs.
- 1 mark: Correct update to count of invalid inputs inside the ELSE branch.
- 1 mark: Correct conditional check to prevent division-by-zero (ValidCount > 0) before division.
- 1 mark: Correct calculation of average.
- 0.57 marks: Outputting both the computed average (if valid inputs exist) and the invalid count.
PastPaper.question 2 · Structured
8.57 PastPaper.marks
A database table named `STUDENTS` stores information about school pupils. The fields are: `StudentID` (text), `Name` (text), `Grade` (integer), `House` (text), and `FeesPaid` (boolean).

(a) Write an SQL query to retrieve the `Name` and `Grade` of all students who belong to 'Red' house and have NOT paid their fees (`FeesPaid` is FALSE). The results must be sorted alphabetically by `Name`.

(b) Describe a validation check that could be performed on the `StudentID` field to ensure it always starts with two letters followed by exactly four digits (e.g., AB1234).
PastPaper.showAnswers

PastPaper.workedSolution

(a) The query requires specifying the exact columns (`Name` and `Grade`) in the `SELECT` clause, filtering with `WHERE` for the conditions `House = 'Red'` and `FeesPaid = FALSE`, and sorting using `ORDER BY Name ASC` (or just `ORDER BY Name` as ascending is default).

(b) Validation is automated logic checking if data matches expected patterns. For `StudentID`, a format check is perfect. It decomposes the 6-character string to check data types at specific offsets: two letters, then four digits.

PastPaper.markingScheme

(a) SQL Query [4.57 marks total]:
- 1 mark: SELECT Name, Grade
- 1 mark: FROM STUDENTS
- 1.57 marks: WHERE House = 'Red' AND FeesPaid = FALSE (accept: FeesPaid = 0, FeesPaid = No, NOT FeesPaid)
- 1 mark: ORDER BY Name (accept default or ASC)

(b) Validation Check [4 marks total]:
- 1 mark: Name of validation check (Format check / Picture check / Length check).
- 1 mark: Explaining checking for character length (exactly 6).
- 1 mark: Explaining checking that first 2 characters are alphabetical.
- 1 mark: Explaining checking that last 4 characters are numeric digits.
PastPaper.question 3 · Structured
8.57 PastPaper.marks
A greenhouse ventilation system operates a fan (F) based on four digital inputs: Temperature is high (T), Humidity is high (H), Manual override switch is active (M), and Window is open (W). All inputs are binary (0 for false/low, 1 for true/high/active).

The fan is turned ON (F = 1) if:
- The temperature is high AND the humidity is high
OR
- The manual override is active AND the window is NOT open.

(a) Write a Boolean logic expression for this system.

(b) List all combinations of inputs (T, H, M, W) that would result in the fan being turned ON (F = 1). Represent each state as a 4-bit binary sequence in the order T, H, M, W.
PastPaper.showAnswers

PastPaper.workedSolution

(a) Translating the system description into boolean operators:
- "The temperature is high AND the humidity is high" becomes \( T \text{ AND } H \).
- "the manual override is active AND the window is NOT open" becomes \( M \text{ AND NOT } W \).
- These two expressions are combined using `OR` to form the overall function: \( F = (T \text{ AND } H) \text{ OR } (M \text{ AND NOT } W) \).

(b) To find where F = 1, evaluate both clauses:
- Clause 1: \( T = 1 \) and \( H = 1 \). This corresponds to combinations starting with `11`:
- 1100
- 1101
- 1110
- 1111
- Clause 2: \( M = 1 \) and \( W = 0 \). This corresponds to any combination where the last two bits are `10`:
- 0010
- 0110
- 1010
- 1110 (already listed under Clause 1)

Combining both groups gives the unique states: 0010, 0110, 1010, 1100, 1101, 1110, 1111.

PastPaper.markingScheme

(a) Boolean Expression [3.57 marks]:
- 1 mark: Correct representation of (T AND H).
- 1 mark: Correct representation of (M AND NOT W) (accept: M AND W').
- 1 mark: Joining the terms with an OR operator.
- 0.57 marks: Syntactically correct formula (proper parentheses/order of operations).

(b) Output combinations [5 marks]:
- Deduct 1 mark for each incorrect or missing state from the target list of 7 states:
- 0010 (1 mark)
- 0110 (1 mark)
- 1010 (1 mark)
- 1100 (1 mark)
- 1101 (1 mark)
- 1110 (0.57 marks for this / last values)
- 1111 (0.43 marks for this / last values)
- Maximum of 5 marks.
PastPaper.question 4 · Structured
8.57 PastPaper.marks
A one-dimensional array named `Scores` contains 100 integers representing exam marks ranging from 0 to 100.

Write a pseudocode algorithm to find and output:
- The highest mark in the array
- The lowest mark in the array
- The range of the marks (the difference between the highest and lowest mark)
- The number of students who scored a passing mark of 50 or above.
PastPaper.showAnswers

PastPaper.workedSolution

The algorithm initializes the search variables:
- `Highest` is set to the first element `Scores[1]` to track the maximum value.
- `Lowest` is set to the first element `Scores[1]` to track the minimum value.
- `PassCount` is initialized to 0 to keep track of marks >= 50.

Next, a loop from 1 to 100 is executed to examine each element of the array. Within this loop, three conditional checks run:
1. If the current element is higher than `Highest`, `Highest` takes its value.
2. If the current element is lower than `Lowest`, `Lowest` takes its value.
3. If the current element is greater than or equal to 50, `PassCount` is incremented.

Once the loop finishes processing, the range is calculated by subtracting `Lowest` from `Highest`. Finally, all required statistics are outputted.

PastPaper.markingScheme

Max 8.57 marks:
- 1 mark: Correct variable declarations for tracking indices and counts.
- 1 mark: Initializing Highest and Lowest to sensible starting values (either first element or extremes like -1 and 101).
- 1 mark: Initializing PassCount to 0.
- 1 mark: Correct construction of loop from 1 to 100 (or 0 to 99 depending on array bounds index logic).
- 1 mark: Check inside the loop to update the Highest score.
- 1 mark: Check inside the loop to update the Lowest score.
- 1 mark: Correct check for passing mark (Scores[Index] >= 50) and incrementing PassCount.
- 1 mark: Correct logic to calculate Range (Highest - Lowest).
- 0.57 marks: Clear OUTPUT statements displaying all four requested parameters.
PastPaper.question 5 · Structured
8.57 PastPaper.marks
A software program needs to process a text file named `students.txt`. Each line of the text file contains a student's name.

Write a pseudocode algorithm that:
- Opens the text file `students.txt` in read mode.
- Reads each name from the file line by line.
- Counts how many names begin with the uppercase letter 'A'.
- Terminates when the end of the file (EOF) is reached.
- Closes the file.
- Outputs the total count of names that began with 'A'.

You must assume the file exists and contains names.
PastPaper.showAnswers

PastPaper.workedSolution

To achieve this, the program uses sequential file processing.
- Open statement: `OPEN "students.txt" FOR READ` prepares the file.
- Loop condition: `WHILE NOT EOF("students.txt")` runs until the file pointer reaches the end.
- Reading lines: `READLINE "students.txt", StudentName` pulls the string from the current line.
- String manipulation: We extract the first letter using `SUBSTRING(StudentName, 1, 1)` (or equivalent array-like indexing such as `StudentName[1]`) and check if it matches "A".
- Counting: If verified, `Count` increases by 1.
- Post-loop: We close the file using `CLOSE "students.txt"` to release system resources and output the computed total.

PastPaper.markingScheme

Max 8.57 marks:
- 1.57 marks: Correct file open syntax (`OPEN "students.txt" FOR READ` or equivalent).
- 1 mark: Initialize count variable to 0.
- 1.57 marks: Correct loop condition checking for End of File (`NOT EOF(...)`).
- 1 mark: Correct read instruction inside the loop (`READLINE` / `READ`).
- 1.43 marks: Correct string indexing to check the first character (e.g. `StudentName[1] = "A"` or `SUBSTRING(...)`).
- 1 mark: Incrementing counter correctly inside conditional block.
- 1 mark: Closing file (`CLOSE`) and outputting the final count.
PastPaper.question 6 · Structured
8.57 PastPaper.marks
Consider the following pseudocode algorithm:

```text
INPUT Num1
INPUT Num2
Result <- 0
Temp <- Num1
WHILE Temp >= Num2 DO
Temp <- Temp - Num2
Result <- Result + 1
ENDWHILE
Remainder <- Temp
OUTPUT Result
OUTPUT Remainder
```

(a) Trace this algorithm using a trace table for input values `Num1 = 14` and `Num2 = 4`.

(b) Describe the mathematical purpose of this algorithm.
PastPaper.showAnswers

PastPaper.workedSolution

(a)
- Initially: `Num1` is 14, `Num2` is 4. `Result` is set to 0, `Temp` is assigned 14.
- Loop Iteration 1: `Temp >= Num2` (14 >= 4) is true. `Temp` becomes 14 - 4 = 10. `Result` becomes 0 + 1 = 1.
- Loop Iteration 2: `Temp >= Num2` (10 >= 4) is true. `Temp` becomes 10 - 4 = 6. `Result` becomes 1 + 1 = 2.
- Loop Iteration 3: `Temp >= Num2` (6 >= 4) is true. `Temp` becomes 6 - 4 = 2. `Result` becomes 2 + 1 = 3.
- Loop Iteration 4: `Temp >= Num2` (2 >= 4) is false. The loop terminates.
- Final line updates: `Remainder` is assigned `Temp` (which is 2).
- Outputs are `Result` (3) and `Remainder` (2).

(b) The algorithm performs division without using mathematical division operators by repeatedly subtracting the divisor (`Num2`) from the dividend (`Num1`). The number of successful subtractions is the quotient (`Result`), and the leftover value is the remainder (`Remainder`).

PastPaper.markingScheme

(a) Trace Table [6.57 marks total]:
- 1 mark: Row showing inputs correctly assigned: Num1 = 14, Num2 = 4, Result = 0, Temp = 14.
- 1.57 marks: First loop iteration showing Temp updated to 10 and Result updated to 1.
- 1 mark: Second loop iteration showing Temp updated to 6 and Result updated to 2.
- 1 mark: Third loop iteration showing Temp updated to 2 and Result updated to 3.
- 1 mark: Exit of loop and correct assignment of Remainder as 2.
- 1 mark: Outputs clearly documented as 3 and 2.

(b) Algorithm Purpose [2 marks]:
- 1 mark: Mentioning it calculates integer division / quotient.
- 1 mark: Mentioning it calculates the remainder / modulo.
PastPaper.question 7 · Structured
8.57 PastPaper.marks
A registration form requires users to enter an email address.

(a) Describe two validation checks that can be performed on the entered email address to ensure it is in a valid format.

(b) Describe how verification is different from validation, and name two methods of verification that can be used to ensure the email was entered correctly by the user.
PastPaper.showAnswers

PastPaper.workedSolution

(a) Common validation checks for email inputs include:
- Format check: Ensures key characters ('@' and '.') exist in the correct locations.
- Presence check: Prevents empty submissions.
- Length check: Restricts entry size within realistic parameters (e.g., between 5 and 100 characters).

(b) Validation only guarantees that the data looks realistic (e.g., 'me@here.com' is syntactically correct). Verification ensures that it matches the user's real email address. The standard verification methods are double entry (re-typing) and visual verification (reading from a confirmation window).

PastPaper.markingScheme

(a) Validation Checks [4 marks total]:
- 1 mark: Identifying a valid check (e.g., Format, Presence, or Length check).
- 1 mark: Explaining how that specific check is applied to the email string.
- 1 mark: Identifying a second valid check.
- 1 mark: Explaining how the second check is applied to the email string.

(b) Verification and Methods [4.57 marks total]:
- 1.57 marks: Explaining difference between validation (conformance to system rules) and verification (matching actual source/accuracy).
- 1.57 marks: Describing double entry (comparing two independent identical inputs).
- 1.43 marks: Describing visual check (user self-checking printed display output).
PastPaper.question 8 · Programming Scenario
15 PastPaper.marks
A cinema wants a program to manage ticket bookings for its premium screen, which has 10 rows and 12 seats per row. Write an algorithm in pseudocode that meets the following requirements:

- Declares and initializes a 2D array of size 10 rows by 12 seats to store the booking status. All seats must initially be empty, represented by the string 'E'.
- Prompts the user to enter a row number (1 to 10) or -1 to finish booking.
- If the user does not enter -1, prompts for a seat number (1 to 12).
- Validates both row and seat inputs. If either is invalid, outputs an error message and prompts again.
- Checks if the chosen seat is already booked (represented by 'B'). If it is booked, outputs a message saying 'Already booked'. If it is empty, updates its status to 'B', increments the count of booked seats, and outputs 'Booking successful'.
- Continues to loop until -1 is entered for the row number.
- When the loop finishes, calculates and outputs:
1. The total number of seats booked.
2. The total revenue generated (each ticket costs $12.50).
3. The percentage of total seats that have been booked.
PastPaper.showAnswers

PastPaper.workedSolution

An exemplary pseudocode solution is shown below:

```
DECLARE SeatingPlan[1:10, 1:12] OF STRING
DECLARE RowNumber, SeatNumber, BookedCount : INTEGER
DECLARE Revenue, Percentage : REAL

// Initialize all seats to Empty ('E')
FOR Row <- 1 TO 10
FOR Seat <- 1 TO 12
SeatingPlan[Row, Seat] <- "E"
NEXT Seat
NEXT Row

BookedCount <- 0

OUTPUT "Enter row number (1 to 10) or -1 to stop:"
INPUT RowNumber

WHILE RowNumber <> -1 DO
IF RowNumber < 1 OR RowNumber > 10 THEN
OUTPUT "Invalid row number. Please enter a value between 1 and 10."
ELSE
OUTPUT "Enter seat number (1 to 12):"
INPUT SeatNumber
IF SeatNumber < 1 OR SeatNumber > 12 THEN
OUTPUT "Invalid seat number. Please enter a value between 1 and 12."
ELSE
IF SeatingPlan[RowNumber, SeatNumber] = "B" THEN
OUTPUT "Sorry, this seat is already booked."
ELSE
SeatingPlan[RowNumber, SeatNumber] <- "B"
BookedCount <- BookedCount + 1
OUTPUT "Booking successful!"
ENDIF
ENDIF
ENDIF

OUTPUT "Enter row number (1 to 10) or -1 to stop:"
INPUT RowNumber
ENDWHILE

Revenue <- BookedCount * 12.5
Percentage <- (BookedCount / 120) * 100

OUTPUT "Total seats booked: ", BookedCount
OUTPUT "Total revenue: $", Revenue
OUTPUT "Percentage of seats occupied: ", Percentage, "%"
```

PastPaper.markingScheme

Marks are awarded as follows (maximum 15 marks):

- 1 mark: Correctly declare and initialize a 2D array of size 10 rows by 12 columns with 'E' using nested loops.
- 1 mark: Prompt and input row number before/at the start of the loop.
- 1 mark: Create a loop that terminates when row number is -1 (e.g., WHILE RowNumber <> -1).
- 1 mark: Prompt and input seat number inside the loop.
- 2 marks: Validate row number (1 to 10) and seat number (1 to 12) (1 mark for row validation, 1 mark for seat validation).
- 2 marks: Check if seat is already booked ('B') or empty ('E') (1 mark for condition, 1 mark for handling alternative branch).
- 2 marks: Update seat status to 'B' (1 mark) and increment a booking counter (1 mark) if empty.
- 1 mark: Output appropriate success and error messages.
- 1 mark: Re-prompt and input row number at the end of the loop structure.
- 1 mark: Calculate total revenue correctly (booked seats * 12.50).
- 1 mark: Calculate percentage occupancy correctly (booked seats / 120 * 100).
- 1 mark: Output all final required values (booked seats, total revenue, and percentage occupied) with descriptive labels.

Acceptable alternative implementations using a DO-WHILE or REPEAT-UNTIL structure can be awarded full marks if logical equivalence is maintained.

PastPaper.sampleCTATitle

PastPaper.sampleCTADescription

PastPaper.sampleStickyMessage

PastPaper.stickyCtaText