An original Thinka practice paper modelled on the structure and difficulty of the Jun 2024 (V3) Cambridge International A Level Computer Science (0478) paper. Not affiliated with or reproduced from Cambridge.
Paper 1 Computer Systems
Answer all questions. Calculators are not allowed. Show all your working for conversions and calculations.
24 PastPaper.question · 68 PastPaper.marks
PastPaper.question 1 · Short recall
1.5 PastPaper.marks
Convert the 8-bit binary integer 10110101 into hexadecimal. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Split the 8-bit binary number into two 4-bit nibbles: 1011 and 0101. 2. Convert the first nibble (1011) to decimal, which is 11, representing 'B' in hexadecimal. 3. Convert the second nibble (0101) to decimal, which is 5, representing '5' in hexadecimal. 4. Combine the two hex digits to get B5.
PastPaper.markingScheme
- 1 mark for showing correct binary-to-hex conversion of at least one nibble (either 1011 = B or 0101 = 5). - 0.5 marks for the correct final answer: B5.
PastPaper.question 2 · Short recall
1.5 PastPaper.marks
Identify three distinct benefits of using serial data transmission rather than parallel data transmission.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Serial transmission sends data one bit at a time over a single wire, which reduces interference (crosstalk) and eliminates the problem of bits arriving out of synchronization (skew). It is also cheaper to manufacture and install because fewer wires and connectors are needed.
PastPaper.markingScheme
0.5 marks for each valid benefit listed, up to a maximum of 1.5 marks. Acceptable answers include: - Less risk of data corruption / skew (bits arriving out of order). - Cheaper to install/maintain (fewer physical wires/channels required). - Less risk of electromagnetic interference / crosstalk. - Better suited for longer distances.
PastPaper.question 3 · Short recall
1.5 PastPaper.marks
Describe the function of the Program Counter (PC) within the Von Neumann CPU architecture.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The Program Counter (PC) is a CPU register that stores the address of the next instruction that needs to be fetched and executed. Once the current instruction is successfully fetched into the Memory Address Register (MAR), the PC is automatically incremented by 1 to point to the next instruction in sequence.
PastPaper.markingScheme
- 1 mark for stating that it holds/stores the address of the next instruction to be fetched. - 0.5 marks for mentioning that it incremented (by 1) after the instruction is fetched.
PastPaper.question 4 · Short recall
1.5 PastPaper.marks
Explain how a checksum is used to detect errors in transmitted data.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Before transmission, the sending device calculates a checksum value from the block of data using a mathematical algorithm. This checksum value is appended to the data block and transmitted. Upon receiving the data, the receiving device recalculates the checksum using the same algorithm. If the calculated checksum matches the received checksum, the data is assumed to be error-free; otherwise, an error has occurred.
PastPaper.markingScheme
- 0.5 marks for stating that a checksum value is calculated before transmission using a mathematical algorithm. - 0.5 marks for stating that the checksum is sent along with the data block. - 0.5 marks for stating that the receiver recalculates the checksum and compares it; if they do not match, an error is detected.
PastPaper.question 5 · Short recall
1.5 PastPaper.marks
State the type of touchscreen that relies on the electrical properties of the human body to function, and explain why standard plastic styluses cannot be used with it.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
A capacitive touchscreen is coated with a material that stores electrical charge. When a conductive object, like a human finger, touches the screen, it draws charge from that point, creating a change in capacitance. A standard plastic stylus does not conduct electricity (it is an insulator), so it cannot alter the electrostatic field and thus the touch is not registered.
PastPaper.markingScheme
- 0.5 marks for correctly identifying 'Capacitive' touchscreen. - 1 mark for explaining that capacitive screens require a conductive material/finger to complete the circuit/alter the electrical field, whereas plastic is an insulator and cannot transfer charge.
PastPaper.question 6 · Short recall
1.5 PastPaper.marks
State the key difference between RAM and ROM regarding data retention when power is lost, and explain how this difference affects what they store.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
RAM is volatile memory, meaning its contents are lost as soon as the computer's power is switched off. This makes it suitable for temporarily storing files and applications currently in use. In contrast, ROM is non-volatile, meaning its contents are permanent and retained even when power is turned off. Consequently, ROM is used to store essential start-up instructions (such as the BIOS/bootstrap loader) that the computer needs to boot.
PastPaper.markingScheme
- 0.5 marks for identifying that RAM is volatile and ROM is non-volatile (or explaining that RAM loses data when power is lost while ROM retains it). - 1 mark for explaining the implication for what they store (e.g., ROM stores start-up/BIOS code because it must be permanent, whereas RAM stores temporary execution data/currently running programs).
PastPaper.question 7 · Short recall
1.5 PastPaper.marks
State the primary function of a Domain Name Server (DNS) in the context of accessing websites.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
When a user types a human-readable domain name (like www.example.com) into a web browser, the browser queries a Domain Name Server (DNS). The DNS looks up this domain name in its database and translates it into its corresponding numerical IP address (like 192.0.2.1), which the computer uses to locate the web server on the internet.
PastPaper.markingScheme
- 1 mark for stating that it translates/resolves a domain name / URL into an IP address. - 0.5 marks for explaining that this IP address is needed by the computer/browser to route the request to the correct web server.
PastPaper.question 8 · Short recall
1.5 PastPaper.marks
Define the term 'interrupt' in a computer system and provide one example of a hardware interrupt.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
An interrupt is a signal sent from a device or software to the CPU, requesting the processor's immediate attention. This causes the CPU to temporarily suspend its current activities (saving its current state) to execute an Interrupt Service Routine (ISR). An example of a hardware interrupt is a peripheral device indicating it has finished a task, a printer running out of paper, or a keyboard key being pressed.
PastPaper.markingScheme
- 1 mark for defining an interrupt as a signal sent to the processor to suspend/halt current execution to attend to a high-priority task. - 0.5 marks for a valid hardware interrupt example (e.g., keyboard input, printer paper jam, mouse movement, disk read complete).
PastPaper.question 9 · short_recall
1.5 PastPaper.marks
State one reason why computer scientists use hexadecimal notation instead of binary, and convert the hexadecimal digit 'B' into its 4-bit binary representation.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. Hexadecimal is used because it is more compact than binary, making it much easier for software developers to read, write, and recognize patterns, which significantly reduces human error during transcription. 2. The hexadecimal digit 'B' corresponds to the denary value of 11. Converting 11 to a 4-bit binary number gives \(8 + 2 + 1 = 11\), which is written as 1011.
PastPaper.markingScheme
0.5 marks: Any valid reason (e.g., easier for humans to read/write/debug, shorter to represent, less prone to human error). 1.0 marks: Correct 4-bit binary representation (1011).
PastPaper.question 10 · short_recall
1.5 PastPaper.marks
State the difference between even parity and odd parity, and identify whether the byte 11010010 has even or odd parity.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Even parity is an error-detection method where the total number of 1-bits in a transmitted byte is made even (by setting the parity bit appropriately). Odd parity requires the total number of 1-bits to be odd. The binary byte 11010010 contains exactly four 1-bits. Since 4 is an even number, this byte has even parity.
PastPaper.markingScheme
1.0 marks: Clear explanation of the difference (0.5 marks for explaining even parity, 0.5 marks for explaining odd parity). 0.5 marks: Correctly identifying '11010010' as having even parity.
PastPaper.question 11 · short_recall
1.5 PastPaper.marks
Describe the main purpose of the Program Counter (PC) register in the CPU, and state how its value changes during the fetch stage of the fetch-decode-execute cycle.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The Program Counter (PC) is a dedicated register within the CPU's control unit that holds the memory address of the next instruction scheduled for execution. During the fetch phase, once the current instruction's address is copied to the Memory Address Register (MAR), the Program Counter is incremented by 1 to point to the next instruction in sequence.
PastPaper.markingScheme
1.0 marks: Clearly describing the PC's purpose (holding the memory address of the next instruction). 0.5 marks: Stating that its value is incremented by 1.
PastPaper.question 12 · short_recall
1.5 PastPaper.marks
Define what is meant by a 'cookie' in web technologies, and state one way a web server uses cookies to improve a user's browsing experience.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
A cookie is a small text file downloaded and stored on a user's computer or mobile device by a web browser when they visit a website. Web servers use cookies to store state information, such as remembering items in a virtual shopping cart, keeping the user logged into their account, or saving site preferences like language selection.
PastPaper.markingScheme
0.5 marks: Correct definition of a cookie as a small text file stored on the user's computer/device. 1.0 marks: Stating one valid use case (e.g., storing preferences, tracking shopping cart items, maintaining login sessions).
PastPaper.question 13 · Conversion
2.2 PastPaper.marks
Convert the 8-bit binary number \(11011001_{2}\) to hexadecimal. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
First, split the 8-bit binary number into two 4-bit nibbles: \(1101\) and \(1001\). Next, convert each nibble to its hexadecimal equivalent: \(1101_{2} = 13_{10} = D_{16}\), and \(1001_{2} = 9_{10} = 9_{16}\). Combine the two hexadecimal digits to get the final answer: \(D9_{16}\).
PastPaper.markingScheme
1 mark for a correct method of splitting into nibbles or demonstrating conversion of at least one nibble correctly (e.g., finding 13/D or 9). 1.2 marks for the correct final answer: D9.
PastPaper.question 14 · Conversion
2.2 PastPaper.marks
Convert the denary number \(163_{10}\) to an 8-bit binary number. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Subtract powers of 2 from the denary number: \(163 - 128 = 35\) (place value 128 is 1); \(35 - 64\) is not possible (place value 64 is 0); \(35 - 32 = 3\) (place value 32 is 1); \(3 - 16\), \(3 - 8\), \(3 - 4\) are not possible (place values 16, 8, 4 are 0); \(3 - 2 = 1\) (place value 2 is 1); \(1 - 1 = 0\) (place value 1 is 1). This gives the binary sequence \(10100011\).
PastPaper.markingScheme
1 mark for showing a correct working method, such as listing active place values (128, 32, 2, 1) or demonstrating successive division by 2. 1.2 marks for the correct 8-bit binary number: 10100011.
PastPaper.question 15 · Conversion
2.2 PastPaper.marks
Convert the hexadecimal number \(A7_{16}\) to a denary number. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
First, identify the values of the hexadecimal digits: \(A = 10\) and \(7 = 7\). Multiply each digit by its corresponding place value: \(10 \times 16^1 = 160\) and \(7 \times 16^0 = 7\). Add the products together: \(160 + 7 = 167\).
PastPaper.markingScheme
1 mark for showing a correct method (e.g., converting A to 10 and multiplying by 16). 1.2 marks for the correct final denary answer: 167.
PastPaper.question 16 · Conversion
2.2 PastPaper.marks
Convert the 8-bit binary number \(01101110_{2}\) to a denary number. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Identify the place values for the 1s in the binary number: \(01101110_{2}\). The place values containing a 1 are 64, 32, 8, 4, and 2. Add these values together: \(64 + 32 + 8 + 4 + 2 = 110\).
PastPaper.markingScheme
1 mark for identifying correct place values and showing addition. 1.2 marks for the correct final denary answer: 110.
PastPaper.question 17 · Conversion
2.2 PastPaper.marks
Convert the hexadecimal number \(4F_{16}\) to an 8-bit binary number. Show your working.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Convert each hexadecimal digit into a 4-bit binary nibble: \(4_{16} = 0100_{2}\) and \(F_{16} = 15_{10} = 1111_{2}\). Combine the two nibbles to form the 8-bit binary number: \(01001111_{2}\).
PastPaper.markingScheme
1 mark for converting at least one hexadecimal digit to its correct 4-bit binary equivalent (either 0100 or 1111). 1.2 marks for the correct 8-bit binary number: 01001111.
PastPaper.question 18 · Complete table / diagrams
5.25 PastPaper.marks
A logic circuit has three inputs: A, B, and C. The output of the circuit is Z. The logic expression for the circuit is: Z = (A AND NOT B) OR (NOT B XOR C). Complete the truth table below by determining the output Z for each of the given input combinations.
Input rows to complete: - Row 1: A = 0, B = 0, C = 1 - Row 2: A = 0, B = 1, C = 1 - Row 3: A = 1, B = 0, C = 0 - Row 4: A = 1, B = 1, C = 0 - Row 5: A = 1, B = 1, C = 1
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Let us evaluate the expression for each row: - Row 1: A=0, B=0, C=1. NOT B = 1. (A AND NOT B) = (0 AND 1) = 0. (NOT B XOR C) = (1 XOR 1) = 0. Z = 0 OR 0 = 0. - Row 2: A=0, B=1, C=1. NOT B = 0. (A AND NOT B) = (0 AND 0) = 0. (NOT B XOR C) = (0 XOR 1) = 1. Z = 0 OR 1 = 1. - Row 3: A=1, B=0, C=0. NOT B = 1. (A AND NOT B) = (1 AND 1) = 1. (NOT B XOR C) = (1 XOR 0) = 1. Z = 1 OR 1 = 1. - Row 4: A=1, B=1, C=0. NOT B = 0. (A AND NOT B) = (1 AND 0) = 0. (NOT B XOR C) = (0 XOR 0) = 0. Z = 0 OR 0 = 0. - Row 5: A=1, B=1, C=1. NOT B = 0. (A AND NOT B) = (1 AND 0) = 0. (NOT B XOR C) = (0 XOR 1) = 1. Z = 0 OR 1 = 1.
PastPaper.markingScheme
1 mark for each correctly calculated output value (5 marks total). 0.25 marks for showing working for intermediate steps (e.g., intermediate values of NOT B, A AND NOT B, or NOT B XOR C).
PastPaper.question 19 · Complete table / diagrams
5.25 PastPaper.marks
Identify the name or abbreviation of the register in the Von Neumann architecture that matches each of the following functions: 1. Holds the address of the next instruction to be fetched from memory. 2. Holds the instruction that is currently being decoded and executed. 3. Holds the data that has just been read from memory, or is about to be written to memory. 4. Holds the memory address currently being read from or written to. 5. Holds the results of calculations performed by the Arithmetic Logic Unit (ALU).
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
In the Von Neumann architecture, each register has a specific purpose: 1. The Program Counter (PC) stores the memory location of the next instruction. 2. The Current Instruction Register (CIR) stores the fetched instruction during decoding and execution. 3. The Memory Data Register (MDR) acts as a buffer for data moving to/from RAM. 4. The Memory Address Register (MAR) holds the specific location address in RAM. 5. The Accumulator (ACC) is a temporary register storing the output of the ALU.
PastPaper.markingScheme
1 mark for each correct register identifier (either full name or abbreviation accepted) up to 5 marks. 0.25 marks for providing all 5 completely correct.
PastPaper.question 20 · Complete table / diagrams
5.25 PastPaper.marks
For each statement below, indicate whether it applies to 'Lossy only', 'Lossless only', or 'Both' compression methods: 1. Permanently discards redundant or less noticeable data to reduce file size. 2. Allows the original file to be reconstructed exactly bit-for-bit with no loss of detail. 3. Typically used for compressing text documents, spreadsheets, and program code. 4. Used to reduce file transmission time or bandwidth consumption over networks. 5. Often results in a very significant reduction in file size for audio and video files, with some loss of quality.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Analyzing the statements: - Statement 1 describes the permanent deletion of data, which is characteristic of Lossy compression only. - Statement 2 describes exact reconstruction, which is only possible with Lossless compression. - Statement 3 requires precise reconstruction because text/code cannot tolerate missing data, making it Lossless only. - Statement 4 is true for both methods, as any reduction in file size speeds up transmission over networks. - Statement 5 refers to multimedia compression with noticeable or minor quality loss, which is Lossy only.
PastPaper.markingScheme
1 mark for each correct classification (5 marks total). 0.25 marks for distinguishing all statements correctly without errors.
PastPaper.question 21 · Complete table / diagrams
5.25 PastPaper.marks
Match each cyber security threat to its correct description. Write the letter (A, B, C, D, or E) corresponding to the correct description next to each threat.
Descriptions: A: Malicious software that encrypts user files and demands a financial payment to restore access. B: Legitimate-looking emails designed to trick the recipient into revealing sensitive personal credentials. C: Software that secretly monitors and records user keystrokes and activities to steal confidential information. D: Malicious code that redirects a user's web browser to a fraudulent website, even if the user typed the correct URL. E: A harmful program disguised as legitimate software that creates a backdoor to compromise computer security.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The correct matches are: - Phishing (1) sends fake emails to trick users, matching description B. - Pharming (2) redirects web browsers to fake sites, matching description D. - Spyware (3) monitors keypresses and activities secretly, matching description C. - Ransomware (4) encrypts files and demands payment, matching description A. - Trojan horse (5) masquerades as useful software, matching description E.
PastPaper.markingScheme
1 mark for each correct match (5 marks total). 0.25 marks for getting all five matches correct.
PastPaper.question 22 · Descriptive processes
6 PastPaper.marks
Solid State Drives (SSDs) are increasingly used to replace Hard Disk Drives (HDDs) in modern computer systems. Describe how a Solid State Drive using NAND flash memory writes and stores data.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To write and store data on a NAND flash-based SSD: 1. The storage media is made up of floating gate transistors arranged in a grid of blocks and pages. 2. To write data, a high voltage is applied to the control gate of the transistor. 3. This voltage attracts electrons and causes them to tunnel through an insulating oxide layer into the floating gate (Fowler-Nordheim tunneling). 4. When the write voltage is removed, the electrons remain trapped in the floating gate. 5. The presence of trapped electrons represents a binary value 0, while the absence of trapped electrons represents a binary value 1. 6. Data can only be written to pages that are currently empty, and blocks must be erased before they can be rewritten.
PastPaper.markingScheme
Award 1 mark per correct point up to a maximum of 6 marks: - Mention of floating gate transistors [1] - Floating gates are organized into blocks and pages [1] - A high electrical voltage is applied to the control gate to write data [1] - Electrons are forced/tunnel through an insulating oxide layer [1] - The electrons remain trapped in the floating gate when the voltage is removed [1] - The charge state/presence of trapped electrons is read as a binary state (0 or 1) [1] - Data is written/read in pages but must be erased in entire blocks [1] (Accept: Tunneling / Fowler-Nordheim tunneling for oxide layer penetration)
PastPaper.question 23 · Descriptive processes
6 PastPaper.marks
An automated temperature control system is used to regulate the climate inside an industrial greenhouse. Describe the role of the sensors, microprocessor, and actuators in this automated system, detailing how they work together to maintain a steady temperature.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The process operates as follows: 1. A temperature sensor continuously monitors the environment and detects physical temperature changes. 2. The sensor outputs an analog signal representing the temperature. 3. This analog signal is converted to digital data using an Analog-to-Digital Converter (ADC) so the processor can understand it. 4. The microprocessor compares the incoming digital value against a pre-stored target temperature value/range. 5. If the temperature is outside the acceptable limits, the microprocessor sends control signals to actuators (possibly via a Digital-to-Analog Converter if necessary). 6. The actuators carry out physical actions (e.g., opening vents/fans if too hot, turning on heating elements if too cold). 7. The process repeats continuously in a loop.
PastPaper.markingScheme
Award 1 mark per correct point up to a maximum of 6 marks: - Temperature sensor continuously takes physical measurements [1] - Analog signals from the sensor are converted to digital using an ADC [1] - Microprocessor receives digital readings and compares them to pre-set / stored threshold values [1] - If the reading is higher than the threshold, a signal is sent to actuators to open vents / turn on cooling fans [1] - If the reading is lower than the threshold, a signal is sent to actuators to turn on heaters [1] - Actuators perform the physical actions based on microprocessor commands [1] - The entire process is continuous / repeats in a loop [1]
PastPaper.question 24 · Descriptive processes
6 PastPaper.marks
The Fetch-Decode-Execute cycle is the basic operational process of a CPU based on the Von Neumann architecture. Describe the steps that occur during the Fetch stage of this cycle, making reference to the specific registers and buses involved.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The step-by-step process of the Fetch stage is: 1. The address of the next instruction to be fetched is held in the Program Counter (PC). 2. This address is copied from the PC to the Memory Address Register (MAR) via the Address Bus. 3. The Program Counter (PC) is incremented by 1 (to point to the next instruction in sequence). 4. The instruction stored at the memory address in the MAR is retrieved from RAM/main memory. 5. This instruction is sent to the Memory Data Register (MDR) via the Data Bus. 6. The instruction is copied from the MDR to the Current Instruction Register (CIR) to await decoding.
PastPaper.markingScheme
Award 1 mark per correct point up to a maximum of 6 marks: - The address of the next instruction is held in the Program Counter (PC) [1] - The address is copied from the PC to the Memory Address Register (MAR) [1] - ...using the address bus [1] - The Program Counter (PC) is incremented (by 1) [1] - The instruction at the memory address (in MAR) is fetched and sent to the Memory Data Register (MDR) [1] - ...using the data bus [1] - The instruction is copied from the MDR to the Current Instruction Register (CIR) [1]
Paper 2 Algorithms, Programming and Logic
Answer all questions. Write answers in pseudocode, SQL, or flow diagrams. Show clearly any tracing tables or working.
10 PastPaper.question · 52 PastPaper.marks
PastPaper.question 1 · matching
2.5 PastPaper.marks
Match each standard flowchart symbol (1 to 5) with its correct functional description (A to E). Symbols: 1. Process (Rectangle), 2. Input/Output (Parallelogram), 3. Decision (Diamond), 4. Terminator (Oval/Rounded Rectangle), 5. Predefined Process (Rectangle with double vertical lines). Descriptions: A. Marks the start or end of an algorithm. B. Used for entering data or displaying output. C. Used for calculations, data processing, and assignments. D. Used to choose alternative execution paths based on a condition. E. Used to invoke a self-contained sub-routine or procedure.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1 (Process) matches C because process blocks perform assignments and calculations. 2 (Input/Output) matches B as it handles user input and screen outputs. 3 (Decision) matches D because a diamond represents conditional branching. 4 (Terminator) matches A as it marks the start and end. 5 (Predefined Process) matches E because it represents a modular subroutine call.
PastPaper.markingScheme
Award 0.5 marks for each correct match: 1-C (0.5 marks), 2-B (0.5 marks), 3-D (0.5 marks), 4-A (0.5 marks), 5-E (0.5 marks). Total maximum marks: 2.5.
PastPaper.question 2 · matching
2.5 PastPaper.marks
Match each pseudocode statement (1 to 5) with the standard flowchart symbol (A to E) that must be used to represent it. Pseudocode: 1. Total <- Total + Score, 2. IF Temperature > 37.5 THEN, 3. OUTPUT 'Alert', 4. CALL PrintInvoice(), 5. START. Flowchart Symbols: A. Terminator, B. Process, C. Input/Output, D. Predefined Process, E. Decision.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Statement 1 is an assignment, so it matches B (Process). Statement 2 is a selection statement, so it matches E (Decision). Statement 3 is an output statement, so it matches C (Input/Output). Statement 4 is a subroutine call, so it matches D (Predefined Process). Statement 5 is the starting control, so it matches A (Terminator).
PastPaper.markingScheme
Award 0.5 marks for each correct match: 1-B (0.5 marks), 2-E (0.5 marks), 3-C (0.5 marks), 4-D (0.5 marks), 5-A (0.5 marks). Total maximum marks: 2.5.
PastPaper.question 3 · Trace Table
6 PastPaper.marks
An algorithm is written in pseudocode below. It processes an array of numbers.
```pseudocode DECLARE Data : ARRAY[1:5] OF INTEGER DECLARE X, Y, I : INTEGER
Data ← [4, 15, 8, 12, 7] X ← 0 Y ← 0
FOR I ← 1 TO 5 IF Data[I] MOD 2 = 0 THEN X ← X + Data[I] ELSE Y ← Y + 1 X ← X - Data[I] ENDIF NEXT I
OUTPUT "X = ", X, " Y = ", Y ```
Complete the trace table below for this algorithm.
| I | Data[I] | X | Y | OUTPUT | |---|---|---|---|---| | | | | | |
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Trace of execution step-by-step: 1. Initialize X and Y to 0. 2. Loop I = 1: - Data[1] is 4. - 4 MOD 2 = 0 is TRUE. - X becomes 0 + 4 = 4. 3. Loop I = 2: - Data[2] is 15. - 15 MOD 2 = 0 is FALSE. - Y becomes 0 + 1 = 1. - X becomes 4 - 15 = -11. 4. Loop I = 3: - Data[3] is 8. - 8 MOD 2 = 0 is TRUE. - X becomes -11 + 8 = -3. 5. Loop I = 4: - Data[4] is 12. - 12 MOD 2 = 0 is TRUE. - X becomes -3 + 12 = 9. 6. Loop I = 5: - Data[5] is 7. - 7 MOD 2 = 0 is FALSE. - Y becomes 1 + 1 = 2. - X becomes 9 - 7 = 2. 7. Print output statement: X = 2 Y = 2 (accept standard representations including or excluding commas, e.g., 'X = 2, Y = 2').
PastPaper.markingScheme
Marks are awarded as follows (Max 6): - 1 mark for correct initialization of X and Y to 0 (first data row). - 1 mark for correct sequence of I values (1 to 5) and corresponding Data[I] values (4, 15, 8, 12, 7). - 1 mark for correct trace of Y updates (Y = 1 at I=2 and Y = 2 at I=5). - 2 marks for correct trace of X values: (4, -11, -3, 9, 2). Award 1 mark if 3 or 4 values are correct. - 1 mark for correct final output matching the state: 'X = 2 Y = 2' (accept equivalent formatting).
Answer all questions. Write answers in pseudocode, SQL, or flow diagrams. Show clearly any tracing tables or working.
An algorithm is intended to find the minimum value in a 1D array of 100 integers called Score (indexed from 1 to 100). The following pseudocode has been written for this purpose, but it contains logic errors:
1 Minimum <- 0 2 FOR Counter <- 1 TO 100 3 IF Score[Counter] > Minimum 4 THEN 5 Minimum <- Score[Counter] 6 ENDIF 7 NEXT Counter 8 OUTPUT "The minimum score is ", Minimum
Identify the two logic errors in the pseudocode. For each error, explain why it is an error and provide the corrected pseudocode line(s).
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The student must recognize that initializing minimum to 0 fails when all array items are greater than 0. The correct initialization is using the first element of the array. Secondly, the comparison operator on Line 3 is pointing the wrong way, searching for values greater than the current minimum, which actually computes the maximum value. Replacing '>' with '<' fixes this logic error.
PastPaper.markingScheme
4.5 marks total: - 0.5 marks: Identifying Line 1 / initialization error. - 0.5 marks: Explaining why initializing to 0 fails for positive arrays. - 0.75 marks: Correct replacement: Minimum <- Score[1] - 0.5 marks: Identifying Line 3 / comparison operator error. - 0.5 marks: Explaining why '>' finds maximum instead of minimum. - 0.75 marks: Correct replacement: IF Score[Counter] < Minimum - 1.0 marks: Overall accuracy of explanation and pseudocode syntax.
Answer all questions. Write answers in pseudocode, SQL, or flow diagrams. Show clearly any tracing tables or working.
A programmer has designed a function Search(Target) to perform a linear search on a 1D array Names containing 50 elements (indexed 1 to 50). The function should return the array index where the target is found, or -1 if the target is not in the array. The following pseudocode is provided:
1 FUNCTION Search(Target) 2 Index <- 1 3 Found <- FALSE 4 REPEAT 5 IF Names[Index] = Target 6 THEN 7 Found <- TRUE 8 ENDIF 9 Index <- Index + 1 10 UNTIL Found = TRUE AND Index > 50 11 IF Found = TRUE 12 THEN 13 RETURN Index 14 ELSE 15 RETURN -1 16 ENDIF 17 ENDFUNCTION
Identify two logic errors in this algorithm. Explain why each is an error and provide the corrected pseudocode line(s).
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The post-condition loop UNTIL condition must use 'OR' because the loop should stop if either the target is found OR we run out of array elements. Using 'AND' forces the search to continue even if the item is found. Furthermore, the index is incremented immediately after the target is found, which means returning Index on line 13 returns the position + 1. The corrected code must subtract 1 from Index or store the correct index value during the search.
PastPaper.markingScheme
4.5 marks total: - 0.5 marks: Identifying Line 10 AND operator error. - 0.5 marks: Explaining why AND prevents early termination/causes out-of-bounds. - 0.75 marks: Correct replacement: UNTIL Found = TRUE OR Index > 50 - 0.5 marks: Identifying Line 13 index returning error. - 0.5 marks: Explaining why Index is off-by-one due to the post-increment on Line 9. - 0.75 marks: Correct replacement: RETURN Index - 1 - 1.0 marks: Overall accuracy of explanation and pseudocode syntax.
Answer all questions. Write answers in pseudocode, SQL, or flow diagrams. Show clearly any tracing tables or working.
The following pseudocode is intended to input 10 item prices, calculate their average, and output the total and average price. However, it contains three logic errors:
1 Total <- 0 2 FOR Count <- 1 TO 10 3 INPUT Price 4 Total <- Price 5 NEXT Count 6 Average <- Total / Count 7 OUTPUT "The average price is ", Total
Identify the three errors in the pseudocode. For each error, state the line number, explain why it is incorrect, and write the corrected pseudocode line.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The algorithm fails to accumulate values because line 4 uses assignment rather than addition. Line 6 attempts to use the loop counter outside the loop, but in standard IGCSE pseudocode, the counter variable after a 1 TO 10 loop is 11, which causes an incorrect division. Line 7 outputs the accumulated Total instead of the calculated Average.
PastPaper.markingScheme
4.5 marks total (1.5 marks per error identified, explained, and corrected): - Error 1: 0.5 marks for identifying Line 4; 0.5 marks for explanation of overwriting; 0.5 marks for correction (Total <- Total + Price). - Error 2: 0.5 marks for identifying Line 6; 0.5 marks for explanation of Count reaching 11 (or being out of scope); 0.5 marks for correction (Average <- Total / 10). - Error 3: 0.5 marks for identifying Line 7; 0.5 marks for explanation of printing total instead of average; 0.5 marks for correction (OUTPUT "The average price is ", Average).
Answer all questions. Write answers in pseudocode, SQL, or flow diagrams. Show clearly any tracing tables or working.
An algorithm is intended to perform a bubble sort to sort a 1D array List containing 10 integers (indexed 1 to 10) in ascending order. The following pseudocode contains three logic errors:
1 Boundary <- 10 2 REPEAT 3 Swap <- FALSE 4 FOR Index <- 1 TO Boundary 5 IF List[Index] > List[Index + 1] 6 THEN 7 List[Index] <- List[Index + 1] 8 List[Index + 1] <- List[Index] 9 Swap <- TRUE 10 ENDIF 11 NEXT Index 12 Boundary <- Boundary - 1 13 UNTIL Swap = TRUE
Identify the three logic errors in the pseudocode. For each error, state the line number(s), explain the problem, and provide the corrected pseudocode line(s).
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. The loop on line 4 runs until Index = Boundary. Since Boundary starts at 10, List[Index + 1] attempts to access index 11 which is out of bounds. The loop must stop at Boundary - 1. 2. The swapping logic on lines 7 and 8 is missing a temporary variable, meaning the value of List[Index] is lost when overwritten by List[Index + 1]. A temporary variable Temp is needed to hold the value. 3. The loop termination condition on line 13 checks if Swap = TRUE, meaning it will exit when a swap is made. A bubble sort must continue until a complete pass is made with NO swaps, so it must check UNTIL Swap = FALSE.
PastPaper.markingScheme
4.5 marks total (1.5 marks per error): - Error 1: 0.5 marks for identifying Line 4; 0.5 marks for explaining the out-of-bounds error on index 11; 0.5 marks for correction (FOR Index <- 1 TO Boundary - 1). - Error 2: 0.5 marks for identifying Lines 7-8; 0.5 marks for explaining the data loss during swap; 0.5 marks for three-line temporary swap code. - Error 3: 0.5 marks for identifying Line 13; 0.5 marks for explaining premature termination; 0.5 marks for correction (UNTIL Swap = FALSE).
PastPaper.question 8 · short_answer
4 PastPaper.marks
A database table, Books, is used to keep records of books in a bookstore. The table has the following fields: BookID (text, primary key), Title (text), Author (text), Genre (text), YearPublished (integer), Price (currency), and InStock (Boolean). Write an SQL query to display the Title, Author, and Price of all books where the Genre is 'Sci-Fi' and the Price is less than 15.00. The results should be sorted in ascending order of Price.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To extract the required data, a standard SELECT statement is formulated. 1. SELECT: Specify the columns to display (Title, Author, Price). 2. FROM: Specify the table name (Books). 3. WHERE: Combine the two criteria using the AND operator (Genre = 'Sci-Fi' AND Price < 15.00). 4. ORDER BY: Sort by Price in ascending order (ASC, which is also the default order).
PastPaper.markingScheme
1 mark for SELECT Title, Author, Price (comma-separated, spelling must be correct). 1 mark for FROM Books. 1 mark for WHERE Genre = 'Sci-Fi' AND Price < 15.00 (allow double or single quotes, allow 15 without decimals, reject if AND is missing or replaced by OR). 1 mark for ORDER BY Price [ASC] (ASC is optional, but DESC is incorrect).
PastPaper.question 9 · short_answer
4 PastPaper.marks
A database table, Students, contains details of students in a school. The table has the following fields: StudentID (text, primary key), FirstName (text), LastName (text), GradeLevel (integer), AverageGrade (integer), SchoolHouse (text), and ActiveSports (Boolean). Write an SQL query to display the FirstName, LastName, and AverageGrade of all students who belong to the SchoolHouse 'Red' or 'Blue', and have an AverageGrade of 85 or above. The results must be sorted in descending order of AverageGrade.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To select students from specific houses with a grade threshold, use: 1. SELECT FirstName, LastName, AverageGrade to retrieve the required fields. 2. FROM Students to specify the source table. 3. WHERE (SchoolHouse = 'Red' OR SchoolHouse = 'Blue') AND AverageGrade >= 85 to ensure correct logical precedence. Correct alternatives include: WHERE SchoolHouse IN ('Red', 'Blue') AND AverageGrade >= 85. 4. ORDER BY AverageGrade DESC to sort in descending order.
PastPaper.markingScheme
1 mark for SELECT FirstName, LastName, AverageGrade. 1 mark for FROM Students. 1 mark for correct WHERE clause criteria including logical grouping (e.g. parenthesized OR, or IN operator) and grade comparison (>= 85). 1 mark for ORDER BY AverageGrade DESC (DESC is mandatory).
A company operates three automated agricultural greenhouses (Zone 1, Zone 2, and Zone 3). A program is required to record and analyze the maximum daily temperatures (in degrees Celsius) for each of the three zones over a 7-day period.
Write an algorithm, in pseudocode, that meets the following requirements: - Declares three one-dimensional arrays, one for each zone, to store the maximum temperatures recorded for each of the 7 days. - Inputs the daily maximum temperature for each zone for all 7 days. - Validates each temperature input; only temperatures from \(-10.0\) to \(50.0\) degrees Celsius (inclusive) are acceptable. If an input is invalid, an appropriate error message must be displayed and the user prompted to re-enter the temperature until a valid value is provided. - Calculates and stores the average maximum temperature for each of the three zones over the 7 days. - Identifies the highest overall maximum temperature recorded during the entire week, noting which zone it occurred in and on which day (Day 1 to 7). - Outputs the average temperature for each zone. - Outputs a specific warning message if the average temperature for a zone exceeds \(35.0\) degrees Celsius. - Outputs the overall highest temperature, the zone in which it was recorded, and the day on which it occurred.
You must use pseudocode that follows the standard Cambridge IGCSE Computer Science style. Use meaningful variable names and include comments or formatting to make your code easy to read.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
### Method Explanation
1. **Initialization**: Three 1D arrays of size 7 (`Zone1`, `Zone2`, `Zone3`) are declared to store temperatures. Three running totals (`Total1`, `Total2`, `Total3`) are initialized to `0` to calculate the averages. `MaxTemp` is initialized to a low value (`-99.0`) so that any valid temperature will immediately replace it.
2. **Loop Structure**: A single `FOR` loop runs 7 times to cycle through each day. For each day, temperatures for Zone 1, Zone 2, and Zone 3 are requested.
3. **Validation Loop**: Each temperature input is validated using a post-conditioned validation loop (`REPEAT...UNTIL`). It ensures that only inputs between \(-10.0\) and \(50.0\) are processed. If an invalid value is entered, the user receives an error message and must re-enter the value.
4. **Tracking Highest Temperature**: After validation, each temperature is compared against `MaxTemp`. If it is higher, `MaxTemp` is updated, and the corresponding Day index and Zone number are recorded in `MaxDay` and `MaxZone`.
5. **Calculations & Output**: After the 7-day loop concludes, the averages are calculated by dividing each total by `7`. The average temperatures and conditional warning messages (if the average exceeds \(35.0\)) are printed. Finally, the details of the highest overall recorded temperature are printed.
PastPaper.markingScheme
#### Marking Scheme (Max 15 marks)
**Initialization (Max 2 marks):** - **1 mark**: Declaring three 1D arrays of size 7 to store temperatures (e.g. `Zone1[1:7]`). - **1 mark**: Initializing the three running totals to `0` and the variable to track the maximum temperature to a suitable low value (e.g. `-99.0` or `-10.0`).
**Outer Loop (Max 1 mark):** - **1 mark**: Correct use of a loop (e.g., `FOR Day <- 1 TO 7`) to control the 7 days.
**Input and Validation (Max 3 marks):** - **1 mark**: Inputting values for all three zones inside the day loop. - **1 mark**: Correct use of a loop (e.g., `REPEAT...UNTIL` or `WHILE...ENDWHILE`) to validate that the temperature input is within the range \(-10.0\) to \(50.0\) inclusive. - **1 mark**: Displaying a custom error message inside the validation structure when an invalid value is inputted.
**Logic and Data Storage (Max 5 marks):** - **1 mark**: Storing the valid inputs in the correct array at the correct index (e.g., `Zone1[Day]`). - **1 mark**: Adding the valid input value to the corresponding zone's running total. - **1 mark**: Comparing each valid input value with the current maximum temperature variable. - **1 mark**: Correctly updating the maximum temperature variable with the new highest value. - **1 mark**: Correctly updating variables to track the day and zone of the maximum temperature.
**Calculations and Outputs (Max 4 marks):** - **1 mark**: Correctly calculating the average temperatures for all three zones (totals divided by 7) after the loop. - **1 mark**: Outputting the calculated average temperatures with explanatory labels. - **1 mark**: Checking if the average temperature is strictly greater than \(35.0\) and outputting an appropriate warning message if so (tested for all three zones). - **1 mark**: Outputting the overall maximum temperature, alongside the correct day and zone.