An original Thinka practice paper modelled on the structure and difficulty of the Nov 2023 (V1) Cambridge International A Level Computer Science (0478) paper. Not affiliated with or reproduced from Cambridge.
Paper 11: Computer Systems
Answer all questions. Calculators must not be used. Total marks: 75.
17 Question · 65 marks
Question 1 · Short Answer
3 marks
An 8-bit binary register contains the value `10101100`.
Identify the following: 1. The hexadecimal equivalent of this binary value. 2. The binary value after performing a logical shift right of 2 places. 3. The denary (base 10) value of the shifted binary representation from part 2.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. To convert `10101100` to hexadecimal, split it into two 4-bit nibbles: `1010` (which is denary 10, hex A) and `1100` (which is denary 12, hex C). Thus, the hex value is AC. 2. Performing a logical shift right by 2 places moves all bits 2 positions to the right, filling the vacated left-most bits with 0s: `00101011`. 3. To convert `00101011` to denary, we sum the active place values: \(32 + 8 + 2 + 1 = 43\).
Marking scheme
Award 1 mark for each correct answer: - 1 mark for hexadecimal equivalent: AC (or ac) - 1 mark for shifted binary representation: 00101011 - 1 mark for denary value: 43
Question 2 · Short Answer
3 marks
Interrupts are crucial signals used in modern computer operating systems.
Describe three distinct scenarios (including the hardware or software trigger involved) that would generate an interrupt in a computer system.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An interrupt is a signal sent to the processor that halts current execution to handle a specific event. - A printer out of paper (hardware/IO device signal indicating it cannot proceed). - A keyboard keypress or mouse click (hardware signal informing the CPU that input needs processing). - A software error/exception like a division-by-zero (software execution failure).
Marking scheme
Award 1 mark per valid scenario described, up to a maximum of 3 marks: - Hardware I/O device error/status change (e.g. printer out of paper, paper jam, disk write complete) - User input device interaction (e.g. keyboard key pressed, mouse clicked) - Software execution exception/runtime error (e.g. division by zero, stack overflow, file not found)
Question 3 · Short Answer
3 marks
A barcode scanner uses a check digit to ensure data is correctly read and processed.
1. State the primary purpose of a check digit. 2. State two different manual data entry errors that a check digit can detect.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. A check digit is used to detect errors in data entry, transmission, or scanning, ensuring the entered code is valid. 2. Standard data entry errors detected include: - Transcription errors: where a single digit is entered incorrectly (e.g., typing '5' instead of '8'). - Transposition errors: where two adjacent digits are swapped (e.g., typing '12' instead of '21').
Marking scheme
Award 1 mark for the primary purpose: - To detect error(s) during data entry/transmission/scanning.
Award 1 mark for each correct data entry error identified (max 2): - Transcription error (or entering a digit incorrectly) - Transposition error (or swapping/reversing adjacent digits) - Omission error (missing out a digit) - Addition error (inserting an extra digit) (Accept clear descriptions of these errors)
Question 4 · Short Answer
3 marks
A portable digital camera uses Solid-State Drive (SSD) storage instead of a magnetic Hard Disk Drive (HDD).
Explain three physical or operational reasons why solid-state storage is more suitable than magnetic storage for a portable digital camera.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Solid-state storage is highly beneficial for portable consumer electronics: 1. Durability/reliability: It has no moving parts, making it resistant to physical shocks and drops, which is likely to happen to a hand-held camera. 2. Physical size and weight: SSDs are much smaller and lighter than HDDs, fitting into compact camera bodies. 3. Speed: Much faster read and write times allow the camera to save high-resolution photos or continuous video frames instantly.
Marking scheme
Award 1 mark for each valid reason explained, up to a maximum of 3 marks: - Solid-state has no moving parts / is highly durable, so it will not break if the camera is dropped or vibrated. - Solid-state is physically much smaller / lighter, allowing the camera to be compact and lightweight. - Solid-state has faster read/write speeds, enabling high-resolution burst photography/video capturing. - Solid-state consumes less power, prolonging the camera's battery life. (Do not accept just 'faster' or 'smaller' without a brief link/explanation relevant to the context)
Question 5 · descriptive
5 marks
Explain the purpose of an interrupt in a computer system and describe two different scenarios that would generate an interrupt.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An interrupt is a signal sent from a device or software application to the processor, indicating that it requires immediate attention.
When an interrupt occurs: 1. The processor suspends its current execution. 2. It saves the state of the current task (registers, program counter). 3. It loads and runs the appropriate Interrupt Service Routine (ISR). 4. Once the interrupt is serviced, the processor restores the saved state and resumes the previous task.
Scenarios that generate an interrupt include: - Hardware/Peripheral Interrupt: A printer runs out of paper or has a paper jam, requiring user intervention, or a keypress is detected on a keyboard. - Software/Runtime Interrupt: An error occurs during program execution, such as division by zero or an out-of-bounds memory access.
Marking scheme
Award 1 mark per point up to a maximum of 5 marks: - Definition: Interrupt is a signal sent to the processor from a device or software indicating it needs attention [1 mark] - Action: Processor suspends current execution and saves its current state / runs ISR [1 mark] - Resumption: Processor resumes original task once interrupt is serviced [1 mark] - Scenario 1: Valid hardware-related interrupt described (e.g. keypress, printer out of paper, mouse click) [1 mark] - Scenario 2: Valid software-related interrupt described (e.g. division by zero, page fault, software crash) [1 mark]
Question 6 · descriptive
5 marks
Describe the role of the Program Counter (PC) and the Memory Address Register (MAR) during the Fetch stage of the Von Neumann fetch-decode-execute cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
During the Fetch stage of the cycle: 1. The Program Counter (PC) holds the address of the next instruction to be fetched from memory. 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 1, so it points to the next consecutive instruction in memory. 4. A read signal is sent to main memory (RAM) via the Control Bus. 5. The instruction stored at the memory address currently held in the MAR is located and transferred to the Memory Data Register (MDR) via the Data Bus.
Marking scheme
Award 1 mark per point up to a maximum of 5 marks: - PC holds the memory 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 consecutive instruction [1 mark] - Memory is accessed at the address currently held in the MAR [1 mark] - The instruction at that address is transferred to the MDR (via the data bus) [1 mark]
Question 7 · descriptive
5 marks
A company is setting up a new network. They are choosing between serial half-duplex data transmission and parallel full-duplex data transmission.
Compare these two methods of data transmission by explaining how data is transmitted in each, and state one advantage of using serial half-duplex instead of parallel full-duplex.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The two methods differ in both format and directionality: 1. Serial Transmission: Data is sent one bit at a time, sequentially down a single wire or channel. 2. Parallel Transmission: Multiple bits (typically 8 bits or a byte) are sent simultaneously down multiple wires or channels. 3. Half-Duplex: Data can travel in both directions, but only in one direction at any given time (not simultaneously). 4. Full-Duplex: Data can travel in both directions simultaneously. 5. Advantage of Serial Half-Duplex: It is less expensive because it requires fewer physical wires/connections, and it is far more reliable over long distances because there is no risk of data skew (bits arriving out of synchronization) or crosstalk/interference between adjacent wires.
Marking scheme
Award 1 mark per point up to a maximum of 5 marks: - Serial: transmits 1 bit at a time over a single wire [1 mark] - Parallel: transmits multiple bits simultaneously over multiple wires [1 mark] - Half-duplex: transmission in both directions but only one direction at a time [1 mark] - Full-duplex: transmission in both directions simultaneously [1 mark] - Advantage: Lower cost (fewer wires) OR less data skew / higher reliability over longer distances [1 mark]
Question 8 · descriptive
5 marks
Describe how a cyclic redundancy check (CRC) is used to detect errors in transmitted data.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A cyclic redundancy check (CRC) is an error detection method that works as follows: 1. Before transmission, the sending device performs a mathematical calculation (polynomial division) on the block of data to be sent. 2. This calculation generates a remainder value (the CRC checksum). 3. The sender appends this CRC value to the end of the data block. 4. The complete packet (data + CRC) is transmitted to the receiving device. 5. Upon receipt, the receiver performs the exact same mathematical calculation on the received data. 6. The receiver compares its calculated remainder with the received CRC value. If they match, no error is detected. If they differ, an error has occurred during transmission, and a request for retransmission (ARQ) is usually sent.
Marking scheme
Award 1 mark per point up to a maximum of 5 marks: - Sender applies a mathematical algorithm/polynomial division to the data block [1 mark] - This produces a remainder / checksum / CRC value [1 mark] - The CRC value is appended to the data block before transmission [1 mark] - The receiver performs the same mathematical calculation on the received data block [1 mark] - The receiver compares the calculated result with the received CRC value; a mismatch indicates an error (and triggers retransmission) [1 mark]
Question 9 · descriptive
5 marks
A chemical plant uses an automated system to monitor and regulate the temperature of a reaction vessel.
Describe how sensors, microprocessors, and actuators are used in this automated closed-loop system to maintain the temperature within a safe range.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An automated closed-loop system functions as follows: 1. A temperature sensor continuously measures the ambient temperature inside the reaction vessel. 2. The analogue signal from the sensor is converted to a digital signal using an Analogue-to-Digital Converter (ADC) so the microprocessor can read it. 3. The microprocessor receives the digital temperature values and compares them to pre-programmed safe limits or a set-point value. 4. If the measured temperature exceeds the safe limit, the microprocessor sends a control signal to an actuator (such as a valve controller or cooling fan). 5. This signal may go through a Digital-to-Analogue Converter (DAC) if the actuator is analogue. 6. The actuator acts (e.g., opens a cooling valve to lower the temperature), which alters the physical state of the vessel. The process repeats continuously, establishing a feedback loop.
Marking scheme
Award 1 mark per point up to a maximum of 5 marks: - Sensor measures temperature continuously and sends data to the microprocessor [1 mark] - ADC is used to convert the analogue sensor readings to digital format [1 mark] - Microprocessor compares the digital readings with preset/safe temperature parameters [1 mark] - If out of range, the microprocessor sends a signal to an actuator (e.g. cooling valve/fan) [1 mark] - Actuator performs the physical action to regulate the temperature, closing the loop/feedback cycle [1 mark]
Question 10 · Conversions & Math
4 marks
A computer system stores the denary value 154 as an 8-bit unsigned binary integer.
Show your working to: 1. Convert 154 to an 8-bit binary integer. 2. Perform a logical right shift of two places on the resulting binary integer. 3. Convert this shifted binary integer into hexadecimal.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Convert 154 to 8-bit binary: \(154 = 128 + 16 + 8 + 2\), which is \(10011010_2\).
2. Perform a logical right shift of 2 places: Shift \(10011010_2\) right by 2 places and pad with 0s on the left to get \(00100110_2\).
3. Convert \(00100110_2\) to hexadecimal: Split into two nibbles: \(0010_2\) and \(0110_2\). \(0010_2 = 2_{16}\) \(0110_2 = 6_{16}\) Result = \(26\).
Marking scheme
- 1 mark for correct 8-bit binary value: \(10011010\) - 1 mark for correct logical right shift by 2 places: \(00100110\) (allow follow-through from incorrect binary value, must have leading 0s) - 1 mark for showing correct split of nibbles: \(0010\) and \(0110\) - 1 mark for correct final hexadecimal value: \(26\)
Question 11 · Conversions & Math
4 marks
An uncompressed bitmap image has a resolution of \(1024 \times 512\) pixels. The image is saved with a colour depth of 24 bits.
Calculate the file size of the image in Kibibytes (KiB). Show all your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Calculate total size in bits: \(1024 \times 512 \times 24\) bits
2. Convert bits to bytes by dividing by 8: \(\frac{1024 \times 512 \times 24}{8} = 1024 \times 512 \times 3\) bytes
3. Convert bytes to KiB by dividing by 1024: \(\frac{1024 \times 512 \times 3}{1024} = 512 \times 3 = 1536\) KiB.
Marking scheme
- 1 mark for showing multiplication of resolution by colour depth: \(1024 \times 512 \times 24\) bits or \(1024 \times 512 \times 3\) bytes. - 1 mark for dividing bits by 8 to convert to bytes. - 1 mark for dividing bytes by 1024 to convert to KiB. - 1 mark for correct final calculated value: 1536 (accept 1536 KiB).
Question 12 · Conversions & Math
4 marks
A mono audio track is recorded with a sample rate of 16,000 Hz and a sample resolution of 16 bits. The duration of the recording is 32 seconds.
Calculate the size of the audio file in Kibibytes (KiB). Show all your working.
Show answer & marking schemeHide answer & marking scheme
- 1 mark for correct formula / substitution: \(16000 \times 16 \times 32\) (bits) or \(16000 \times 2 \times 32\) (bytes). - 1 mark for multiplying by 1 for mono channel (or demonstrating mono channel size). - 1 mark for dividing total bytes by 1024 to convert to KiB. - 1 mark for correct final answer of 1000 (KiB).
Question 13 · Conversions & Math
4 marks
A data transmission uses a parity block (even parity) to check for errors. The following block of data is received:
Identify the row and column of the single bit that has been transmitted incorrectly, explain how you located it, and state its corrected value.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Count 1s in each row to check even parity: - Row 1: 4 (even) - Row 2: 4 (even) - Row 3: 5 (odd) -> ERROR detected in Row 3 - Row 4: 4 (even) - Row 5: 2 (even)
2. Count 1s in each column to check even parity: - Column 1: 2 (even) - Column 2: 2 (even) - Column 3: 4 (even) - Column 4: 3 (odd) -> ERROR detected in Column 4 - Columns 5 to 8: all have even parity.
3. The incorrect bit is at the intersection of Row 3 and Column 4, which is currently 0. 4. Changing this bit to 1 corrects the error.
Marking scheme
- 1 mark for identifying Row 3 has parity error (contains 5 ones / odd parity). - 1 mark for identifying Column 4 has parity error (contains 3 ones / odd parity). - 1 mark for explaining that the intersection of the error row and error column pinpoints the corrupt bit. - 1 mark for stating the corrected value is 1 (or changed from 0 to 1).
Question 14 · Diagram and Annotation
4 marks
The diagram shows some of the components and buses in a Central Processing Unit (CPU) based on the Von Neumann model.
``` +---------------+ | A | +---------------+ | v +---------------+ +-------------+ | MAR | ===== C ======> | | +---------------+ | | | Main | +---------------+ | Memory | | B | <==== D =======> | | +---------------+ +-------------+ | v +---------------+ | CIR | +---------------+ ```
Identify the labels **A**, **B**, **C**, and **D** in the diagram.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The fetch-decode-execute cycle begins with the Program Counter (PC), labeled **A**, which holds the address of the next instruction to be fetched. This address is copied to the Memory Address Register (MAR).
The MAR sends this address to the Main Memory via the Address Bus, labeled **C** (which is unidirectional, going from the CPU to Memory).
The data/instruction at that memory location is sent back to the Memory Data Register (MDR), labeled **B**, via the Data Bus, labeled **D** (which is bidirectional).
Finally, the instruction is copied from the MDR to the Current Instruction Register (CIR) for decoding and execution.
Marking scheme
Award 1 mark for each correct identification, up to a maximum of 4 marks:
- **A**: Program Counter (accept PC) - **B**: Memory Data Register (accept MDR) - **C**: Address Bus - **D**: Data Bus
*Note:* Abbreviated register names (PC, MDR) are fully acceptable.
Question 15 · Diagram and Annotation
4 marks
The diagram shows some of the components and buses in a Central Processing Unit (CPU) based on the Von Neumann model.
``` +---------------+ | A | +---------------+ | v +---------------+ +-------------+ | MAR | ===== C ======> | | +---------------+ | | | Main | +---------------+ | Memory | | B | <==== D =======> | | +---------------+ +-------------+ | v +---------------+ | CIR | +---------------+ ```
Identify the labels **A**, **B**, **C**, and **D** in the diagram.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The fetch-decode-execute cycle begins with the Program Counter (PC), labeled **A**, which holds the address of the next instruction to be fetched. This address is copied to the Memory Address Register (MAR).
The MAR sends this address to the Main Memory via the Address Bus, labeled **C** (which is unidirectional, going from the CPU to Memory).
The data/instruction at that memory location is sent back to the Memory Data Register (MDR), labeled **B**, via the Data Bus, labeled **D** (which is bidirectional).
Finally, the instruction is copied from the MDR to the Current Instruction Register (CIR) for decoding and execution.
Marking scheme
Award 1 mark for each correct identification, up to a maximum of 4 marks:
- **A**: Program Counter (accept PC) - **B**: Memory Data Register (accept MDR) - **C**: Address Bus - **D**: Data Bus
*Note:* Abbreviated register names (PC, MDR) are fully acceptable.
Question 16 · Multiple Choice
2 marks
An interrupt is a signal sent to the processor to request its attention. Which of the following statements about interrupts are true?
1. An interrupt can be generated by a hardware device (such as a printer running out of paper). 2. The processor must immediately stop executing the current program and shut down when any interrupt is received. 3. Interrupts allow for efficient multi-tasking by letting the CPU allocate time slices to different tasks. 4. When an interrupt is received, the current state of the CPU registers is saved before the Interrupt Service Routine (ISR) is executed.
A.1 and 2 only
B.1, 3 and 4 only
C.2 and 3 only
D.1, 2, 3 and 4
Show answer & marking schemeHide answer & marking scheme
Worked solution
Statement 1 is true because hardware devices use interrupts to signal status changes to the CPU. Statement 2 is false because the processor does not shut down; it suspends execution of the current program, runs the Interrupt Service Routine, and then resumes the program. Statement 3 is true because interrupts are fundamental to multi-tasking and scheduling. Statement 4 is true because saving the CPU state is necessary to resume the original process accurately once the interrupt is serviced.
Marking scheme
1 mark: Correctly identifying statements 1, 3, and 4 as true. 1 mark: Correctly identifying statement 2 as false and choosing option B.
Question 17 · Multiple Choice
2 marks
A system uses a checksum to detect data transmission errors. The checksum is calculated by summing the byte values of the transmitted data and finding the remainder after dividing the sum by 256 (modulo 256).
The received data bytes are: 150, 42, 85, and 93. The transmitted checksum is 114.
Determine whether an error is detected, and identify a limitation of using a checksum for error detection.
A.An error is detected because the total sum is 370; a limitation is that it can only be used with text-based data files.
B.No error is detected because the calculated checksum is 114; a limitation is that it cannot automatically correct the errors it detects.
C.An error is detected because the calculated remainder is 114; a limitation is that it requires a high amount of processing power.
D.No error is detected because the sum is 370; a limitation is that it requires a duplex transmission line to function.
Show answer & marking schemeHide answer & marking scheme
Worked solution
First, find the sum of the received bytes: \(150 + 42 + 85 + 93 = 370\). Next, calculate the modulo 256: \(370 \pmod{256} = 114\). Since the calculated checksum (114) matches the transmitted checksum (114), no error is detected. One of the main limitations of a checksum is that it only detects that an error occurred; it does not pinpoint the exact error location, meaning it cannot automatically correct the corrupted data on its own.
Marking scheme
1 mark: Correctly calculating the checksum as 114 and stating no error is detected. 1 mark: Identifying the correct limitation (it cannot correct the errors it detects) and choosing option B.
Paper 21: Algorithms, Programming and Logic
Answer all questions. Calculators must not be used. Total marks: 75.
10 Question · 74 marks
Question 1 · multiple_choice
2 marks
Consider the following pseudocode algorithm:
DECLARE X, Y : INTEGER X <- 1 Y <- 5 WHILE X < Y DO X <- X + 2 Y <- Y + 1 ENDWHILE
What are the final values of X and Y after this pseudocode segment is executed?
A.X = 9, Y = 9
B.X = 7, Y = 8
C.X = 11, Y = 10
D.X = 5, Y = 7
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's trace the loop step by step: - Initial state: X = 1, Y = 5. - Iteration 1: Is X < Y? (1 < 5 is True). X becomes 1 + 2 = 3. Y becomes 5 + 1 = 6. - Iteration 2: Is X < Y? (3 < 6 is True). X becomes 3 + 2 = 5. Y becomes 6 + 1 = 7. - Iteration 3: Is X < Y? (5 < 7 is True). X becomes 5 + 2 = 7. Y becomes 7 + 1 = 8. - Iteration 4: Is X < Y? (7 < 8 is True). X becomes 7 + 2 = 9. Y becomes 8 + 1 = 9. - Iteration 5: Is X < Y? (9 < 9 is False). The loop terminates.
Therefore, the final values are X = 9, Y = 9.
Marking scheme
1 mark: Correctly trace at least three iterations of the loop. 1 mark: Identify final values of X = 9 and Y = 9.
Question 2 · multiple_choice
2 marks
A database table named 'Books' contains fields: Title, Genre, Price, and Stock.
A developer runs the following SQL query: SELECT Title, Price FROM Books WHERE (Genre = "Sci-Fi" OR Genre = "Fantasy") AND Price < 15.00;
Which of the following database records would be returned by this query?
Show answer & marking schemeHide answer & marking scheme
Worked solution
To be returned, a record must satisfy both conditions: 1. The Genre must be either "Sci-Fi" OR "Fantasy". 2. The Price must be strictly less than 15.00.
Let's evaluate the options: - Option A: Genre is "Fantasy" (True) but Price is 15.00, which is not strictly less than 15.00 (False). - Option B: Genre is "Sci-Fi" (True) and Price is 12.99, which is less than 15.00 (True). This meets all conditions. - Option C: Genre is "Space Opera" (False) and Price is 8.50 (True). Overall False. - Option D: Genre is "Fantasy" (True) but Price is 16.50 (False). Overall False.
Marking scheme
1 mark: Correctly identify that the price must be strictly less than 15.00. 1 mark: Correctly identify the record satisfying both the logical OR and the logical AND conditions.
Question 3 · multiple_choice
2 marks
Consider the logic circuit represented by the following boolean expression:
\(X = \text{NOT}(A \text{ AND } B) \text{ AND } (A \text{ OR } B)\)
What are the resulting output values of \(X\) for the input combinations (A = 0, B = 1) and (A = 1, B = 1) respectively?
A.1 and 1
B.0 and 1
C.1 and 0
D.0 and 0
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's calculate \(X\) for each set of inputs: 1. For A = 0, B = 1: - \(A \text{ AND } B = 0 \text{ AND } 1 = 0\) - \(\text{NOT}(0) = 1\) - \(A \text{ OR } B = 0 \text{ OR } 1 = 1\) - \(X = 1 \text{ AND } 1 = 1\)
2. For A = 1, B = 1: - \(A \text{ AND } B = 1 \text{ AND } 1 = 1\) - \(\text{NOT}(1) = 0\) - \(A \text{ OR } B = 1 \text{ OR } 1 = 1\) - \(X = 0 \text{ AND } 1 = 0\)
Thus, the outputs are 1 and 0.
Marking scheme
1 mark: Correct calculation of the intermediate AND/OR operations. 1 mark: Correct identification of both final outputs (1 and 0).
Question 4 · multiple_choice
2 marks
A 1-dimensional array named 'Scores' is initialized as follows:
The following pseudocode algorithm is then executed:
FOR Index <- 2 TO 5 IF Scores[Index] < Scores[Index - 1] THEN Scores[Index] <- Scores[Index - 1] ENDIF ENDFOR
What are the contents of the 'Scores' array after this execution?
A.[120, 150, 90, 200, 110]
B.[120, 150, 150, 150, 150]
C.[150, 150, 150, 200, 200]
D.[120, 150, 150, 200, 200]
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's trace the loop execution step-by-step: - Initially: Scores = [120, 150, 90, 200, 110] - Index = 2: Compare Scores[2] (150) < Scores[1] (120). This is False. No change. Scores = [120, 150, 90, 200, 110] - Index = 3: Compare Scores[3] (90) < Scores[2] (150). This is True. Scores[3] becomes 150. Scores = [120, 150, 150, 200, 110] - Index = 4: Compare Scores[4] (200) < Scores[3] (150). This is False. No change. Scores = [120, 150, 150, 200, 110] - Index = 5: Compare Scores[5] (110) < Scores[4] (200). This is True. Scores[5] becomes 200. Scores = [120, 150, 150, 200, 200]
Hence, the final array is [120, 150, 150, 200, 200].
Marking scheme
1 mark: Correct trace of the conditional assignment for index 3 (replacing 90 with 150). 1 mark: Correct final contents of the array [120, 150, 150, 200, 200].
Question 5 · structured
7 marks
A school's software team is developing an automated computer system to record and analyze student daily attendance.
(a) Define the term *decomposition* and explain how the team would apply it when designing this attendance system. [3]
(b) Define the term *abstraction* and describe one piece of student information that would be abstracted (ignored) when designing this specific system. [2]
(c) During the testing stage of the program development life cycle, different types of test data are used. Identify two different types of test data that could be used to verify the attendance input system, and provide an example of each. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Decomposition is the process of breaking down a complex problem into smaller, more manageable sub-problems. In this attendance system, the team can divide the software into separate sub-modules such as: - Input module: to record student daily attendance. - Processing module: to calculate attendance statistics and percentages. - Output module: to generate alerts or print weekly reports for school management.
(b) Abstraction is the process of removing or filtering out unnecessary details that are not required to solve the problem, leaving only the key characteristics. In this attendance database, details such as the student's medical history, height, eye color, or favorite subject are completely ignored as they have no relevance to daily attendance tracking.
(c) Two types of test data with examples: 1. Normal data: Data that is expected and within the correct range. Example: Entering 'Present' or 'Absent' (or a valid active student ID like 4509). 2. Abnormal / Invalid data: Data that is of the wrong type or completely outside limits, which the system should reject. Example: Entering a negative number or 'N/A' into a numerical student ID field.
Marking scheme
Part (a) [3 marks total]: - 1 mark: Definition of decomposition (breaking down a complex problem into smaller/sub-problems). - 2 marks: Two sensible applications/sub-problems relevant to an attendance system (e.g., recording/inputting attendance, calculating statistics, generating alert emails, storing data in database).
Part (b) [2 marks total]: - 1 mark: Definition of abstraction (filtering/removing unnecessary details to focus on key characteristics). - 1 mark: Sensible example of student detail that would be ignored (e.g., eye color, height, home address, medical history, favorite hobby).
Part (c) [2 marks total]: - 1 mark: Identifying any two valid types of test data (from: Normal, Extreme, Boundary, Abnormal/Invalid). - 1 mark: Correct and matching examples provided for both identified test data types.
Acceptable alternatives for Part (c): - Normal / acceptable data: valid registration code / ID. - Abnormal / invalid data: out-of-bounds inputs, symbols where characters are expected. - Boundary / extreme data: entering exactly the minimum (0 days) or maximum (e.g., 365 days) possible values to check boundary limits.
Question 6 · Pseudocode Analysis & Trace
10 marks
An algorithm is written in pseudocode below. It processes an array Data containing eight integer elements.
FOR Index <- 1 TO 8 Value <- Data[Index] IF Value > Limit THEN Limit <- Value - Limit Count <- Count + 1 ELSE Value <- Value * 2 Data[Index] <- Value ENDIF NEXT Index
OUTPUT "Count is ", Count OUTPUT "Limit is ", Limit ```
(a) Complete the trace table for the pseudocode algorithm. [8 marks]
(b) State the exact final outputs produced by this algorithm. [2 marks]
Show answer & marking schemeHide answer & marking scheme
Worked solution
During the execution of the algorithm: - We start with Limit = 4, Count = 0. - At Index = 1: Value = 12. Since 12 > 4, Limit becomes 12 - 4 = 8, and Count increments to 1. - At Index = 2: Value = 5. Since 5 is not > 8, the ELSE branch is taken: Value becomes 5 * 2 = 10, and Data[2] is updated to 10. - At Index = 3: Value = -3. Since -3 is not > 8, Value becomes -3 * 2 = -6, and Data[3] is updated to -6. - At Index = 4: Value = 8. Since 8 is not > 8, Value becomes 8 * 2 = 16, and Data[4] is updated to 16. - At Index = 5: Value = 12. Since 12 > 8, Limit becomes 12 - 8 = 4, and Count increments to 2. - At Index = 6: Value = 0. Since 0 is not > 4, Value becomes 0 * 2 = 0, and Data[6] is updated to 0. - At Index = 7: Value = 7. Since 7 > 4, Limit becomes 7 - 4 = 3, and Count increments to 3. - At Index = 8: Value = -1. Since -1 is not > 3, Value becomes -1 * 2 = -2, and Data[8] is updated to -2. - After the loop finishes, the final two statements output: "Count is 3" "Limit is 3"
Marking scheme
Part (a): [8 Marks total for Trace Table] - 1 mark: Correct initialization row (Limit = 4, Count = 0) and Index tracking from 1 to 8. - 1 mark: Value column correctly records original elements (12, 5, -3, 8, 12, 0, 7, -1). - 1 mark: Value column correctly updated to double values where applicable (10, -6, 16, -2; accept on same or subsequent row). - 2 marks: Limit correctly updated (changes to 8, 4, and 3 only). - 1 mark: Count correctly updated (changes to 1, 2, and 3 only). - 1 mark: Data[2] (10) and Data[3] (-6) updated correctly. - 1 mark: Data[4] (16) and Data[8] (-2) updated correctly.
Part (b): [2 Marks total for Outputs] - 1 mark: First output correctly showing "Count is 3" (or equivalent format matches text structure). - 1 mark: Second output correctly showing "Limit is 3".
Question 7 · Logic Circuit and Truth Table
8 marks
An industrial control system monitors a heating unit. The system has three inputs: - \(S\) representing the System Status (1 if active, 0 if inactive) - \(H\) representing the Heat Level (1 if high, 0 if normal) - \(E\) representing the Emergency Switch (1 if pressed, 0 if not pressed)
An alarm, \(A\), is activated (outputs 1) under either of the following conditions: - The system is active (\(S=1\)) AND the heat level is high (\(H=1\)) OR - The emergency switch is pressed (\(E=1\)) AND the system is inactive (\(S=0\))
(a) Write a logic expression to represent the conditions for activating the alarm (\(A\)). [4 marks]
(b) Complete the truth table below for this control system. [4 marks]
Show answer & marking schemeHide answer & marking scheme
Worked solution
Part (a): To formulate the logic expression: 1. "The system is active (S=1) AND the heat level is high (H=1)" translates to: \(S \text{ AND } H\). 2. "The emergency switch is pressed (E=1) AND the system is inactive (S=0)" translates to: \(E \text{ AND NOT } S\). 3. Since either condition can trigger the alarm, we combine them with an OR gate: \(A = (S \text{ AND } H) \text{ OR } (E \text{ AND NOT } S)\).
Part (b): We calculate the output \(A\) for each row: - Row 1 (0, 0, 0): \((0 \text{ AND } 0) \text{ OR } (0 \text{ AND NOT } 0) = 0 \text{ OR } 0 = 0\) - Row 2 (0, 0, 1): \((0 \text{ AND } 0) \text{ OR } (1 \text{ AND NOT } 0) = 0 \text{ OR } 1 = 1\) - Row 3 (0, 1, 0): \((0 \text{ AND } 1) \text{ OR } (0 \text{ AND NOT } 0) = 0 \text{ OR } 0 = 0\) - Row 4 (0, 1, 1): \((0 \text{ AND } 1) \text{ OR } (1 \text{ AND NOT } 0) = 0 \text{ OR } 1 = 1\) - Row 5 (1, 0, 0): \((1 \text{ AND } 0) \text{ OR } (0 \text{ AND NOT } 1) = 0 \text{ OR } 0 = 0\) - Row 6 (1, 0, 1): \((1 \text{ AND } 0) \text{ OR } (1 \text{ AND NOT } 1) = 0 \text{ OR } 0 = 0\) - Row 7 (1, 1, 0): \((1 \text{ AND } 1) \text{ OR } (0 \text{ AND NOT } 1) = 1 \text{ OR } 0 = 1\) - Row 8 (1, 1, 1): \((1 \text{ AND } 1) \text{ OR } (1 \text{ AND NOT } 1) = 1 \text{ OR } 0 = 1\)
Marking scheme
Part (a) [Max 4 marks]: - 1 mark for: \(S \text{ AND } H\) - 1 mark for: \(E \text{ AND NOT } S\) - 1 mark for: Joining both terms with \(\text{OR}\) - 1 mark for: Correct overall equation: \(A = (S \text{ AND } H) \text{ OR } (E \text{ AND NOT } S)\) (or equivalent notation, e.g., using Boolean algebraic symbols like \(A = (S \cdot H) + (E \cdot \overline{S})\)).
Part (b) [Max 4 marks]: - 4 marks if all 8 outputs are correct: 0, 1, 0, 1, 0, 0, 1, 1. - 3 marks if 6 or 7 outputs are correct. - 2 marks if 4 or 5 outputs are correct. - 1 mark if 2 or 3 outputs are correct. - 0 marks if 1 or fewer outputs are correct.
Question 8 · Flowchart and Test Design
16 marks
An algorithm is represented by the following flowchart description. The algorithm inputs a series of student marks (out of 100). It counts the number of passes (marks 50 and above) and the number of fails (marks below 50). It also calculates the average mark of the students who passed. The input process terminates when a sentinel value of -1 is entered.
[Flowchart Description] - Step 1: START - Step 2: PassCount = 0, FailCount = 0, PassTotal = 0 - Step 3: INPUT Mark - Step 4: Decision: Is Mark = -1? - If YES: Go to Step 10 - If NO: Go to Step 5 - Step 5: Decision: Is Mark < 0 OR Mark > 100? - If YES: OUTPUT "Error: Invalid Mark", then INPUT Mark, then go back to Step 4 - If NO: Go to Step 6 - Step 6: Decision: Is Mark >= 50? - If YES: Go to Step 7 - If NO: Go to Step 8 - Step 7: PassCount = PassCount + 1, PassTotal = PassTotal + Mark, then go to Step 9 - Step 8: FailCount = FailCount + 1, then go to Step 9 - Step 9: INPUT Mark, then go back to Step 4 - Step 10: Decision: Is PassCount > 0? - If YES: PassAverage = PassTotal / PassCount, OUTPUT "Passed:", PassCount, "Failed:", FailCount, "Average Pass:", PassAverage, then go to Step 11 - If NO: OUTPUT "Passed:", PassCount, "Failed:", FailCount, "No students passed", then go to Step 11 - Step 11: END
(a) Complete the trace table for the following input data: 55, 30, 105, 45, 75, -1
(b) The algorithm needs to be modified so that it also counts the number of "distinctions". A distinction is defined as a mark of 85 or above. Explain the modifications required to the steps of the flowchart to implement this new feature.
(c) Identify one example of each of the following types of test data that could be used to test the validation check (Step 5): 1. Normal test data 2. Extreme test data 3. Boundary test data (at the upper limit) 4. Abnormal test data For each example, state the expected outcome of the validation check.
Show answer & marking schemeHide answer & marking scheme
(b) Flowchart Modifications: 1. Initialize a new variable: DistinctionCount = 0 in Step 2. 2. In Step 7, after updating PassCount and PassTotal, insert a new decision box: "Is Mark >= 85?" 3. If YES: DistinctionCount = DistinctionCount + 1, then go to Step 9. 4. If NO: Go directly to Step 9. 5. Modify Step 10 to output the final value of DistinctionCount alongside the other output metrics.
(c) Test Data and Expected Outcomes: 1. Normal test data: e.g., 72. Expected outcome: Accepted (proceeds to Step 6). 2. Extreme test data: e.g., 0 or 100. Expected outcome: Accepted (proceeds to Step 6). 3. Boundary test data (at the upper limit): e.g., 100 (accepted) and 101 (rejected with "Error: Invalid Mark"). 4. Abnormal test data: e.g., -10, 150, or "eighty". Expected outcome: Rejected with "Error: Invalid Mark" message.
Marking scheme
(a) Trace Table [8 marks total]: - 1 mark for correct initializations (PassCount=0, FailCount=0, PassTotal=0). - 1 mark for correct tracing of Mark 55 (PassCount=1, PassTotal=55). - 1 mark for correct tracing of Mark 30 (FailCount=1). - 1 mark for correct handling of Mark 105 (no change to counts/totals, Outputs "Error: Invalid Mark"). - 1 mark for correct tracing of Mark 45 (FailCount=2). - 1 mark for correct tracing of Mark 75 (PassCount=2, PassTotal=130). - 1 mark for calculating correct average (PassAverage = 65) upon sentinel -1. - 1 mark for correct final output ("Passed: 2, Failed: 2, Average Pass: 65").
(b) Modifications [4 marks total]: - 1 mark for initializing a distinction counter (e.g., DistinctionCount = 0 at the start). - 1 mark for inserting a decision block checking if Mark >= 85. - 1 mark for placing this check on the "YES" path of the pass condition (Step 7) or correctly integrated logic. - 1 mark for incrementing DistinctionCount and including it in the final output step.
(c) Test Data [4 marks total]: - 1 mark for Normal data (any integer 1 to 99 except boundaries) and stating it is accepted. - 1 mark for Extreme data (exactly 0 or 100) and stating it is accepted. - 1 mark for Boundary data (either 100/101 or 0/-1) with correct expected acceptance/rejection. - 1 mark for Abnormal data (negative value, value > 100, or non-numeric) and stating it is rejected with error.
Question 9 · structured
10 marks
A database table, BIKE_RENTAL, is used to store details of bicycle rentals in a city. Here is a sample of the data in the table: | RentalID | BikeType | HourlyRate | DailyRental | DateRented | DurationHours | | BK091 | Electric | 8.50 | False | 12/05/2023 | 4 | | BK104 | Mountain | 5.00 | False | 12/05/2023 | 2 | | BK112 | Electric | 8.50 | True | 13/05/2023 | 10 | | BK115 | Road | 6.00 | False | 14/05/2023 | 1 | | BK120 | Electric | 8.50 | False | 14/05/2023 | 5 | (a) (i) State the field that should be chosen as the primary key. [1 mark] (ii) Give a reason for your choice in part (a)(i). [1 mark] (b) State the most appropriate data type for each of the following fields: (i) DailyRental [1 mark] (ii) HourlyRate [1 mark] (iii) DateRented [1 mark] (c) Write an SQL query to display the RentalID and DurationHours fields for all records where the BikeType is 'Electric' and the DurationHours is greater than 3. The output must be sorted in descending order of DurationHours. [4 marks] (d) State the name of a validation check that can be performed on the DurationHours field to ensure that values entered are between 1 and 24 inclusive. [1 mark]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a)(i) RentalID is selected as the primary key because it uniquely identifies each rental transaction. (a)(ii) It contains a unique value for every record, preventing duplicate primary keys. (b)(i) DailyRental contains only True or False values, which is a Boolean data type. (b)(ii) HourlyRate contains decimal numbers, so Real, Decimal, or Currency is appropriate. (b)(iii) DateRented holds calendar dates, so the Date/Time data type is best. (c) The SQL query selects only the RentalID and DurationHours fields from the BIKE_RENTAL table, filters for records where the BikeType is 'Electric' and DurationHours is greater than 3, and sorts them in descending order of DurationHours using the ORDER BY statement with the DESC keyword. (d) A range check is used to verify that numerical values lie within a specified minimum (1) and maximum (24) range.
Marking scheme
(a)(i) 1 mark for RentalID. (a)(ii) 1 mark for explaining it uniquely identifies each record / has no duplicate values. (b)(i) 1 mark for Boolean / Yes-No. (b)(ii) 1 mark for Real / Currency / Decimal (Do not accept Integer). (b)(iii) 1 mark for Date / Date-Time. (c) 1 mark for SELECT RentalID, DurationHours; 1 mark for FROM BIKE_RENTAL; 1 mark for WHERE BikeType = 'Electric' AND DurationHours > 3 (Accept double quotes around Electric); 1 mark for ORDER BY DurationHours DESC (Accept descending). (d) 1 mark for Range check.
Question 10 · Extended Programming Scenario
15 marks
A theatre uses a 2D array, SeatingPlan[1:10, 1:12], of type String to manage its seat reservations. The theatre has 10 rows, and each row has 12 seats.
Each element in the array contains either the string "Empty" if the seat is available, or a unique customer BookingID (e.g. "BK942") if the seat is already reserved.
Write an algorithm in pseudocode that meets the following requirements: - Prompts the user to enter their unique BookingID. It must validate that the input is not empty, and re-prompt until a non-empty string is entered. - Prompts the user to enter a row number and a seat number. - Allows the user to cancel the booking process by entering -1 for the row number. - Validates that the row number is between 1 and 10 (or -1 to cancel), and the seat number is between 1 and 12. If an input is invalid, it outputs an error message and prompts the user to try again. - If the inputs are valid, checks if the selected seat is empty: - If it is "Empty", reserves the seat by writing the BookingID to that position in the array, outputs a confirmation message, and ends the booking loop. - If it is already reserved, outputs a message stating the seat is taken, and loops back to allow the user to choose another seat. - Once the booking process is complete (either booked successfully or cancelled), the algorithm must count and output: - The total number of booked seats currently in the theatre. - The total number of empty seats remaining in the theatre.
You must declare all variables used in your algorithm. Assume the SeatingPlan array has already been created and populated with either "Empty" or existing booking IDs before your algorithm runs.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The solution implements the standard logic required for a multi-stage programming problem in Cambridge IGCSE Computer Science:
1. Variable Declarations: All variables must be declared with their respective data types (INTEGER, STRING, BOOLEAN) at the start. 2. Validation Loop: A WHILE loop is used to ensure that the BookingID input is not empty. 3. Interactive Booking Loop: A loop controlled by the boolean flag 'BookingSuccessful' prompts the user for row and seat numbers. It handles the escape condition of -1 immediately. 4. Dual-Index Range Checks: Inner conditions verify that 'RowInput' is between 1 and 10, and 'SeatInput' is between 1 and 12 before accessing the array elements, preventing out-of-bounds errors. 5. Array Update and Loop Exit: If 'SeatingPlan[RowInput, SeatInput]' equals '"Empty"', the position is updated with the user's booking ID and the flag 'BookingSuccessful' is toggled to TRUE to gracefully terminate the loop. 6. Array Search and Counting: A nested FOR loop structure traverses every element in the 'SeatingPlan[1:10, 1:12]' array. Each element is evaluated; if it matches '"Empty"', the 'EmptyCount' increments, otherwise 'BookedCount' increments. 7. Output: Finally, the computed tallies are printed out to the console.
Marking scheme
Marking scheme (Max 15 marks):
- 1 Mark: Correct variable declarations with appropriate data types. - 1 Mark: Input for BookingID with a validation loop that prevents empty strings. - 1 Mark: Initialization of boolean flag (e.g. BookingSuccessful <- FALSE) and outer loop to repeat until reservation is complete or cancelled. - 1 Mark: Correct validation logic for the row cancellation condition (-1). - 1 Mark: Validation check for RowInput range (1 to 10). - 1 Mark: Validation check for SeatInput range (1 to 12). - 2 Marks: Checking if 2D array coordinates contain "Empty" (1 mark for correct array syntax, 1 mark for logical comparison). - 1 Mark: Assigning BookingID to SeatingPlan[RowInput, SeatInput] when the seat is empty. - 1 Mark: Setting flag to terminate the loop correctly on success or cancellation. - 1 Mark: Initializing counters BookedCount and EmptyCount to 0. - 2 Marks: Nested FOR loop structure to iterate through all rows (1 to 10) and seats (1 to 12). - 1 Mark: Correct matching logic within loop to increment BookedCount or EmptyCount. - 1 Mark: Outputting final counts of booked and empty seats after nested loops complete.
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.