An original Thinka practice paper modelled on the structure and difficulty of the Nov 2025 (V3) Cambridge International A Level Computer Science (0478) paper. Not affiliated with or reproduced from Cambridge.
Paper 1 Computer Systems
Answer all questions. Calculators must not be used in this paper. Total marks: 75.
27 Question · 75.39999999999998 marks
Question 1 · Short Answer
1.5 marks
Convert the 8-bit binary number \(11010011\) into hexadecimal, and state one practical reason why computer programmers use hexadecimal representation instead of binary.
Show answer & marking schemeHide answer & marking scheme
Worked solution
First, split the 8-bit binary number into two 4-bit nibbles: The left nibble is 1101, which is 13 in denary, corresponding to the hexadecimal digit D. The right nibble is 0011, which is 3 in denary, corresponding to the hexadecimal digit 3. Combining these gives the hexadecimal value D3. Programmers prefer hexadecimal because it is shorter, much easier to read or remember, and less prone to errors during manual transcription than long binary strings.
Marking scheme
1 mark for the correct hexadecimal conversion (D3). 0.5 marks for a valid reason (e.g., easier for humans to read/write/debug, less prone to transcription errors, or more compact representation).
Question 2 · Short Answer
1.5 marks
Describe the main difference between serial data transmission and parallel data transmission, and state one reason why serial data transmission is preferred for long-distance communication.
Show answer & marking schemeHide answer & marking scheme
Worked solution
In serial transmission, data is sent sequentially, one bit after another, down a single communication channel or wire. In parallel transmission, multiple bits are sent at the same time down multiple parallel wires. Serial is preferred over long distances because parallel transmission suffers from skew (where bits arrive at slightly different times due to tiny differences in wire length, causing corruption) and is much more expensive to install due to the requirement for multiple cables.
Marking scheme
1 mark for describing the main difference (serial transmits one bit sequentially over one wire, while parallel transmits multiple bits simultaneously over multiple wires). 0.5 marks for a valid reason why serial is preferred over long distances (e.g., avoids data skew, suffers less from interference, or is cheaper to install over long distances).
Question 3 · Short Answer
1.5 marks
Explain the fundamental difference between lossy compression and lossless compression, and state which of these methods must be used for compressing a text document.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Lossy compression algorithms achieve smaller file sizes by identifying and permanently removing non-essential or redundant data. Lossless compression reduces file size by reorganising the data without losing any information, allowing the original file to be reconstructed exactly. A text document must use lossless compression because any loss of data would change the characters, resulting in spelling errors, missing text, or a completely unreadable document.
Marking scheme
1 mark for explaining the fundamental difference (lossy discards data permanently, while lossless retains all original data allowing exact reconstruction). 0.5 marks for stating that lossless compression must be used for text.
Question 4 · Short Answer
1.5 marks
Describe the role of the Program Counter (PC) in the Von Neumann CPU architecture, and state what happens to its value immediately after an instruction is fetched.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The Program Counter (PC) is a register inside the CPU. Its main purpose is to store the memory address of the next instruction that needs to be fetched from memory for execution. As soon as the current instruction is fetched, the PC value is incremented so that it points to the memory address of the next sequential instruction.
Marking scheme
1 mark for describing the role (holds/stores the address of the next instruction to be fetched). 0.5 marks for stating what happens to its value after fetching (incremented to point to the next instruction).
Question 5 · Short Answer
1.5 marks
State what is meant by an interrupt in a computer system, and give two examples of hardware-generated interrupts.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An interrupt is a hardware or software signal sent to the processor, indicating that an event has occurred that requires immediate attention. When received, the CPU suspends its current execution cycle, saves its state, and runs an Interrupt Service Routine (ISR) to handle the event. Two hardware-generated interrupts could include: 1) A keyboard key being pressed, 2) A printer running out of paper.
Marking scheme
0.5 marks for explaining the concept of an interrupt (signal to CPU requesting attention or suspending current tasks). 1 mark for providing two valid hardware-generated interrupts (0.5 marks each, e.g., key press, mouse click, printer out of paper, power failure).
Question 6 · Short Answer
1.5 marks
Explain the role of a Domain Name Service (DNS) server when a user types a URL into a web browser, and identify one piece of data stored in a DNS record.
Show answer & marking schemeHide answer & marking scheme
Worked solution
When a user enters a URL into their web browser, the computer cannot locate the website directly using text. It sends a request to a DNS server. The DNS server looks up the domain name and translates or resolves it into its corresponding IP address. The browser then uses this IP address to locate and connect to the web server. A DNS record stores the domain name, its corresponding IP address, and other parameters such as Time to Live (TTL).
Marking scheme
1 mark for explaining the role (translates domain names or URLs into IP addresses so the browser can connect to the server). 0.5 marks for identifying one piece of stored data (e.g., the domain name, the associated IP address, or TTL).
Question 7 · Short Answer
1.5 marks
Distinguish between phishing and pharming by explaining how they redirect or deceive users to gain personal data.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Phishing is an attack where cybercriminals send fraudulent emails designed to look like they come from a legitimate source. These emails contain a link that tricks the user into visiting a fake website to enter details. Pharming does not rely on email links; instead, it involves installing malicious code on the user's computer or poisoning a DNS server, which automatically and silently redirects legitimate URL requests to a fake website.
Marking scheme
1 mark for distinguishing the mechanism (phishing relies on deceptive emails containing links, while pharming relies on malicious code or DNS poisoning to automatically redirect legitimate URL requests). 0.5 marks for identifying their common goal (stealing sensitive personal details).
Question 8 · Short Answer
1.5 marks
Identify the three key components of an Expert System, and briefly state the purpose of the inference engine.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An Expert System consists of three main components: 1. User Interface, 2. Knowledge Base, 3. Inference Engine. The purpose of the inference engine is to act as the reasoning engine. It applies logical rules (such as IF-THEN rules) to the facts stored in the knowledge base to deduce new information, answer queries, or suggest diagnoses.
Marking scheme
0.5 marks for listing all three key components (User Interface, Knowledge Base, Inference Engine). 1 mark for explaining the purpose of the inference engine (applying logical rules to the knowledge base to reason and output conclusions).
Question 9 · Short Answer
1.5 marks
State the type of data transmission that sends multiple bits of data simultaneously over multiple channels or wires, and explain one advantage of using this method over sending data bit-by-bit.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The correct method of transmission described is parallel data transmission. Parallel transmission is significantly faster than serial transmission because it sends several bits at the exact same time over multiple physical lines, rather than one bit at a time over a single wire.
Marking scheme
• 0.5 marks: Correctly identifying 'Parallel' data transmission. • 1.0 marks: Providing a valid explanation of its advantage (e.g., faster data transmission rate / multiple bits sent at the same time). Reject: 'cheaper' or 'more reliable over long distances'.
Question 10 · Short Answer
1.5 marks
In the Von Neumann CPU architecture, describe the role of the Program Counter (PC) during the fetch stage of the instruction cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The Program Counter (PC) is a dedicated register that stores the memory address of the next instruction that needs to be executed. At the start of the fetch stage, this address is sent to the Memory Address Register (MAR) via the address bus. Once the instruction address is copied, the PC is incremented by 1 so that it is ready to point to the subsequent instruction in the sequence.
Marking scheme
• 0.5 marks: Stating that the PC holds the address of the next instruction to be fetched. • 1.0 marks: Explaining the transition process (address is copied to the MAR, and the PC is incremented by 1).
Question 11 · Short Answer
1.5 marks
Explain the key difference between lossy and lossless file compression in terms of data recovery, and name one standard file type where lossy compression is commonly applied.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Lossy compression algorithms achieve smaller file sizes by permanently removing non-essential data (such as sounds humans cannot hear or subtle color differences), meaning the original raw file cannot be recovered. Lossless compression reduces file size without losing any data, allowing the exact original file to be reconstructed. JPEG is a common lossy image file format.
Marking scheme
• 1.0 marks: Explaining that lossy permanently deletes data / cannot reconstruct the original file, while lossless retains all data / reconstructs perfectly. • 0.5 marks: Stating an appropriate lossy file extension (e.g., JPEG, JPG, MP3, MP4). Reject: PNG, BMP, TXT.
Question 12 · Short Answer
1.5 marks
Describe how pharming operates to compromise a user's web security, and state one way a user can detect or prevent this threat.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Pharming is a cyber attack where malicious code is installed on a user's computer or a DNS server. This code intercepts web traffic and redirects the user to a fraudulent, look-alike website, even when the user types the correct web address. To prevent or detect pharming, users should verify that the website uses 'https://' with a valid security certificate (symbolized by a padlock in the address bar) and use updated anti-spyware/anti-malware software.
Marking scheme
• 1.0 marks: Describing that malicious code/malware redirects the user to a fraudulent website even if they input the correct URL (or by corrupting DNS tables). • 0.5 marks: Stating a valid defense/detection method (e.g., checking for HTTPS/padlock, inspecting digital certificates, or using updated anti-malware software).
Question 13 · Structured/Explain
3.8 marks
A security system sends video feed from a camera to a monitor located in a control room. Explain the difference between simplex and duplex data transmission, and state which method is most appropriate for this security camera feed.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Simplex transmission allows data to travel in only one direction (from sender to receiver), whereas duplex transmission allows data to travel in both directions at the same time. In this scenario, the video feed only needs to go from the camera to the monitor without any return feed, making simplex the most appropriate and cost-effective choice.
Marking scheme
1 mark for explaining simplex (one direction only). 1 mark for explaining duplex (both directions simultaneously). 1 mark for identifying simplex as the correct transmission method. 1 mark for justifying the choice (the camera only sends video data to the monitor; there is no feedback loop required).
Question 14 · Structured/Explain
3.8 marks
An image file is compressed using lossy compression to reduce its storage size. Explain how lossy compression reduces the file size of an image, and describe one disadvantage of using this compression method.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Lossy compression algorithms reduce file size by identifying and permanently deleting redundant or non-essential data. For example, in an image, it identifies colors that are very similar and simplifies them into a single color, which the human eye cannot easily detect. The disadvantage is that the original high quality cannot be fully restored once the file is compressed.
Marking scheme
1 mark for explaining that lossy compression permanently deletes/removes data. 1 mark for explaining how it targets redundant data/data less noticeable to human perception (e.g. similar colors). 1 mark for explaining that the original file cannot be reconstructed exactly. 1 mark for stating a disadvantage (e.g. reduction in image quality / loss of detail).
Question 15 · Structured/Explain
3.8 marks
Explain how a checksum is used to verify that a block of data has been transmitted without errors.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A checksum is calculated using a specific algorithm applied to the block of data before transmission. The calculated checksum value is appended to the data payload. Once received, the receiving device runs the same algorithm on the received data. The receiver compares its calculated checksum with the transmitted checksum. If they match, the transmission is assumed error-free; otherwise, an error is detected and a request for retransmission is made.
Marking scheme
1 mark for stating that the checksum is calculated prior to transmission using an algorithm. 1 mark for stating that the calculated value is sent alongside the data block. 1 mark for stating that the receiver recalculates the checksum using the same algorithm. 1 mark for explaining the comparison: if they match, data is correct; if they differ, an error occurred and retransmission is requested.
Question 16 · Structured/Explain
3.8 marks
Describe the function and operation of the Program Counter (PC) during the Fetch-Decode-Execute (FDE) cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The Program Counter (PC) is a dedicated register inside the CPU. Its primary purpose is to store the memory address of the next instruction that needs to be fetched and executed. At the beginning of the Fetch stage, the address stored in the PC is copied to the Memory Address Register (MAR). Immediately after this, the PC is incremented by 1 so that it points to the next instruction in sequence, preparing for the next cycle.
Marking scheme
1 mark for stating that the PC holds the address of the next instruction to be fetched. 1 mark for stating that the address in the PC is copied to the MAR. 1 mark for stating that the PC is incremented (by 1). 1 mark for explaining that this preparing phase happens during/at the start of the fetch stage.
Question 17 · Structured/Explain
3.8 marks
A company's online login portal is vulnerable to brute-force attacks. Describe how a brute-force attack works and explain two different technical measures the company can implement to protect their portal from this specific type of attack.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A brute-force attack is a trial-and-error method where an automated program systematically guesses every possible combination of passwords or PINs until the correct one is discovered. To defend against this, the company can: 1) Set an account lockout policy that temporarily or permanently locks an account after a specified number of consecutive failed login attempts (e.g., 3 or 5). 2) Introduce a time delay between login attempts that increases with each failure, making automated guessing impractical. 3) Implement CAPTCHA challenges to ensure that logins are performed by humans rather than automated brute-force scripts.
Marking scheme
1 mark for explaining the nature of brute-force (systematically trying all possible combinations/guesses using automated tools). 1 mark for identifying/explaining the first technical measure (e.g. account lockout after multiple failed attempts). 1 mark for identifying/explaining the second technical measure (e.g. implementing CAPTCHAs, or forcing a delay/rate-limiting). 1 mark for clear description of how either measure stops the automated nature of the attack.
Question 18 · Structured/Explain
3.8 marks
Explain the role of interrupts in a computer system and describe what happens inside the CPU when a printer sends an interrupt signal to indicate it has run out of paper.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An interrupt is a signal sent from a device or software to the CPU, requesting its immediate attention. When the printer runs out of paper: 1. The printer sends an interrupt signal to the CPU. 2. The CPU completes its current instruction execution cycle. 3. The CPU saves the current state (registers and program counter value) onto a stack. 4. The CPU identifies the source of the interrupt and loads the appropriate Interrupt Service Routine (ISR). 5. The ISR displays an 'out of paper' warning message to the user. 6. Once resolved or dismissed, the CPU restores the saved state from the stack and resumes the interrupted program.
Marking scheme
1 mark for defining an interrupt as a signal sent to the CPU to request immediate attention / halt current execution. 1 mark for stating that the CPU saves its current state / contents of registers before servicing the interrupt. 1 mark for stating that the CPU loads and runs the Interrupt Service Routine (ISR) specific to the printer. 1 mark for stating that the CPU restores the saved state and resumes the previous task once serviced.
Question 19 · Structured/Explain
3.8 marks
A tablet computer uses a resistive touch screen. Explain how a resistive touch screen detects a user's input, and state one advantage of this type of screen over a capacitive touch screen.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A resistive touch screen is composed of multiple layers, primarily two thin, flexible, conductive layers separated by a narrow gap of air or spacer dots. When physical pressure is applied to the screen (by a finger or stylus), the outer layer flexes and makes physical contact with the inner layer. This contact completes an electrical circuit at that precise point, changing the electrical current. Microprocessors calculate the coordinates of this contact point to register the input. An advantage of resistive screens is that they are cheaper to manufacture and can be operated using gloved hands, fingernails, or standard styluses, unlike capacitive screens which require a conductive object.
Marking scheme
1 mark for explaining that it consists of two layers with a gap between them. 1 mark for explaining that pressure causes the layers to touch, completing an electrical circuit. 1 mark for explaining that the change in electrical current/voltage is measured to calculate coordinates. 1 mark for stating a valid advantage (e.g. can be operated with gloved hands/stylus, or is less expensive to manufacture).
Question 20 · Structured/Explain
3.8 marks
An expert system is used by doctors to help diagnose medical conditions. Describe the components of an expert system, focusing on the role of the knowledge base and the inference engine.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An expert system consists of a user interface, a knowledge base, a rules base, and an inference engine. The knowledge base is a repository of facts, data, and specialized knowledge about a specific domain (in this case, medical diagnoses) gathered from human experts. The inference engine is the processing unit of the system; it applies logical rules (from the rules base) to the current symptoms entered by the user to reason, make associations, and generate a recommended diagnosis or conclusion.
Marking scheme
1 mark for identifying the key components (user interface, knowledge base, rules base, inference engine). 1 mark for explaining the role of the knowledge base (stores structured facts and specialized domain knowledge). 1 mark for explaining the role of the rules base (stores the 'IF-THEN' logical rules). 1 mark for explaining the role of the inference engine (acts as the search engine/reasoning brain that applies rules to facts to derive conclusions).
Question 21 · Structured/Explain
4 marks
Describe how a checksum is used to detect whether data has been corrupted during transmission.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To detect errors using a checksum, the sending computer calculates a numerical value (the checksum) from the data block using a predetermined algorithm. This checksum is attached to the data packet before transmission. Once the packet arrives, the receiving device runs the exact same algorithm on the received data block. It then compares its newly calculated checksum against the checksum that was sent. If the two values match, the transmission is assumed to be error-free. If they do not match, it indicates the data was corrupted during transit, prompting the receiver to reject the data and request a retransmission.
Marking scheme
Award 1 mark per point up to a maximum of 4: - 1 mark: Sender calculates a checksum value using a specific algorithm (on the data block). - 1 mark: Checksum is appended to the data and sent together. - 1 mark: Receiver recalculates the checksum using the same algorithm on the received data. - 1 mark: Receiver compares the two checksum values and identifies an error if they do not match (and requests retransmission).
Reject: Answers stating that checksums can automatically correct the errors (checksum only detects).
Question 22 · Structured/Explain
4 marks
Explain the roles of the Program Counter (PC) and the Memory Address Register (MAR) during the fetch stage of the fetch-decode-execute cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
During the fetch stage, the CPU determines which instruction to retrieve next using the Program Counter (PC), which continuously holds the memory address of the next instruction. This address is then copied from the PC into the Memory Address Register (MAR) via the address bus. Once the address is copied, the PC is immediately incremented by one so that it points to the next scheduled instruction. The MAR then maintains this target address, allowing the control unit to locate the instruction in RAM and fetch it into the Memory Buffer Register (MBR) / Memory Data Register (MDR).
Marking scheme
Award 1 mark per point up to a maximum of 4: - 1 mark: PC holds/stores the address of the next instruction to be fetched. - 1 mark: The address in the PC is copied to the MAR. - 1 mark: The PC is incremented (to point to the next instruction). - 1 mark: The MAR holds the address of the instruction being fetched from memory (and sends it via the address bus).
Accept: MBR as an alternative name for MDR where relevant, though the question focuses on PC and MAR.
Question 23 · Calculations / Tables
3.8 marks
An uncompressed image has a resolution of 1024 pixels by 2048 pixels. The image has a colour depth of 24 bits. Calculate the file size of the image in Mebibytes (MiB). Show your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Calculate the total number of pixels: \(1024 \times 2048 = 2,097,152\) pixels. 2. Convert the colour depth from bits to bytes: \(24 \text{ bits} \div 8 = 3 \text{ bytes}\). 3. Calculate the file size in bytes: \(2,097,152 \text{ pixels} \times 3 \text{ bytes} = 6,291,456 \text{ bytes}\). 4. Convert bytes to Kibibytes (KiB): \(6,291,456 \div 1024 = 6144 \text{ KiB}\). 5. Convert Kibibytes to Mebibytes (MiB): \(6144 \div 1024 = 6 \text{ MiB}\).
Marking scheme
Award marks for: - Correct calculation of total pixels (e.g. \(1024 \times 2048\) or 2,097,152) [1 mark] - Correct conversion of 24 bits to 3 bytes (or multiplying by 24 and dividing by 8) [1 mark] - Correct division by 1024 to convert bytes to KiB or dividing by 1,048,576 to convert bytes to MiB [1 mark] - Correct final answer of 6 MiB (or 6) [1 mark]
Question 24 · Calculations / Tables
3.8 marks
Perform the binary addition of these two 8-bit unsigned integers: 01101100 and 01011010. Show all your working including carries, and convert your final binary answer into denary.
Show answer & marking schemeHide answer & marking scheme
Award marks for: - Indicating correct carry bits at column positions 3, 4, 5, 6 during binary addition [1 mark] - Correct 8-bit binary sum: 11000110 [1 mark] - Showing a valid conversion method (e.g., summing place values: \(128 + 64 + 4 + 2\)) [1 mark] - Correct denary answer: 198 [1 mark]
Question 25 · Calculations / Tables
3.8 marks
For the logic expression X = (A AND NOT B) OR (B XOR C), determine the output X for each of the 8 combinations of inputs. List the values of X in order from Row 1 to Row 8, assuming the following binary ordering of inputs (A, B, C): Row 1: 000, Row 2: 001, Row 3: 010, Row 4: 011, Row 5: 100, Row 6: 101, Row 7: 110, Row 8: 111.
Show answer & marking schemeHide answer & marking scheme
Worked solution
- Row 1 (000): X = (0 AND NOT 0) OR (0 XOR 0) = (0 AND 1) OR 0 = 0 OR 0 = 0. - Row 2 (001): X = (0 AND NOT 0) OR (0 XOR 1) = (0 AND 1) OR 1 = 0 OR 1 = 1. - Row 3 (010): X = (0 AND NOT 1) OR (1 XOR 0) = (0 AND 0) OR 1 = 0 OR 1 = 1. - Row 4 (011): X = (0 AND NOT 1) OR (1 XOR 1) = (0 AND 0) OR 0 = 0 OR 0 = 0. - Row 5 (100): X = (1 AND NOT 0) OR (0 XOR 0) = (1 AND 1) OR 0 = 1 OR 0 = 1. - Row 6 (101): X = (1 AND NOT 0) OR (0 XOR 1) = (1 AND 1) OR 1 = 1 OR 1 = 1. - Row 7 (110): X = (1 AND NOT 1) OR (1 XOR 0) = (1 AND 0) OR 1 = 0 OR 1 = 1. - Row 8 (111): X = (1 AND NOT 1) OR (1 XOR 1) = (1 AND 0) OR 0 = 0 OR 0 = 0. The output sequence is 0, 1, 1, 0, 1, 1, 1, 0.
Marking scheme
Award marks based on the number of correct outputs: - All 8 rows correct: [4 marks] - 6 to 7 rows correct: [3 marks] - 3 to 5 rows correct: [2 marks] - 1 to 2 rows correct: [1 mark]
Question 26 · Calculations / Tables
3.8 marks
A sound engineer records a mono audio track with a duration of 64 seconds. The track is sampled at a frequency of 8000 Hz with a sampling resolution of 16 bits. Calculate the final file size of this audio recording in Kibibytes (KiB). Show all your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Calculate the total size in bits: \(\text{Size in bits} = \text{Duration (seconds)} \times \text{Sample Rate (Hz)} \times \text{Resolution (bits)} \times \text{Channels} = 64 \times 8000 \times 16 \times 1 = 8,192,000 \text{ bits}\). 2. Convert bits to bytes by dividing by 8: \(8,192,000 \div 8 = 1,024,000 \text{ bytes}\). 3. Convert bytes to Kibibytes (KiB) by dividing by 1024: \(1,024,000 \div 1024 = 1000 \text{ KiB}\).
Marking scheme
Award marks for: - Correct formula shown or correct multiplication of components: \(64 \times 8000 \times 16\) [1 mark] - Correct total bits (8,192,000 bits) or correct conversion step to bytes [1 mark] - Correct division of bytes by 1024 to obtain KiB [1 mark] - Correct final answer of 1000 KiB (accept 1000) [1 mark]
Question 27 · Calculations / Tables
3.8 marks
An 8-bit data transmission scheme uses the most significant bit (MSB, leftmost bit) as an even parity bit, followed by a 7-bit data payload. Determine the complete 8-bit transmitted byte for each of the following 7-bit data payloads: 1) 1101011, 2) 0101100, 3) 1111000, 4) 0000000.
Show answer & marking schemeHide answer & marking scheme
Worked solution
- For payload 1101011: Count of 1s is 5 (odd). To make it even parity, the MSB (parity bit) must be 1. Transmitted byte = 11101011. - For payload 0101100: Count of 1s is 3 (odd). To make it even parity, the MSB (parity bit) must be 1. Transmitted byte = 10101100. - For payload 1111000: Count of 1s is 4 (even). To make it even parity, the MSB (parity bit) must be 0. Transmitted byte = 01111000. - For payload 0000000: Count of 1s is 0 (even). To make it even parity, the MSB (parity bit) must be 0. Transmitted byte = 00000000.
Marking scheme
Award marks for: - Correct 8-bit byte for payload 1: 11101011 [1 mark] - Correct 8-bit byte for payload 2: 10101100 [1 mark] - Correct 8-bit byte for payload 3: 01111000 [1 mark] - Correct 8-bit byte for payload 4: 00000000 [1 mark]
Paper 2 Algorithms, Programming and Logic
Answer all questions. Calculators must not be used in this paper. Total marks: 75.
11 Question · 54.9 marks
Question 1 · Trace Table
3.3 marks
An algorithm is represented by the following pseudocode:
``` DECLARE Num : ARRAY[1:5] OF INTEGER Num[1] <- 12 Num[2] <- 5 Num[3] <- 18 Num[4] <- 7 Num[5] <- 15 Limit <- 10 Sum <- 0 Count <- 1 WHILE Count <= 5 DO IF Num[Count] > Limit THEN Sum <- Sum + Num[Count] ENDIF Count <- Count + 1 ENDWHILE OUTPUT Sum ```
Complete the trace table below. Some values are already entered. Determine the values of the missing cells marked as **[A]**, **[B]**, and **[C]**.
Enter your final answer in the format: `A = value, B = value, C = value`
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's trace the execution of the pseudocode step-by-step: 1. Initial state: `Sum` is set to 0, `Count` is set to 1. 2. **Iteration 1 (Count = 1)**: - `Num[1]` is 12. - `Num[1] > Limit` (12 > 10) is TRUE. - `Sum` becomes `Sum + 12` = 12. Thus, **[A] = 12**. - `Count` is incremented to 2. 3. **Iteration 2 (Count = 2)**: - `Num[2]` is 5. - `Num[2] > Limit` (5 > 10) is FALSE. - `Sum` remains 12. - `Count` is incremented to 3. 4. **Iteration 3 (Count = 3)**: - `Num[3]` is 18. - `Num[3] > Limit` (18 > 10) is TRUE. - `Sum` becomes `Sum + 18` = 12 + 18 = 30. Thus, **[B] = 30**. - `Count` is incremented to 4. 5. **Iteration 4 (Count = 4)**: - `Num[4]` is 7. - `Num[4] > Limit` (7 > 10) is FALSE. - `Sum` remains 30. - `Count` is incremented to 5. 6. **Iteration 5 (Count = 5)**: - `Num[5]` is 15. - `Num[5] > Limit` (15 > 10) is TRUE. - `Sum` becomes `Sum + 15` = 30 + 15 = 45. - `Count` is incremented to 6. Thus, **[C] = 6**. 7. **Termination**: - `Count` is now 6. The loop condition `Count <= 5` is FALSE, so the loop terminates. - `Sum` (45) is outputted.
Therefore, A = 12, B = 30, C = 6.
Marking scheme
- 1 mark for identifying [A] = 12 (correct updated sum after first valid check) - 1 mark for identifying [B] = 30 (correct accumulated sum after third element) - 1 mark for identifying [C] = 6 (correct terminating value of Count) - Max 3.3 marks overall.
Question 2 · Diagrams & Trace Tables
3.3 marks
A flowchart is shown below to find the largest number from a list of positive integers entered by the user. The process ends when -1 is entered.
``` ┌─────────┐ │ START │ └────┬────┘ │ ▼ ┌─────────────┐ │ Max <- -1 │ └──────┬──────┘ │ ▼ ┌─────────────┐ │ INPUT Num │◄───────────────────────────┐ └──────┬──────┘ │ │ │ ▼ │ ╱ ╲ │ ╱ Is ╲ │ ◄ Num = -1 ─► NO ───► ╱ ╲ │ ╲ ? ╱ ╱ Is ╲ │ ╲ ╱ ◄ Num > ─► YES ──┐ │ │ ╲ Max? ╱ │ │ YES ╲ ╱ ▼ │ │ │ ┌─────────────┐ │ │ │ Max <- Num │ │ ▼ └──────┬──────┘ │ NO │ │ │ │ ▼ └──────────────┴┘ ┌─────────────┐ │ OUTPUT Max │ └──────┬──────┘ │ ▼ ┌─────────┐ │ END │ └─────────┘ ```
The user enters the following sequence of inputs: `14, 28, 9, 35, 12, -1`
Complete the trace table below for this sequence of inputs, identifying the missing values for **[A]**, **[B]**, and **[C]**.
Enter your final answer in the format: `A = value, B = value, C = value`
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's trace the flowchart step-by-step with the input sequence: `14, 28, 9, 35, 12, -1`: 1. Initialize `Max` to -1. 2. **Input Num = 14**: - Is Num = -1? No. - Is Num > Max? (14 > -1) Yes. - `Max` is updated to 14. 3. **Input Num = 28**: - Is Num = -1? No. - Is Num > Max? (28 > 14) Yes. - `Max` is updated to 28. Thus, **[A] = 28**. 4. **Input Num = 9**: - Is Num = -1? No. - Is Num > Max? (9 > 28) No. - `Max` remains 28. 5. **Input Num = 35**: - Is Num = -1? No. - Is Num > Max? (35 > 28) Yes. - `Max` is updated to 35. Thus, **[B] = 35**. 6. **Input Num = 12**: - Is Num = -1? No. - Is Num > Max? (12 > 35) No. - `Max` remains 35. 7. **Input Num = -1**: - Is Num = -1? Yes. - The algorithm branches to OUTPUT Max. - `Max` (35) is printed as output. Thus, **[C] = 35**.
Therefore, A = 28, B = 35, C = 35.
Marking scheme
- 1 mark for identifying [A] = 28 (correct updated max on second input) - 1 mark for identifying [B] = 35 (correct updated max on fourth input) - 1 mark for identifying [C] = 35 (correct final output of max value) - Max 3.3 marks overall.
Question 3 · Trace Table
3.3 marks
An algorithm is represented by the following pseudocode:
``` DECLARE X, Y, Temp : INTEGER X <- 18 Y <- 12 WHILE Y <> 0 DO Temp <- Y Y <- X MOD Y X <- Temp ENDWHILE OUTPUT X ```
Complete the trace table below, which tracks every change of variable value. Determine the missing values for **[A]**, **[B]**, and **[C]**.
Enter your final answer in the format: `A = value, B = value, C = value`
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's trace the execution of the algorithm step-by-step: - **Step 1**: Initial state is set with `X = 18` and `Y = 12`. - **First Loop Iteration** (since Y = 12, which is not equal to 0): - **Step 2**: `Temp <- Y` => `Temp` becomes 12. - **Step 3**: `Y <- X MOD Y` => `18 MOD 12` is 6, so `Y` becomes 6. - **Step 4**: `X <- Temp` => `X` becomes 12. Thus, **[A] = 12**. - **Second Loop Iteration** (since Y = 6, which is not equal to 0): - **Step 5**: `Temp <- Y` => `Temp` becomes 6. - **Step 6**: `Y <- X MOD Y` => `12 MOD 6` is 0, so `Y` becomes 0. - **Step 7**: `X <- Temp` => `X` becomes 6. Thus, **[B] = 6**. - **Loop Check**: - The condition is `Y <> 0`. Since `Y` is now 0, the condition is FALSE and the loop terminates. - **Step 8**: - `OUTPUT X` => outputs 6. Thus, **[C] = 6**.
Therefore, A = 12, B = 6, C = 6.
Marking scheme
- 1 mark for identifying [A] = 12 (correct updated value of X in first loop) - 1 mark for identifying [B] = 6 (correct updated value of X in second loop) - 1 mark for identifying [C] = 6 (correct final output of X) - Max 3.3 marks overall.
Question 4 · Pseudocode writing
5 marks
Write a pseudocode algorithm that inputs 100 positive integers. The algorithm must count how many of these integers are multiples of 5. Any negative integer or zero entered must be ignored and not count towards the total of 100 positive integers. Finally, output the count of multiples of 5.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An example pseudocode solution:
``` DECLARE Count, Multiples, Number : INTEGER Count <- 0 Multiples <- 0 REPEAT INPUT Number IF Number > 0 THEN Count <- Count + 1 IF Number MOD 5 = 0 THEN Multiples <- Multiples + 1 ENDIF ENDIF UNTIL Count = 100 OUTPUT "Multiples of 5: ", Multiples ```
Marking scheme
1 mark: Initialising Count and Multiples to 0 before the loop. 1 mark: Loop that correctly repeats until 100 positive integers have been processed (e.g. REPEAT...UNTIL Count = 100 or WHILE Count < 100). 1 mark: Conditional check to ignore zero or negative integers (Number > 0) and increment Count only for positive integers. 1 mark: Check if the number is a multiple of 5 (e.g., using MOD 5 = 0) and incrementing the multiples counter. 1 mark: Correct output of the final count after the loop ends.
Question 5 · Pseudocode writing
5 marks
A 1D array named Names contains 50 elements of string data type. Write a pseudocode algorithm to search the array for a specific name entered by the user. If the name is found, output its index position in the array and stop searching. If the name is not found after checking the entire array, output "Name not found".
Show answer & marking schemeHide answer & marking scheme
Worked solution
An example pseudocode solution:
``` DECLARE SearchName : STRING DECLARE Found : BOOLEAN DECLARE Index : INTEGER INPUT SearchName Found <- FALSE Index <- 1 WHILE (Index <= 50) AND (Found = FALSE) DO IF Names[Index] = SearchName THEN Found <- TRUE ELSE Index <- Index + 1 ENDIF ENDWHILE IF Found = TRUE THEN OUTPUT Index ELSE OUTPUT "Name not found" ENDIF ```
Marking scheme
1 mark: Inputting the search term and initialising variables (e.g., Found to FALSE, Index to 1). 1 mark: Loop that iterates through the array (from index 1 to 50) and can terminate early if found. 1 mark: Comparing the current array element Names[Index] with the input search term. 1 mark: Correctly setting Found to TRUE and keeping the loop index constant or exiting the loop early when found. 1 mark: Outputs the correct index if Found is TRUE, otherwise outputs "Name not found" after the loop.
Question 6 · Pseudocode writing
5 marks
A text file named Temperatures.txt contains a list of daily temperatures (real numbers) with one temperature per line. The file is terminated by a dummy value of -999. Write a pseudocode algorithm to open the file, read all temperatures, calculate the average temperature (excluding the dummy value), close the file, and output the average. Assume the file contains at least one temperature before the dummy value.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An example pseudocode solution:
``` DECLARE Temp, Total, Average : REAL DECLARE Count : INTEGER Total <- 0 Count <- 0 OPENFILE "Temperatures.txt" FOR READ READFILE "Temperatures.txt", Temp WHILE Temp <> -999 DO Total <- Total + Temp Count <- Count + 1 READFILE "Temperatures.txt", Temp ENDWHILE CLOSEFILE "Temperatures.txt" Average <- Total / Count OUTPUT Average ```
Marking scheme
1 mark: Correctly opening and closing the file Temperatures.txt with appropriate modes/syntax. 1 mark: Correctly reading the first temperature before the loop (priming read) and reading subsequent temperatures inside the loop. 1 mark: Implementing a loop that terminates when the dummy value -999 is read. 1 mark: Accumulating the running total of temperatures and incrementing the count of readings inside the loop. 1 mark: Correctly calculating the average after the loop and outputting it.
Question 7 · Pseudocode writing
5 marks
Write a pseudocode algorithm that prompts the user to enter a string. The algorithm must construct and output a new string containing only the uppercase letters (character codes from 'A' to 'Z') from the entered string. You should use the standard string functions LENGTH(String) to find the length of a string, and SUBSTR(String, Start, Length) to extract a substring.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An example pseudocode solution:
``` DECLARE UserInput, OnlyUpper : STRING DECLARE NextChar : CHAR DECLARE Index, StrLength : INTEGER INPUT UserInput OnlyUpper <- "" StrLength <- LENGTH(UserInput) FOR Index <- 1 TO StrLength NextChar <- SUBSTR(UserInput, Index, 1) IF (NextChar >= "A") AND (NextChar <= "Z") THEN OnlyUpper <- OnlyUpper & NextChar ENDIF NEXT Index OUTPUT OnlyUpper ```
Marking scheme
1 mark: Inputting the string and initialising the output string OnlyUpper to empty (""). 1 mark: Using a FOR loop (from 1 to LENGTH(UserInput)) to iterate through each character. 1 mark: Extracting each individual character using the SUBSTR function correctly (e.g., SUBSTR(UserInput, Index, 1)). 1 mark: Comparing the character to check if it is between "A" and "Z" inclusive. 1 mark: Concatenating valid uppercase characters to the new string and outputting the final string after the loop.
Question 8 · Pseudocode writing
5 marks
Write a pseudocode algorithm to prompt for and input a user's password. The algorithm must validate the password based on two conditions: it must be at least 8 characters long, and it must contain at least one exclamation mark '!'. The algorithm must continue to prompt the user and input the password until a valid password is entered. You should use the standard functions LENGTH(String) and SUBSTR(String, Start, Length).
Show answer & marking schemeHide answer & marking scheme
Worked solution
An example pseudocode solution:
``` DECLARE Password : STRING DECLARE Valid : BOOLEAN DECLARE Index, PasswordLength : INTEGER DECLARE HasExclamation : BOOLEAN Valid <- FALSE REPEAT INPUT Password PasswordLength <- LENGTH(Password) HasExclamation <- FALSE FOR Index <- 1 TO PasswordLength IF SUBSTR(Password, Index, 1) = "!" THEN HasExclamation <- TRUE ENDIF NEXT Index IF (PasswordLength >= 8) AND (HasExclamation = TRUE) THEN Valid <- TRUE ELSE OUTPUT "Invalid password" ENDIF UNTIL Valid = TRUE ```
Marking scheme
1 mark: Using a post-test loop (REPEAT...UNTIL) or pre-test loop (WHILE...DO) to repeatedly ask for input. 1 mark: Finding the length of the input password and checking if it is at least 8 characters. 1 mark: Using a loop to search the entire password string for the exclamation character ('!'). 1 mark: Correctly flag/set boolean variable (HasExclamation) if '!' is found. 1 mark: Correctly combining both conditions (Length >= 8 AND contains '!') to exit the validation loop.
Question 9 · practical
15 marks
A transport company tracks the daily deliveries made by its 10 drivers over a 5-day working week (Monday to Friday).
Write an algorithm in pseudocode that meets the following requirements: - Uses a 2D array named `DeliveryCounts` indexed `[1:10, 1:5]` to store the integer number of deliveries. - Prompts the user to input the number of successful deliveries for each of the 10 drivers for each of the 5 days. - Validates each input value to ensure it is an integer between 0 and 100 inclusive. If the input is invalid, displays an error message and repeatedly prompts the user until a valid value is entered. - Calculates and outputs the total weekly deliveries made by each individual driver. - Identifies and outputs which driver had the highest weekly total (you can assume there are no ties). - Calculates and outputs the overall average number of deliveries per driver per day across the entire company for the week (Total deliveries / 50).
Show answer & marking schemeHide answer & marking scheme
Worked solution
The pseudocode solution performs the following key programming steps: 1. **Declarations**: It declares the 2D array `DeliveryCounts` with dimensions `1:10` and `1:5` alongside variables for tracking loops, individual sums, overall totals, and max values. 2. **Nested Loops**: An outer loop iterates from 1 to 10 (each driver) and an inner loop from 1 to 5 (each day). 3. **Validation Loop**: A `REPEAT ... UNTIL` construct validates that each delivery count entered is between 0 and 100 inclusive, outputting an error message if invalid. 4. **Accumulation**: Successful entries are saved to the 2D array and accumulated into `DriverTotal` and `GrandTotal`. 5. **Driver Output & Maximum Check**: Once a driver's 5 days are summed up, their total is displayed. A comparison updates `MaxTotal` and records `MaxDriver` if a new maximum is found. 6. **Averages and Final Outputs**: After processing all drivers, the global average is calculated using real division (divided by 50) and final statistics are outputted.
Marking scheme
Award marks for correct pseudocode implementation up to a maximum of 15 marks:
- **1 Mark**: Declaring the 2D array `DeliveryCounts[1:10, 1:5]` with correct dimensions and integer data type. - **1 Mark**: Declaring or initializing working variables correctly (`GrandTotal`, `MaxTotal` to a low starting value like -1 or 0). - **2 Marks**: Correctly structured nested loops (outer loop `1 to 10` for drivers, inner loop `1 to 5` for days) with matching `NEXT` statements. - **2 Marks**: Input inside the loops with an appropriate prompt referencing the driver and day. - **2 Marks**: Validation loop (e.g., `REPEAT...UNTIL` or `WHILE...ENDWHILE`) checking for range `0` to `100` inclusive with an error message. - **1 Mark**: Storing the validated input correctly in `DeliveryCounts[Driver, Day]`. - **2 Marks**: Calculating and summing the weekly total for each driver (resetting to 0 before the inner loop) and updating the grand total. - **1 Mark**: Outputting the weekly total for each individual driver inside the outer loop but outside the inner loop. - **2 Marks**: Checking and identifying the driver with the highest weekly total correctly updating `MaxTotal` and storing the driver ID. - **1 Mark**: Calculating the final company average accurately (`GrandTotal / 50`) and outputting both the average and highest driver statistics outside the outer loop.
Question 10 · short_answer
2.5 marks
A database table, Flight, contains details of scheduled flights. Here is a sample of the data: FlightIDDestinationDepartureTimePriceSeatsAvailableFL101Paris08:30120.0015FL102Rome09:15150.008FL103Paris14:0095.005FL104Berlin16:45110.0025FL105Paris20:15115.0012 Write a SQL query to display only the FlightID and Price fields for flights where the Destination is 'Paris' and SeatsAvailable is greater than 10. The results should be sorted by Price in ascending order.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To construct the SQL query: 1. SELECT clause: We need to retrieve FlightID and Price, so we write 'SELECT FlightID, Price'. 2. FROM clause: The table name is Flight, so we write 'FROM Flight'. 3. WHERE clause: We need to filter where Destination is 'Paris' and SeatsAvailable is greater than 10. The condition is 'WHERE Destination = 'Paris' AND SeatsAvailable > 10'. 4. ORDER BY clause: We need the results sorted by Price in ascending order, which is achieved using 'ORDER BY Price' (the default is ascending, or 'ORDER BY Price ASC'). Combining these clauses yields: SELECT FlightID, Price FROM Flight WHERE Destination = 'Paris' AND SeatsAvailable > 10 ORDER BY Price;
Marking scheme
0.5 marks for SELECT FlightID, Price; 0.5 marks for FROM Flight; 1.0 mark for WHERE Destination = 'Paris' AND SeatsAvailable > 10 (accept single or double quotes, allow spaces around operator); 0.5 marks for ORDER BY Price (or ORDER BY Price ASC). Total: 2.5 marks.
Question 11 · short_answer
2.5 marks
A database table, Book, contains details of books in a library. Here is a sample of the data: BookIDTitleAuthorYearPublishedAvailableBK001DuneFrank Herbert1965TRUEBK002FoundationIsaac Asimov1951FALSEBK003NeuromancerWilliam Gibson1984TRUEBK004Snow CrashNeal Stephenson1992TRUEBK005I, RobotIsaac Asimov1950TRUE Write a SQL query to display only the Title and Author fields for books written by 'Isaac Asimov' that were published after the year 1950. The results should be sorted alphabetically by Title.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To construct the SQL query: 1. SELECT clause: Specify 'SELECT Title, Author' to display only these fields. 2. FROM clause: The data comes from the 'Book' table, so we write 'FROM Book'. 3. WHERE clause: The conditions are that the Author must be 'Isaac Asimov' and YearPublished must be greater than 1950. This gives 'WHERE Author = 'Isaac Asimov' AND YearPublished > 1950'. 4. ORDER BY clause: We sort alphabetically by Title using 'ORDER BY Title' (ascending is default). Combining these clauses yields: SELECT Title, Author FROM Book WHERE Author = 'Isaac Asimov' AND YearPublished > 1950 ORDER BY Title;
Marking scheme
0.5 marks for SELECT Title, Author; 0.5 marks for FROM Book; 1.0 mark for WHERE Author = 'Isaac Asimov' AND YearPublished > 1950 (accept single or double quotes, allow spaces around operator); 0.5 marks for ORDER BY Title (or ORDER BY Title ASC). Total: 2.5 marks.
Wondering how well you actually know this?
Thinka is an AI practice app for DSE 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.