An original Thinka practice paper modelled on the structure and difficulty of the Jun 2025 (V1) 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 numerical questions.
11 Question · 90 marks
Question 1 · open
4 marks
A security camera system records video footage. Each minute of video footage requires 128 MiB of storage space. The system has a storage drive with a capacity of 16 GiB.
Calculate the maximum number of minutes of video footage that can be stored on the drive. Show all your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To find the maximum number of minutes, perform the following steps:
1. Convert the storage drive capacity from GiB to MiB: \(1 \text{ GiB} = 1024 \text{ MiB}\) \(16 \text{ GiB} = 16 \times 1024 \text{ MiB} = 16384 \text{ MiB}\)
2. Divide the total capacity by the space required per minute: \(\text{Number of minutes} = \frac{16384 \text{ MiB}}{128 \text{ MiB}}\)
3. Calculate the final value: \(\frac{16384}{128} = 128\) minutes.
Award marks as follows (max 4 marks): * 1 mark: Showing that \(1 \text{ GiB} = 1024 \text{ MiB}\) (or demonstrating multiplication of the GiB value by 1024). * 1 mark: Showing a correct calculation of total capacity in MiB as \(16384\) (or expressing it as \(16 \times 1024\) / \(2^{14}\)). * 1 mark: Showing correct division of the total capacity by 128 (e.g., \(\frac{16384}{128}\) or equivalent division using powers of 2). * 1 mark: Correct final answer of 128 (accept 128 minutes).
Question 2 · open
4 marks
A security camera system records video footage. Each minute of video footage requires 128 MiB of storage space. The system has a storage drive with a capacity of 16 GiB.
Calculate the maximum number of minutes of video footage that can be stored on the drive. Show all your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To find the maximum number of minutes, perform the following steps:
1. Convert the storage drive capacity from GiB to MiB: \(1 \text{ GiB} = 1024 \text{ MiB}\) \(16 \text{ GiB} = 16 \times 1024 \text{ MiB} = 16384 \text{ MiB}\)
2. Divide the total capacity by the space required per minute: \(\text{Number of minutes} = \frac{16384 \text{ MiB}}{128 \text{ MiB}}\)
3. Calculate the final value: \(\frac{16384}{128} = 128\) minutes.
Award marks as follows (max 4 marks): * 1 mark: Showing that \(1 \text{ GiB} = 1024 \text{ MiB}\) (or demonstrating multiplication of the GiB value by 1024). * 1 mark: Showing a correct calculation of total capacity in MiB as \(16384\) (or expressing it as \(16 \times 1024\) / \(2^{14}\)). * 1 mark: Showing correct division of the total capacity by 128 (e.g., \(\frac{16384}{128}\) or equivalent division using powers of 2). * 1 mark: Correct final answer of 128 (accept 128 minutes).
Question 3 · Number Systems & Device Output
9 marks
An actuator in a robotic arm is controlled by an 8-bit binary register.
(a) The register currently contains the binary value: **10110100**
(i) Convert this binary value to denary. [1]
(ii) Convert this binary value to hexadecimal. Show your working. [2]
(iii) The microcontroller needs to increase the speed of the actuator by adding a denary value of 45 to the current register value. Show your working and state the final 8-bit binary value that represents this new state. [2]
(b) The robotic arm operates in a smart factory where physical prototype parts are produced. Name a suitable output device that can be used to manufacture solid, physical 3D prototype parts for the robotic arm. Describe how this device works to produce these parts. [4]
Show answer & marking schemeHide answer & marking scheme
(ii) To convert `10110100` to hexadecimal: - Split the 8-bit binary value into two 4-bit nibbles: `1011` and `0100`. - Convert `1011` to denary: \(8 + 2 + 1 = 11\), which is hexadecimal `B`. - Convert `0100` to denary: \(4\), which is hexadecimal `4`. - Combining the digits gives the hexadecimal value: `B4`.
(iii) To add a denary value of 45: - The initial denary value is 180. - Calculate the new denary sum: \(180 + 45 = 225\). - Convert the denary value 225 back to an 8-bit binary number: - 128 goes into 225 (remainder 97) -> 1 - 64 goes into 97 (remainder 33) -> 1 - 32 goes into 33 (remainder 1) -> 1 - 16, 8, 4, 2 do not go into 1 -> 0, 0, 0, 0 - 1 goes into 1 (remainder 0) -> 1 - The resulting 8-bit binary value is `11100001`. - Alternatively, perform binary addition of `10110100` (180) and `00101101` (45): `10110100` + `00101101` = `11100001`.
(b) - Output device: 3D printer. - How it works: 1. A digital 3D design of the component is created using Computer-Aided Design (CAD) software. 2. This 3D design file is imported into slicing software, which divides the virtual object into thousands of thin, horizontal, two-dimensional layers. 3. The 3D printer prints the physical object sequentially, layer-by-layer (an additive manufacturing process) starting from the bottom upward. 4. The print nozzle heats and extrudes a material (such as plastic filament, liquid polymer resin, or powdered metal) to lay down each layer, which is then cured, set, or cooled before the subsequent layer is deposited on top.
Marking scheme
Part (a) [5 marks total] (i) [1 mark] - 180 (1)
(ii) [2 marks] - Splitting the binary byte into correct 4-bit nibbles (`1011` and `0100`) OR converting one nibble correctly (1) - B4 (1)
(iii) [2 marks] - Show correct working (e.g., establishing the new denary sum is 225, or converting 45 to the binary value `00101101` to show binary addition) (1) - `11100001` (1)
Part (b) [4 marks total] - Name of output device: 3D printer / 3D prototyping printer (1) - Max 3 marks for explanation of how it works: - A 3D digital model is designed using CAD (Computer-Aided Design) software (1) - The model is sliced into many thin, horizontal layers (using slicing software) (1) - The printer deposits/adds material layer-by-layer (sequentially from bottom to top) / uses additive manufacturing (1) - Uses materials such as plastic filament / liquid polymer / resin / powdered metal (1) - The print nozzle/head moves in 3 dimensions (along X, Y, and Z axes) (1) - Material is melted/extruded OR cured/fused using a laser/UV light source (1) - Each layer is allowed to cool / set / cure before the next layer is printed (1)
Question 4 · calculation
4 marks
A digital image is 512 pixels wide by 400 pixels high. The image has a colour depth of 16 bits. Calculate the file size of the image in kibibytes (KiB). Show all your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To calculate the file size: 1. Calculate the total number of pixels in the image: \(512 \times 400 = 204,800\) pixels. 2. Calculate the total number of bits: \(204,800 \text{ pixels} \times 16 \text{ bits} = 3,276,800 \text{ bits}\). 3. Convert bits to bytes: \(3,276,800 / 8 = 409,600 \text{ bytes}\) (Alternatively, since 16 bits = 2 bytes, \(204,800 \times 2 \text{ bytes} = 409,600 \text{ bytes}\)). 4. Convert bytes to kibibytes (KiB) by dividing by 1024: \(409,600 / 1024 = 400 \text{ KiB}\).
Marking scheme
Award marks for each step up to a maximum of 4 marks: 1 mark for showing the calculation of total pixels: \(512 \times 400 = 204,800\). 1 mark for multiplying total pixels by colour depth: \(204,800 \times 16\) bits or \(204,800 \times 2\) bytes. 1 mark for dividing total bytes by 1024 (or dividing total bits by 8192) to convert to KiB. 1 mark for correct final answer: 400 (or 400 KiB).
Question 5 · structural
12 marks
A high-precision scientific instrument measures temperature and transmits this data to a computer located 50 metres away.
(a) (i) Identify and justify the most appropriate method of data transmission (serial or parallel) to send data over this distance. [3]
(ii) Data can be transmitted in both directions, but not at the exact same time (e.g., the computer occasionally sends configuration commands back to the instrument). Identify and justify this direction of transmission. [2]
(b) The system uses an even parity check block to detect errors during transmission. The following block of data was received:
Identify the row and column of the corrupted bit that contains an error, explain how you located it, and state its correct value. [5]
(c) If an error is detected, the computer uses Automatic Repeat Request (ARQ) to manage the error. Describe how ARQ is used to ensure error-free data transmission. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) (i) - Method: Serial transmission. - Justification: Over a distance of 50 metres, serial transmission is much cheaper to install as it requires fewer wires. Furthermore, serial transmission avoids data skewing (where bits sent simultaneously arrive at different times), which is a major issue for parallel transmission over longer distances.
(ii) - Direction: Half-duplex. - Justification: Transmission needs to happen in both directions (instrument to computer, and computer to instrument), but since they do not need to transmit simultaneously, half-duplex is appropriate and more cost-effective than full-duplex.
(b) - Corrupted bit location: Byte 2 (Row 2), Bit 4 (Column 4). - Explanation for row: Calculating the horizontal parity for each row shows that Byte 2 has five 1s (an odd number), which violates the even parity rule. - Explanation for column: Calculating the vertical parity for Column 4 across Bytes 1 to 4 gives three 1s (an odd number). Since the parity byte bit for Column 4 is 0, this indicates a mismatch. - Correct value: The received bit is 1, so the correct value must be 0.
(c) - The receiver detects the error using the parity check and sends a Negative Acknowledgement (NACK) back to the sender (or does not send an ACK). - A timeout mechanism is used; if the sender does not receive a positive acknowledgement (ACK) within a specified time limit, it automatically retransmits the block of data.
Marking scheme
Part (a)(i) [3 marks]: - 1 mark for identifying Serial transmission. - 1 mark for stating that it is cheaper/less complex to install over longer distances (50m). - 1 mark for stating it prevents data skewing / crosstalk over distance.
Part (a)(ii) [2 marks]: - 1 mark for identifying Half-duplex transmission. - 1 mark for explaining that data can travel in both directions, but not at the same time.
Part (b) [5 marks]: - 1 mark for identifying Byte 2 / Row 2 as containing the error. - 1 mark for identifying Bit 4 / Column 4 as containing the error. - 1 mark for explaining that Byte 2 has an odd number of 1s (5), which violates even parity. - 1 mark for explaining that Column 4 has an odd number of 1s (3), which mismatches its parity bit (0). - 1 mark for stating the correct value is 0 (changing the received 1 to 0).
Part (c) [2 marks]: - 1 mark for stating that the receiver sends a negative acknowledgement (NACK) or does not send an acknowledgement when an error is detected. - 1 mark for stating that the sender automatically retransmits the data if an ACK is not received within a set timeframe (timeout).
Question 6 · structured
9 marks
The Von Neumann model of a computer system relies on key components, registers, and buses to process instructions.
(a) Identify the specific register or bus described by each of the following statements: (i) This bus is bidirectional and is used to transmit actual data and instructions between the CPU and memory. [1] (ii) This register holds the address of the memory location currently being read from or written to. [1] (iii) This register holds the instruction that is currently being decoded and executed. [1]
(b) Describe how the Program Counter (PC) and the Memory Data Register (MDR) are used during the fetch stage of the fetch-decode-execute cycle. [4]
(c) State the role of the following components within the CPU: (i) Control Unit (CU) [1] (ii) Arithmetic Logic Unit (ALU) [1]
Show answer & marking schemeHide answer & marking scheme
Worked solution
Part (a): (i) The Data Bus is bidirectional and carries data and instructions. (1 mark) (ii) The Memory Address Register (MAR) holds the memory address currently in use. (1 mark) (iii) The Current Instruction Register (CIR) holds the instruction currently being decoded and executed. (1 mark)
Part (b): - The Program Counter (PC) holds the address of the next instruction to be fetched. (1 mark) - This address is copied from the PC to the Memory Address Register (MAR). (1 mark) - The PC is incremented by 1 (to point to the next instruction). (1 mark) - The instruction/data stored at the address in the MAR is retrieved and placed into the Memory Data Register (MDR). (1 mark)
Part (c): (i) Control Unit (CU): Decodes instructions and sends control signals to coordinate the movement of data through the processor. (1 mark) (ii) Arithmetic Logic Unit (ALU): Performs arithmetic operations (e.g. addition, subtraction) and logical operations (e.g. comparison, boolean logic). (1 mark)
Marking scheme
Part (a) [3 marks total]: - 1 mark for Data Bus (Accept: 'data bus') - 1 mark for Memory Address Register (Accept: 'MAR') - 1 mark for Current Instruction Register (Accept: 'CIR')
Part (b) [4 marks total]: - 1 mark for stating the PC holds the address of the next instruction to be fetched. - 1 mark for stating this address is copied from the PC to the MAR. - 1 mark for stating the PC is incremented (by 1). - 1 mark for stating the instruction/contents of that memory location are copied into the MDR.
Part (c) [2 marks total]: - 1 mark for stating that the CU decodes instructions / directs the flow of data / sends control signals (Accept any one of these). - 1 mark for stating that the ALU performs calculations AND logical decisions/comparisons (Must mention both calculation/arithmetic and logical/comparison for the mark).
Question 7 · short-answer
9 marks
Encryption is widely used to protect data when it is transmitted across a network. (a) Compare symmetric and asymmetric encryption by describing three differences between them. [3] (b) A user, Alice, wants to send a confidential document over the internet to another user, Bob, using asymmetric encryption. (i) State which key is used to encrypt the document, and identify who generates this key. [2] (ii) State which key is used to decrypt the document, and identify who holds this key. [2] (c) Modern secure websites use SSL/TLS protocols which combine both symmetric and asymmetric encryption. Explain why both types of encryption are used rather than just using asymmetric encryption. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
a) Difference 1: Symmetric encryption uses a single key for both encryption and decryption, whereas asymmetric encryption uses a pair of keys (a public key and a private key). Difference 2: Symmetric encryption is computationally faster and more efficient, whereas asymmetric encryption is slower and more resource-intensive. Difference 3: Symmetric encryption requires the secure sharing of the secret key (key distribution issue), whereas asymmetric encryption allows the public key to be shared openly. b) (i) The encryption key is Bob's public key, which is generated by Bob (the recipient). (ii) The decryption key is Bob's private key, which is kept secret and held only by Bob. c) Asymmetric encryption is computationally expensive, making it too slow to encrypt large amounts of data. To resolve this, asymmetric encryption is used during the SSL/TLS handshake to securely share a temporary symmetric key. This symmetric key, which is much faster to process, is then used for the remainder of the session to encrypt the actual data transmitted.
Marking scheme
Part (a) [Max 3 marks]: 1 mark for key difference (symmetric uses one key, asymmetric uses public/private pair). 1 mark for speed/performance difference (symmetric is faster/less intensive). 1 mark for key distribution issue (symmetric requires secure key sharing, asymmetric does not require sharing the private key). Part (b)(i) [Max 2 marks]: 1 mark for identifying 'Bob's public key'. 1 mark for stating that Bob (the recipient) generates it. Part (b)(ii) [Max 2 marks]: 1 mark for identifying 'Bob's private key'. 1 mark for stating that Bob (the recipient) holds/keeps it. Part (c) [Max 2 marks]: 1 mark for explaining that asymmetric encryption is too slow/computationally intensive for large volumes of data, so it is only used for the initial handshake/key exchange. 1 mark for explaining that symmetric encryption is faster and used to encrypt the actual data transmission during the session.
Question 8 · structured
11 marks
A computer system uses both primary memory and secondary storage.
(a) State three differences between Random Access Memory (RAM) and Read Only Memory (ROM). [3]
(b) As more applications are opened, the physical RAM can become full. Describe how virtual memory is created and used to prevent the system from crashing. [5]
(c) Explain why relying heavily on virtual memory can significantly reduce a computer's performance. Identify the specific term used to describe this effect. [3]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Differences between RAM and ROM: 1. RAM is volatile (loses data when power is lost) whereas ROM is non-volatile (retains data when power is lost). 2. RAM can be read from and written to, whereas ROM is read-only. 3. RAM holds temporary active data/programs currently in use, while ROM holds permanent startup instructions (the BIOS / bootstrap loader).
(b) How virtual memory is created and used: - The OS designates a portion of secondary storage (such as HDD or SSD) to act as an extension of RAM. - Data and programs are split into fixed-size blocks called pages. - When physical RAM is full, the OS identifies inactive pages. - These inactive pages are copied (swapped out) to the virtual memory on the secondary storage, freeing up space in the physical RAM. - When those pages are needed again, they are swapped back into RAM, while other inactive pages are swapped out.
(c) Performance drawbacks: - Secondary storage devices (HDDs and SSDs) have significantly slower read/write speeds than physical RAM. - When the OS spends more time moving pages back and forth between RAM and secondary storage than executing instructions, this is known as disk thrashing. - This causes the computer to become highly unresponsive, lag, or temporarily freeze.
Marking scheme
(a) Award 1 mark per valid point up to a maximum of 3 marks: - RAM is volatile AND ROM is non-volatile - RAM is read/write AND ROM is read-only - RAM stores temporary running programs/OS files AND ROM stores startup code/BIOS/bootstrap loader - RAM has a larger storage capacity than ROM (typically)
(b) Award 1 mark per valid point up to a maximum of 5 marks: - Virtual memory is allocated/created on secondary storage (HDD/SSD) - Memory/data is divided into pages - Inactive pages are copied/transferred from RAM to virtual memory when RAM is full - This frees up physical space in RAM for active/current tasks - When the transferred data is required again, it is swapped back into RAM (and other data swapped out)
(c) Award 1 mark per valid point up to a maximum of 3 marks: - Access/read-write speed of secondary storage is much slower than RAM [1 mark] - Identifies 'disk thrashing' / 'thrashing' as the term [1 mark] - Explanation: computer spends more time swapping data/pages than executing program instructions, leading to system freeze/lag [1 mark]
Question 9 · structured
11 marks
A computer system uses both primary memory and secondary storage.
(a) State three differences between Random Access Memory (RAM) and Read Only Memory (ROM). [3]
(b) As more applications are opened, the physical RAM can become full. Describe how virtual memory is created and used to prevent the system from crashing. [5]
(c) Explain why relying heavily on virtual memory can significantly reduce a computer's performance. Identify the specific term used to describe this effect. [3]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Differences between RAM and ROM: 1. RAM is volatile (loses data when power is lost) whereas ROM is non-volatile (retains data when power is lost). 2. RAM can be read from and written to, whereas ROM is read-only. 3. RAM holds temporary active data/programs currently in use, while ROM holds permanent startup instructions (the BIOS / bootstrap loader).
(b) How virtual memory is created and used: - The OS designates a portion of secondary storage (such as HDD or SSD) to act as an extension of RAM. - Data and programs are split into fixed-size blocks called pages. - When physical RAM is full, the OS identifies inactive pages. - These inactive pages are copied (swapped out) to the virtual memory on the secondary storage, freeing up space in the physical RAM. - When those pages are needed again, they are swapped back into RAM, while other inactive pages are swapped out.
(c) Performance drawbacks: - Secondary storage devices (HDDs and SSDs) have significantly slower read/write speeds than physical RAM. - When the OS spends more time moving pages back and forth between RAM and secondary storage than executing instructions, this is known as disk thrashing. - This causes the computer to become highly unresponsive, lag, or temporarily freeze.
Marking scheme
(a) Award 1 mark per valid point up to a maximum of 3 marks: - RAM is volatile AND ROM is non-volatile - RAM is read/write AND ROM is read-only - RAM stores temporary running programs/OS files AND ROM stores startup code/BIOS/bootstrap loader - RAM has a larger storage capacity than ROM (typically)
(b) Award 1 mark per valid point up to a maximum of 5 marks: - Virtual memory is allocated/created on secondary storage (HDD/SSD) - Memory/data is divided into pages - Inactive pages are copied/transferred from RAM to virtual memory when RAM is full - This frees up physical space in RAM for active/current tasks - When the transferred data is required again, it is swapped back into RAM (and other data swapped out)
(c) Award 1 mark per valid point up to a maximum of 3 marks: - Access/read-write speed of secondary storage is much slower than RAM [1 mark] - Identifies 'disk thrashing' / 'thrashing' as the term [1 mark] - Explanation: computer spends more time swapping data/pages than executing program instructions, leading to system freeze/lag [1 mark]
Question 10 · structured
7 marks
Robots are increasingly used in automated industrial environments.
(a) State three characteristics that define a robot. [3]
(b) A robotic arm is used in a manufacturing factory to place microchips onto printed circuit boards (PCBs). Explain how sensors, a microprocessor, and actuators interact in this robotic system to complete this task. [4]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) A robot is defined by the following key characteristics: 1. It has a physical, mechanical structure or frame. 2. It has electrical components, such as sensors and actuators, to interact with the environment. 3. It is programmable and controlled by a microprocessor or computer system.
(b) The interaction process occurs as follows: 1. Sensors (such as optical sensors, cameras, or proximity sensors) detect the exact position and orientation of the PCB or the microchip. 2. The sensors send this captured data to the microprocessor (converting analog signals to digital via an ADC if necessary). 3. The microprocessor processes this input data and compares it to pre-programmed coordinates or target reference points. 4. Based on this comparison, the microprocessor calculates the required movement and sends control signals to the actuators (e.g., stepper motors or pneumatic grippers). 5. The actuators execute the movement, picking up the microchip and precisely placing it onto the PCB.
Marking scheme
Part (a) [Max 3 marks]: - 1 mark for mentioning a mechanical structure / physical body / frame. - 1 mark for mentioning electrical/electronic components (or specifically sensors/actuators). - 1 mark for being programmable / controlled by a microprocessor / computer. - 1 mark for possessing some level of autonomy / ability to make decisions.
Part (b) [Max 4 marks]: - 1 mark: Sensors (e.g., camera/optical/proximity) measure/detect the position/presence of the PCB or microchip. - 1 mark: Sensor data is sent to the microprocessor (accept mention of ADC converting signals). - 1 mark: Microprocessor processes data and compares it with pre-stored/programmed values/coordinates. - 1 mark: Microprocessor sends control signals to the actuators (accept mention of DAC converting signals). - 1 mark: Actuators (e.g., motors/grippers) physically move the arm/place the chip. - 1 mark: Mention of a continuous feedback loop to adjust positioning.
Question 11 · written
10 marks
An online retailer uses an Operating System (OS) to manage its servers, handles digital currency (cryptocurrency) payments from customers, and must defend its systems against cyber security threats.
(a) Explain how a firewall helps to protect the retailer's network from unauthorized access. [3 marks]
(b) Digital currencies often rely on blockchain technology to record transactions. Describe how blockchain technology works to ensure that transaction data cannot be easily altered or forged. [4 marks]
(c) The Operating System (OS) has many roles. Identify two functions of an operating system, other than managing security updates, and explain how one of these functions directly contributes to the security of the system. [3 marks]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) A firewall acts as a protective barrier between the retailer's secure internal network and external networks (such as the Internet). It monitors and filters all incoming and outgoing network traffic, comparing the data packets against a set of pre-defined security rules/criteria. If data does not meet these criteria, the firewall blocks it, preventing unauthorized access and potential malware infections.
(b) Blockchain is a decentralized, distributed digital ledger. Transactions are grouped together into blocks. Each block contains a unique cryptographic hash, as well as the cryptographic hash of the previous block in the chain, linking them securely. If anyone attempts to alter data in an existing block, that block's hash changes instantly, making all subsequent blocks in the chain invalid. Because identical copies of the blockchain are stored across a peer-to-peer network of independent computer nodes, any change must be validated by consensus across the network, making forgery practically impossible.
(c) Two functions of an operating system are: User Management (Access Control) and Memory Management. User Management directly supports security by requiring users to authenticate themselves (using usernames, passwords, or biometrics) before gaining access to the system. It also controls user privileges, preventing unauthorized users from accessing sensitive system files or administrative settings.
Marking scheme
(a) Firewall explanation [Max 3 marks]: - 1 mark: Sits between the internal/private network and external networks (e.g. the Internet). - 1 mark: Monitors and filters incoming and outgoing network traffic. - 1 mark: Compares data packets against a set of pre-defined rules/criteria. - 1 mark: Blocks traffic that does not meet the criteria (or alerts network administrators).
(b) Blockchain explanation [Max 4 marks]: - 1 mark: It is a decentralized / distributed database (ledger) across a peer-to-peer network of nodes. - 1 mark: Transactions are grouped together into blocks. - 1 mark: Each block contains a cryptographic hash of the block and the cryptographic hash of the previous block. - 1 mark: If data in a block is changed, its hash changes, which invalidates all subsequent blocks in the chain. - 1 mark: Changes require consensus across the network nodes to be accepted, preventing unauthorized modifications.
(c) OS functions and security [Max 3 marks]: - 1 mark: Identifies first valid OS function (e.g. User Management / Access Control, Memory Management, File Management, Multitasking / Process Management, Device Management). - 1 mark: Identifies second valid OS function (different from the first). - 1 mark: Explains how one of these functions directly contributes to system security. (e.g., User management: enforces authentication and limits file access permissions; OR Memory management: prevents applications from accessing or overwriting memory allocated to other programs, preventing data leakage; OR File management: sets read/write/execute permissions to prevent unauthorized modification of files).
Paper 2: Algorithms, Programming and Logic
Answer all questions. Use pseudocode or flowchart symbols as appropriate. No calculators permitted.
11 Question · 75 marks
Question 1 · Theory
4 marks
An input validation routine accepts an integer value representing a student's test percentage. The acceptable values are from \( 0 \) to \( 100 \) inclusive.
Define the following terms and provide one specific test input value for each, based on this scenario:
1. Extreme data 2. Boundary data
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Extreme data: - Definition: Test data that lies at the outer limits of what is acceptable or valid (the maximum and minimum acceptable values). - Example: \( 0 \) or \( 100 \).
2. Boundary data: - Definition: Test data on either side of the limit of acceptability (typically one valid value and one invalid value immediately next to the limit). - Example: \( -1 \) and \( 0 \), or \( 100 \) and \( 101 \).
Marking scheme
Max 4 marks: - 1 mark: Correct definition of extreme data (values at the absolute limit of validity). - 1 mark: Correct example of extreme data for this system (e.g., \( 0 \) or \( 100 \)). - 1 mark: Correct definition of boundary data (values on the immediate boundaries of acceptability, containing a valid and an invalid value). - 1 mark: Correct example of boundary data for this system (e.g., \( -1 \) and \( 0 \) OR \( 100 \) and \( 101 \)).
*Accept*: For boundary data, a single invalid boundary value (like \( -1 \) or \( 101 \)) if accompanied by a clear explanation that it is tested against the boundary.
Question 2 · Theory
4 marks
A system requires a user to enter and confirm a new password.
(a) Explain the difference between validation and verification in the context of this system, providing one example of how each process is applied during password entry. [2]
(b) Identify two different validation checks that can be performed on the password input, describing how each check ensures the password is valid. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) Difference: - Validation is an automatic system check to ensure the password meets specified criteria (e.g., checking that the password is at least \( 8 \) characters long). - Verification is a check to ensure that the password was entered accurately without transcription errors (e.g., requiring double-entry of the password and checking if both match).
(b) Validation checks (any two from): - Length check: Ensures that the password is within an acceptable number of characters (e.g., at least \( 8 \) characters). - Presence check: Ensures that the password field has not been left empty. - Character/Format check: Ensures that the password contains required character types (e.g., at least one uppercase letter and one number).
Marking scheme
Part (a) [2 marks]: - 1 mark: Explanation of validation with a password context example. - 1 mark: Explanation of verification with a password context example (e.g., double entry/visual comparison).
Part (b) [2 marks]: - 1 mark: First validation check identified and description of how it is applied to a password (e.g., Length check to ensure a minimum length). - 1 mark: Second validation check identified and description of how it is applied to a password (e.g., Presence check to ensure the field is not blank).
*Reject*: 'Range check' as a general term unless explicitly explained as checking the number of characters (length) within a minimum and maximum limit.
Question 3 · short_answer
4 marks
The following pseudocode algorithm inputs 10 numbers and calculates the total of any numbers greater than 50:
TOTAL <- 0 FOR Count <- 1 TO 10 INPUT Number IF Number > 50 THEN TOTAL <- TOTAL + Number ENDIF NEXT Count PRINT TOTAL
Rewrite this algorithm using a WHILE...DO...ENDWHILE loop structure instead of the FOR loop. The functionality of the algorithm must remain exactly the same.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The converted algorithm in pseudocode is:
TOTAL <- 0 Count <- 1 WHILE Count <= 10 DO INPUT Number IF Number > 50 THEN TOTAL <- TOTAL + Number ENDIF Count <- Count + 1 ENDWHILE PRINT TOTAL
Marking scheme
1 mark for initializing the loop counter variable before the loop (e.g., Count <- 1) 1 mark for the correct loop condition (e.g., WHILE Count <= 10 DO or WHILE Count < 11 DO) 1 mark for incrementing the loop counter inside the loop body (e.g., Count <- Count + 1) 1 mark for correct nesting and syntax of the entire structure (including correct loop body logic and ENDWHILE)
Question 4 · practical
8 marks
A system uses a product code stored as a string format `CCC-DDDD-X` where: - `CCC` represents a three-letter category code (e.g. "TEC", "HOM") - The fourth character is always a hyphen ("-") - `DDDD` represents a four-digit identification number - The ninth character is always a hyphen ("-") - `X` represents a single digit indicating the priority level (1 to 5)
Write a pseudocode algorithm (as a function or sequence of statements) that takes a single string parameter called `ProductCode` and: 1. Checks if the total length of the product code is exactly 10 characters. 2. Verifies that the hyphens are in the correct positions (index 4 and index 9). 3. Extracts the priority digit `X`, converts it to an integer, and checks if it is between 1 and 5 inclusive. 4. Extracts the identification number `DDDD`, converts it to an integer, and checks if it is greater than or equal to 1000. 5. Returns `TRUE` if all conditions are met, otherwise returns `FALSE`.
You must use the following standard pseudocode functions in your solution: - `LENGTH(String)`: returns the number of characters in the string. - `SUBSTRING(String, StartPosition, Length)`: returns a portion of the string starting from `StartPosition` for a length of `Length` characters (where index starts at 1). - `STRING_TO_NUM(String)`: converts a numeric string to an integer value.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Below is a complete pseudocode function demonstrating how to perform the requested validation:
```pseudocode FUNCTION ValidateCode(ProductCode : STRING) RETURNS BOOLEAN DECLARE Valid : BOOLEAN DECLARE Priority, ID : INTEGER
Valid <- TRUE
IF LENGTH(ProductCode) <> 10 THEN Valid <- FALSE ELSE IF SUBSTRING(ProductCode, 4, 1) <> "-" OR SUBSTRING(ProductCode, 9, 1) <> "-" THEN Valid <- FALSE ENDIF
Priority <- STRING_TO_NUM(SUBSTRING(ProductCode, 10, 1)) IF Priority < 1 OR Priority > 5 THEN Valid <- FALSE ENDIF
ID <- STRING_TO_NUM(SUBSTRING(ProductCode, 5, 4)) IF ID < 1000 THEN Valid <- FALSE ENDIF ENDIF
RETURN Valid ENDFUNCTION ```
Marking scheme
Marks are awarded as follows (max 8 marks):
- **1 mark**: Correct function header and footer structure with a string parameter and a boolean return. - **1 mark**: Correct check of overall length using `LENGTH(ProductCode) <> 10` (or equivalent structure). - **1 mark**: Correct check of both hyphens at positions 4 and 9 using `SUBSTRING(ProductCode, 4, 1)` and `SUBSTRING(ProductCode, 9, 1)`. - **1 mark**: Correctly extracting the priority substring using `SUBSTRING(ProductCode, 10, 1)`. - **1 mark**: Correctly extracting the identification number substring using `SUBSTRING(ProductCode, 5, 4)`. - **1 mark**: Correct use of `STRING_TO_NUM` to convert both extracted values to integers. - **1 mark**: Correct range checking conditions (priority is `>= 1 AND <= 5`; identification number is `>= 1000`). - **1 mark**: Correct use of logical flow/variables ensuring `TRUE` is returned only when all checks pass, and `FALSE` is returned otherwise.
Question 5 · practical
4 marks
A programmer needs to write an algorithm that inputs a total number of minutes, and then calculates and outputs the equivalent duration in hours and remaining minutes.
For example, an input of 145 minutes should output: 2 hours and 25 minutes.
Write a pseudocode algorithm to perform this task. You must use the library routines (operators) \(DIV\) and \(MOD\) in your solution.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To convert minutes into hours and minutes, we use integer division and the remainder: 1. We read the input value (e.g., `TotalMinutes`). 2. We use the `DIV` operator to perform integer division by 60, which gives the whole number of hours: `Hours <- TotalMinutes DIV 60` 3. We use the `MOD` operator to find the remainder after dividing by 60, which gives the remaining minutes: `Mins <- TotalMinutes MOD 60` 4. We output both values.
Example pseudocode: ``` INPUT TotalMinutes Hours <- TotalMinutes DIV 60 Mins <- TotalMinutes MOD 60 OUTPUT Hours, " hours and ", Mins, " minutes" ```
Marking scheme
4 marks in total: - 1 mark: Inputting a value for total minutes (e.g., `INPUT TotalMinutes` or equivalent). - 1 mark: Correct calculation of hours using integer division `DIV` by 60. - 1 mark: Correct calculation of remaining minutes using modulo `MOD` by 60. - 1 mark: Outputting both calculated values (message optional but must output both variables).
Question 6 · written
6 marks
An algorithm is intended to input exactly 100 positive integers. It must calculate and output the average (mean) of these 100 positive integers, and find and output the maximum number entered. Any negative numbers or zero entered must be ignored and not count towards the 100 positive integers.
The following pseudocode has been written to perform this task, but it contains three errors.
01 Count <- 0 02 Sum <- 0 03 Max <- 0 04 REPEAT 05 INPUT Num 06 IF Num > 0 THEN 07 Sum <- Sum + Num 08 IF Num < Max THEN 09 Max <- Num 10 ENDIF 11 ENDIF 12 Count <- Count + 1 13 UNTIL Count = 100 14 Average <- Sum * Count 15 OUTPUT "Average is: ", Average 16 OUTPUT "Maximum is: ", Max
Identify the three errors. For each error, state the line number, describe the error, and write the corrected pseudocode line.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let's analyze the pseudocode step-by-step to find the three errors: 1. Finding the Maximum (Line 08): The algorithm is designed to find the maximum positive integer. Line 08 check is 'IF Num < Max THEN'. Since Max is initialized to 0, and we want to find the largest value, we should check if the newly entered number is greater than the current maximum. Therefore, the comparison operator should be '>' instead of '<'. 2. Counting only positive numbers (Line 12): The requirements specify that negative numbers or zero must be ignored and must not count towards the 100 positive integers. In the given pseudocode, the increment 'Count <- Count + 1' on line 12 is placed outside the 'IF Num > 0 THEN' structure (which ends on line 11). This means Count is incremented for every input, even if it is negative or zero. To correct this, the increment must be moved inside the IF statement so it only executes when a valid positive number is processed. 3. Calculating the average (Line 14): To find the mean/average, we must divide the sum of the numbers by the total count. Line 14 uses multiplication: 'Average <- Sum * Count'. This must be corrected to division: 'Average <- Sum / Count'.
Marking scheme
1 mark for each correctly identified error with line number and description (max 3 marks). 1 mark for each correct pseudocode correction (max 3 marks).
Detailed breakdown: - Error 1 (Comparison): - Identification: Line 08 (or 08/09) compares if Num is less than Max / checks for minimum instead of maximum. - Correction: IF Num > Max THEN (Accept: IF Max < Num THEN) - Error 2 (Increment location): - Identification: Line 12 increments Count outside the IF block / counts invalid/negative inputs. - Correction: Move 'Count <- Count + 1' inside the IF statement (e.g., between line 10 and 11, or before ENDIF on line 11). - Error 3 (Average calculation): - Identification: Line 14 multiplies Sum by Count instead of dividing. - Correction: Average <- Sum / Count (Accept: Average <- Sum / 100)
Question 7 · structured_question
8 marks
### Part (a) An automated greenhouse ventilation system controls a fan (F). The fan is turned on (F = 1) if: - Temperature is high (T = 1) AND Humidity is NOT high (H = 0) - OR - Manual override is ON (M = 1) AND Temperature is NOT high (T = 0)
Write the logic expression for this system.
[4 marks]
### Part (b) Complete the truth table for the following logic expression:
\(X = (A \text{ AND } B) \text{ NOR } (\text{NOT } C)\)
Show answer & marking schemeHide answer & marking scheme
Worked solution
### Part (a) Solution: To construct the logic expression, we break down the logic requirements for when the fan (F) is active (F = 1): 1. First condition: "Temperature is high (T = 1) AND Humidity is NOT high (H = 0)" translates to: `T AND NOT H`. 2. Second condition: "Manual override is ON (M = 1) AND Temperature is NOT high (T = 0)" translates to: `M AND NOT T`. 3. Combining these two conditions with "OR" gives: `(T AND NOT H) OR (M AND NOT T)`.
Thus, the complete logic expression is: `F = (T AND NOT H) OR (M AND NOT T)`
### Part (b) Solution: To find the output X for the expression \(X = (A \text{ AND } B) \text{ NOR } (\text{NOT } C)\), we calculate the intermediate values for each row:
1. **Row 1 (0, 0, 0)**: - \(A \text{ AND } B = 0\) - \(\text{NOT } C = 1\) - \(0 \text{ NOR } 1 = 0\) 2. **Row 2 (0, 0, 1)**: - \(A \text{ AND } B = 0\) - \(\text{NOT } C = 0\) - \(0 \text{ NOR } 0 = 1\) 3. **Row 3 (0, 1, 0)**: - \(A \text{ AND } B = 0\) - \(\text{NOT } C = 1\) - \(0 \text{ NOR } 1 = 0\) 4. **Row 4 (0, 1, 1)**: - \(A \text{ AND } B = 0\) - \(\text{NOT } C = 0\) - \(0 \text{ NOR } 0 = 1\) 5. **Row 5 (1, 0, 0)**: - \(A \text{ AND } B = 0\) - \(\text{NOT } C = 1\) - \(0 \text{ NOR } 1 = 0\) 6. **Row 6 (1, 0, 1)**: - \(A \text{ AND } B = 0\) - \(\text{NOT } C = 0\) - \(0 \text{ NOR } 0 = 1\) 7. **Row 7 (1, 1, 0)**: - \(A \text{ AND } B = 1\) - \(\text{NOT } C = 1\) - \(1 \text{ NOR } 1 = 0\) 8. **Row 8 (1, 1, 1)**: - \(A \text{ AND } B = 1\) - \(\text{NOT } C = 0\) - \(1 \text{ NOR } 0 = 0\)
Marking scheme
### Part (a) Marking Scheme [Max 4 marks]: - **1 mark** for: `T AND NOT H` (or equivalent notation, e.g. \(T \cdot \overline{H}\)) - **1 mark** for: `M AND NOT T` (or equivalent notation, e.g. \(M \cdot \overline{T}\)) - **1 mark** for: combining both parts with an `OR` gate (or \(+\)) - **1 mark** for: complete correct equation structured as `F = ...`
*Note: Accept standard boolean algebraic notation.* *Reject: Expressions missing the "F =" part for the final mark.*
### Part (b) Marking Scheme [Max 4 marks]: - **4 marks** for 8 correct outputs in column X. - **3 marks** for 6 or 7 correct outputs in column X. - **2 marks** for 4 or 5 correct outputs in column X. - **1 mark** for 2 or 3 correct outputs in column X. - **0 marks** for 0 or 1 correct outputs in column X.
*Correct sequence for Column X (from top to bottom):* **0, 1, 0, 1, 0, 1, 0, 0**
Question 8 · structured
7 marks
A bicycle rental shop uses a database table, **BIKES**, to store details about its fleet.
**(a)** State the field that would be the most appropriate primary key for this table, and give a reason for your choice. [2]
**(b)** State the most appropriate data types for the **DailyRate** and **Available** fields. [2]
**(c)** Write an SQL query to display the **BikeID** and **DailyRate** of all bikes that have a **FrameSize** of 20 or greater, and are currently **Available**. The results must be sorted in descending order of **DailyRate**. [3]
Show answer & marking schemeHide answer & marking scheme
Worked solution
Part (a): - The primary key must be unique for each record. BikeID is the only field where each bike has a unique, non-repeating identifier (e.g., BK01, BK02, etc.). Other fields like Model, FrameSize, and DailyRate contain duplicate values.
Part (b): - DailyRate stores decimal values representing monetary cost, so Currency, Real, Decimal, or Float is the most suitable data type. - Available stores binary choice values (True/False), making Boolean or Yes/No the correct choice.
Part (c): - The SELECT clause must include only the requested fields: `BikeID, DailyRate`. - The FROM clause specifies the table name: `BIKES`. - The WHERE clause filters based on two criteria combined with AND: `FrameSize >= 20` and `Available = True` (or simply `Available = Yes` / `Available` depending on representation). - The ORDER BY clause sorts the output in descending order: `ORDER BY DailyRate DESC`.
Marking scheme
Part (a) [Max 2 marks]: - 1 mark: Identifies 'BikeID' as the primary key. - 1 mark: Explains that it contains unique data/values (or uniquely identifies each record/bike).
Part (b) [Max 2 marks]: - 1 mark: DailyRate: Currency / Real / Float / Decimal / Single (Do NOT accept Integer / Text). - 1 mark: Available: Boolean / Yes/No / Logical (Do NOT accept Text / String).
Part (c) [Max 3 marks]: - 1 mark: Correct SELECT and FROM statements: `SELECT BikeID, DailyRate FROM BIKES` (fields must be separated by a comma, correct spelling). - 1 mark: Correct WHERE clauses with correct logical operator: `WHERE FrameSize >= 20 AND Available = True` (accept `Available = Yes`, `Available = 1`, or simply `Available`). - 1 mark: Correct ORDER BY statement: `ORDER BY DailyRate DESC` (accept `DESCENDING`).
Question 9 · written
8 marks
A programmer is writing a system that requires the calculation of tax for various items.
(a) Explain the difference between a function and a procedure. [2]
(b) Write a pseudocode definition for a function called CalculateTax. The function must: - take two parameters: price (REAL) and taxRate (REAL) - if the price is greater than 100.00, calculate the tax as price * (taxRate / 100.0) - otherwise, the tax is 0.0 - return the calculated tax value. [4]
(c) Write a pseudocode statement that calls the function CalculateTax with a price of 150.00 and a tax rate of 12.5, and assigns the returned value to a variable called itemTax. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
(a) A function is a subprogram that is called as part of an expression and always returns a value to the calling environment. A procedure is a subprogram that performs a specific task but does not return a value; it is called as a standalone statement.
(b) Model pseudocode implementation: FUNCTION CalculateTax(price : REAL, taxRate : REAL) RETURNS REAL DECLARE tax : REAL IF price > 100.00 THEN tax <- price * (taxRate / 100.0) ELSE tax <- 0.0 ENDIF RETURN tax ENDFUNCTION
Part (a): [Max 2 marks] - 1 mark: For stating that a function returns a value (to the calling statement). - 1 mark: For stating that a procedure does not return a value / is a standalone execution block.
Part (b): [Max 4 marks] - 1 mark: Correct FUNCTION header defining name CalculateTax, receiving two parameters (price and taxRate) with REAL data types, and specifying a REAL return type. - 1 mark: Correct conditional statement checking if price is greater than 100 (or 100.00). - 1 mark: Correct calculations of tax for both paths (price * taxRate / 100.0 and 0.0). - 1 mark: Correct use of RETURN statement to return the final calculated value, and matching ENDFUNCTION.
Part (c): [Max 2 marks] - 1 mark: Correct function call passing arguments 150.00 (or 150) and 12.5 to CalculateTax. - 1 mark: Correct use of the assignment operator (<-) to store the returned result in the variable itemTax.
Question 10 · Trace Table
7 marks
An algorithm is represented by the following pseudocode:
X ← 45 Y ← 12 Count ← 0 WHILE X >= Y DO IF X MOD 2 = 0 THEN X ← X - Y ELSE X ← X - 3 ENDIF Count ← Count + 1 ENDWHILE OUTPUT X, Count
Complete the trace table for this algorithm. Note that you should only record changes to the variables.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let us trace the execution step-by-step: 1. Initially, X is assigned 45, Y is assigned 12, and Count is assigned 0. 2. The loop condition is X >= Y (45 >= 12), which is True. Since 45 MOD 2 is not 0, the ELSE block runs: X becomes X - 3 = 42. Count becomes 1. 3. The loop condition is X >= Y (42 >= 12), which is True. Since 42 MOD 2 is 0, the IF block runs: X becomes X - Y = 42 - 12 = 30. Count becomes 2. 4. The loop condition is X >= Y (30 >= 12), which is True. Since 30 MOD 2 is 0, X becomes X - Y = 30 - 12 = 18. Count becomes 3. 5. The loop condition is X >= Y (18 >= 12), which is True. Since 18 MOD 2 is 0, X becomes X - Y = 18 - 12 = 6. Count becomes 4. 6. The loop condition is X >= Y (6 >= 12), which is False. The loop terminates. 7. The final output statement prints the values of X and Count: 6, 4.
Marking scheme
- 1 mark for initial values: X = 45, Y = 12, Count = 0 - 1 mark for first iteration updates: X = 42, Count = 1 - 1 mark for second iteration updates: X = 30, Count = 2 - 1 mark for third iteration updates: X = 18, Count = 3 - 1 mark for fourth iteration updates: X = 6, Count = 4 - 1 mark for correctly stopping the loop when X = 6 - 1 mark for the correct final output (6, 4) in the Output column
Question 11 · practical
15 marks
A 2D array named EventScores contains the scores for 4 school sports teams across 5 events. The teams are represented by rows 1 to 4, as follows: - Row 1: "Red" - Row 2: "Blue" - Row 3: "Green" - Row 4: "Yellow"
The events are represented by columns 1 to 5. The array is declared as: DECLARE EventScores : ARRAY[1:4, 1:5] OF INTEGER It is already populated with integer scores.
Write a pseudocode algorithm that will: 1. Declare and initialize a 1D array named TeamTotals to hold the total score for each of the 4 teams. 2. Calculate the total score for each team and store it in TeamTotals. 3. Output the name of each team alongside its total score. 4. Determine and output the name of the winning team (the team with the highest total score). You may assume there are no ties for the winning position. 5. Find and output the name of the team and the event number (column index) that achieved the highest single event score. If there is a tie for the highest single score, output the details of the first one encountered.
Show answer & marking schemeHide answer & marking scheme
FOR Row ← 1 TO 4 FOR Col ← 1 TO 5 TeamTotals[Row] ← TeamTotals[Row] + EventScores[Row, Col] IF EventScores[Row, Col] > MaxSingleScore THEN MaxSingleScore ← EventScores[Row, Col] MaxSingleRow ← Row MaxSingleCol ← Col ENDIF NEXT Col NEXT Row
MaxTotal ← -1 WinningIndex ← 1
FOR Row ← 1 TO 4 OUTPUT TeamNames[Row] , ": " , TeamTotals[Row] IF TeamTotals[Row] > MaxTotal THEN MaxTotal ← TeamTotals[Row] WinningIndex ← Row ENDIF NEXT Row
OUTPUT "Winner: " , TeamNames[WinningIndex] OUTPUT "Highest single score: " , MaxSingleScore , " by " , TeamNames[MaxSingleRow] , " in event " , MaxSingleCol
Marking scheme
1 Mark: Declaring TeamTotals as an array of 4 integers. 1 Mark: Initializing TeamTotals to 0 using a loop. 1 Mark: Correctly mapping team index values to their name equivalents (either using a 1D array TeamNames or conditional logic). 1 Mark: Using nested FOR loops with appropriate ranges (outer loop 1 to 4, inner loop 1 to 5). 2 Marks: Correct cumulative addition of scores into TeamTotals using EventScores[Row, Col]. 2 Marks: Correct conditional tracking of the maximum single score (MaxSingleScore) and storing its coordinates (MaxSingleRow, MaxSingleCol). 2 Marks: Identifying the winning team (looping through TeamTotals and tracking the highest value index). 2 Marks: Outputting all team names and their respective total scores. 1 Mark: Outputting the name of the winning team. 2 Marks: Outputting the highest single event score details (team name and column index).
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.