An original Thinka practice paper modelled on the structure and difficulty of the Nov 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 must not be used.
31 Question · 71 marks
Question 1 · short_answer
1.5 marks
Convert the 8-bit binary number \(11011011\) into hexadecimal. Show your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Split the 8-bit binary number into two 4-bit nibbles: \(1101\) and \(1011\). 2. Convert the first nibble: \(1101_{2} = 13_{10} = D_{16}\). 3. Convert the second nibble: \(1011_{2} = 11_{10} = B_{16}\). 4. Combine the two hexadecimal digits to get: \(DB\).
Marking scheme
- 1 mark for splitting the binary number correctly and converting one nibble correctly (e.g., showing \(1101 \rightarrow D\) or \(1011 \rightarrow B\)). - 0.5 marks for the correct final answer: \(DB\).
Question 2 · short_answer
1.5 marks
Define 'half-duplex data transmission' and provide one everyday example of its use.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Half-duplex transmission allows data to travel in both directions along a channel, but only one direction at a time (non-simultaneously). A common example is a walkie-talkie, where one person talks while the other listens.
Marking scheme
- 1 mark for definition: data travels in both directions but only one way at a time / not simultaneously. - 0.5 marks for a valid example (e.g., walkie-talkie, CB radio).
Question 3 · short_answer
1.5 marks
Explain the role of the Program Counter (PC) in the Von Neumann architecture during the fetch-decode-execute cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The Program Counter (PC) stores the memory address of the next instruction that needs to be fetched and executed. As soon as the current instruction is fetched, the PC is incremented by 1 so that it points to the subsequent instruction in memory.
Marking scheme
- 1 mark for stating that it holds/stores the address of the next instruction to be fetched. - 0.5 marks for stating that it is incremented (by 1) after the fetch step.
Question 4 · short_answer
1.5 marks
Describe how a checksum is used to verify that data has not been corrupted during transmission.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Prior to transmission, a calculation is performed on the block of data to generate a checksum value. 2. This checksum value is transmitted along with the data block. 3. The receiving device performs the same calculation on the incoming data and compares its result with the transmitted checksum. If they do not match, an error is detected and a retransmission is requested.
Marking scheme
- 1 mark for explaining that the checksum is calculated prior to transmission, sent with the data, and recalculated by the receiver. - 0.5 marks for explaining that the two values are compared, and a mismatch indicates a corruption/error.
Question 5 · short_answer
1.5 marks
Identify one key difference between phishing and pharming.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Phishing involves sending fraudulent emails containing links to fake websites designed to steal credentials; the user must actively click the link. Pharming is a DNS spoofing or malicious software attack that redirects a user to a fake website automatically, even if they typed the correct web address.
Marking scheme
- 1 mark for clearly stating how pharming automatically redirects users (via DNS manipulation or host file malware) without requiring them to click a fake link. - 0.5 marks for highlighting that phishing requires user interaction (clicking a link in an email/message).
Question 6 · short_answer
1.5 marks
An automated greenhouse system uses a temperature sensor and a microprocessor. Explain why an Analogue-to-Digital Converter (ADC) is required in this system.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The physical environment produces continuous, analogue data (e.g., varying voltage from the temperature sensor). However, computer microprocessors can only understand and process discrete, digital data (binary 1s and 0s). Therefore, an ADC is essential to convert the analogue sensor signals into a digital format that the microprocessor can process.
Marking scheme
- 1 mark for stating that the sensor outputs analogue/continuous signals while the microprocessor can only understand digital/discrete binary data. - 0.5 marks for stating that the ADC converts these physical/analogue inputs into digital values for processing.
Question 7 · short_answer
1.5 marks
State two reasons why a Solid State Drive (SSD) is more suitable than a Hard Disk Drive (HDD) for use in a portable laptop.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. SSDs have no moving parts, making them far more durable and resistant to physical shocks and drops, which are common with portable laptops. 2. SSDs have lower power consumption, which helps to extend the laptop's battery life. (Other valid reasons include faster read/write speeds, lighter weight, and quieter operation).
Marking scheme
- 1 mark for identifying one major reason with clear explanation (e.g., no moving parts means more physical durability when dropped). - 0.5 marks for identifying a second valid reason (e.g., lower power consumption/longer battery life, faster boot/load times, lighter weight).
Question 8 · short_answer
1.5 marks
Explain why the computer industry has largely transitioned from using ASCII to using Unicode for character representation.
Show answer & marking schemeHide answer & marking scheme
Worked solution
ASCII uses only 7 or 8 bits, which limits its character set to 128 or 256 characters. This is only sufficient for English and basic Western European characters. Unicode uses up to 32 bits per character, enabling it to represent over a million unique characters. This allows it to support global languages (like Chinese, Arabic, and Japanese) as well as modern symbols and emojis.
Marking scheme
- 1 mark for explaining the limitation of ASCII (e.g., 7/8 bits limit it to 128/256 characters, only suitable for English/Western languages). - 0.5 marks for explaining the advantage of Unicode (e.g., uses more bits to represent a vastly larger character set including worldwide languages).
Question 9 · short_answer
1.5 marks
Convert the 8-bit binary number 11011011 into hexadecimal. Show your working.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To convert the 8-bit binary number 11011011 to hexadecimal, split it into two 4-bit nibbles: 1) Left nibble: 1101. In decimal, this is \(8 + 4 + 0 + 1 = 13\). In hexadecimal, 13 is represented by the letter D. 2) Right nibble: 1011. In decimal, this is \(8 + 0 + 2 + 1 = 11\). In hexadecimal, 11 is represented by the letter B. Combining the two hexadecimal characters yields DB.
Marking scheme
1 mark for correct working showing the separation into nibbles (1101 and 1011) and identifying their values as 13 (D) and 11 (B). 0.5 marks for the correct final answer: DB.
Question 10 · short_answer
1.5 marks
Identify one reason why serial data transmission is more suited for long-distance communication than parallel data transmission, and explain your answer.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Serial data transmission uses a single wire/channel to send data bits one after another. In parallel data transmission, multiple bits are sent simultaneously over multiple wires. Over long distances, the signals on parallel wires can arrive at slightly different times (known as data skewing), making the data unreadable. Serial transmission does not suffer from data skewing and requires less physical cabling, making it significantly cheaper to install over long distances.
Marking scheme
0.5 marks for identifying a valid reason (e.g., prevents data skewing / crosstalk, or reduced cost of infrastructure). 1 mark for the explanation of how parallel transmission fails over distance (skewing due to arriving at different times) or why serial is more viable (requires only a single physical channel/wire).
Question 11 · short_answer
1.5 marks
Describe the specific role of the Program Counter (PC) during the Fetch stage of the Fetch-Decode-Execute cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
At the start of the Fetch stage, the Program Counter (PC) holds the memory address of the next instruction to be fetched and executed. This address is copied from the PC to the Memory Address Register (MAR) via the address bus. Once the address is copied, the Program Counter is incremented by 1 so that it points to the address of the next instruction in sequence.
Marking scheme
0.5 marks for stating that the PC holds the address of the next instruction to be fetched. 1 mark for describing either that this address is copied to the MAR or that the PC is incremented immediately after.
Question 12 · short_answer
1.5 marks
Explain the key difference in how a user is directed to a fraudulent website in phishing compared to pharming.
Show answer & marking schemeHide answer & marking scheme
Worked solution
In phishing, the attacker relies on social engineering, sending an email or message containing a link that the user must actively click to be taken to the fake website. In pharming, malicious software or code is installed on the user's computer or a DNS server is compromised; this automatically redirects the user to the fraudulent website even if they type the correct URL address into their browser.
Marking scheme
0.5 marks for stating that phishing relies on the user clicking a link (social engineering) in a message/email. 1 mark for explaining that pharming automatically redirects traffic (by modifying host files/poisoning DNS) without direct link-clicking actions.
Question 13 · short_answer
1.5 marks
A transmission system uses even parity. The data byte 1010110_ is sent, where the last position (represented by the underscore) is the parity bit. State the value of the parity bit and explain your choice.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Even parity means that the total number of 1s in the transmitted byte must be an even number. Looking at the data part: 1, 0, 1, 0, 1, 1, 0. There are exactly four 1s present. Since 4 is already an even number, we do not need to add another 1. Therefore, the parity bit must be set to 0 to keep the total count of 1s even (at 4).
Marking scheme
0.5 marks for identifying the correct parity bit as 0. 1 mark for explaining that even parity requires an even total of 1s, and since there are already four 1s (which is even), the parity bit must be 0.
Question 14 · short_answer
1.5 marks
Write down the Boolean expression for the logic gate circuit that takes two inputs, A and B, passes each input through its own NOT gate, and then feeds both resulting outputs into a single OR gate.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Passing input A through a NOT gate yields NOT A. Passing input B through a NOT gate yields NOT B. Combining these two intermediate outputs using an OR gate results in the overall Boolean expression: (NOT A) OR (NOT B). Alternatively, this can be written as \(\overline{A} + \overline{B}\).
Marking scheme
0.5 marks for showing the correct independent negation of both inputs (NOT A and NOT B, or equivalents). 1 mark for correctly joining them with the OR operator.
Question 15 · Structured
2.5 marks
Explain why hexadecimal numbers are used by computer scientists instead of binary, and convert the binary byte 11011011 to its hexadecimal equivalent.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Hexadecimal is used because it represents 4 bits of binary with 1 character. This makes large binary numbers shorter, easier to read, write, and debug, reducing the risk of errors by programmers. 2. To convert 11011011 to hexadecimal: - Split into two 4-bit nibbles: 1101 and 1011. - 1101 in denary is 13, which is 'D' in hexadecimal. - 1011 in denary is 11, which is 'B' in hexadecimal. - Combine them to get DB.
Marking scheme
1.5 marks for reasons (0.5 marks per valid reason, max 1.5): - Easier/quicker for humans to read/write. - Less chance of making transcription errors. - Easier to debug/identify patterns. - Shorter/more compact representation of large binary values. 1 mark for conversion (0.5 marks for each nibble converted correctly): - 1101 = D (0.5 marks) - 1011 = B (0.5 marks) Award full marks for final answer DB even if working is not shown.
Question 16 · Structured
2.5 marks
Describe one advantage and one disadvantage of serial data transmission compared to parallel data transmission, and state one typical application of serial data transmission.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Serial data transmission sends data one bit at a time down a single wire, whereas parallel sends multiple bits simultaneously across multiple wires. - Advantage: Since only one wire is used, there is no risk of bits arriving out of sync (skewing). It is also cheaper to manufacture and less prone to interference (crosstalk) over long distances. - Disadvantage: It has a slower rate of transfer than parallel over very short distances, as it sends data sequentially. - Application: A typical modern application is USB, or connecting network cables (Ethernet).
Marking scheme
- 1 mark for any valid advantage (e.g. less risk of skewing/crosstalk, cheaper cabling over distance). - 1 mark for any valid disadvantage (e.g. slower rate of transmission over short distances). - 0.5 marks for a valid application (e.g. USB, SATA, internet transmission, connecting mice/keyboards).
Question 17 · Structured
2.5 marks
Describe the purpose of the Program Counter (PC) register within the Von Neumann architecture, and explain how its value changes during the fetch stage of the fetch-decode-execute cycle.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The Program Counter (PC) is a dedicated register in the CPU. Its function is to keep track of the execution sequence by holding the memory address of the next instruction to be executed. During the fetch stage of the cycle, the address stored in the PC is first copied to the Memory Address Register (MAR). Immediately after, or during the memory read, the value in the PC is incremented by 1 so that it is already pointing to the next instruction in sequence.
Marking scheme
- 1 mark: Correctly states that the PC holds the address of the next instruction to be fetched/executed. - 0.5 marks: States that the address in the PC is copied/passed to the Memory Address Register (MAR). - 1 mark: States that the PC is incremented (by 1) to point to the next instruction in sequence.
Question 18 · Structured
2.5 marks
State what is meant by an interrupt, and describe two common scenarios that would trigger an interrupt in a computer system.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An interrupt is a signal sent from a device or program to the CPU, requesting its attention. When the CPU receives an interrupt, it halts execution of the current program to run an Interrupt Service Routine (ISR). Common scenarios include: 1. Hardware faults, such as a printer running out of paper or ink, or a low-battery signal. 2. Input/Output actions, such as a user pressing a key on the keyboard, moving the mouse, or data arriving at a network card. 3. Software errors, such as a division-by-zero error or an attempt to access restricted memory.
Marking scheme
- 0.5 marks: Correct definition of an interrupt (e.g., a signal sent to the CPU to request processing time / suspend the current process). - 2 marks (1 mark per scenario, up to 2): Any two valid, distinct scenarios described, such as hardware interrupt (printer out of paper, power failure), I/O interrupt (keyboard press, mouse click), or software/timer interrupt.
Question 19 · Structured
2.5 marks
Contrast symmetric and asymmetric encryption by describing how keys are used in both methods, and state which method is more secure for transmitting data over the public internet.
Show answer & marking schemeHide answer & marking scheme
Worked solution
In symmetric encryption, the sender and receiver share a single secret key. The same key is used to encrypt the plaintext and to decrypt the ciphertext. This poses a security risk because the key must somehow be shared between parties. In asymmetric encryption, a mathematically matched key pair is used: a public key (which is freely distributable) is used to encrypt the data, and a private key (kept secret by the owner) is used to decrypt it. Asymmetric encryption is more secure for transmitting data over the public internet because the private key never needs to be shared or transmitted.
Marking scheme
- 1 mark: Explains that symmetric encryption uses the same single key for both encryption and decryption. - 1 mark: Explains that asymmetric encryption uses a pair of keys (a public key for encryption and a private key for decryption). - 0.5 marks: Identifies asymmetric encryption as the more secure method for public internet transmission (as no private key is transmitted).
Question 20 · Structured
2.5 marks
Describe the logical operation of a two-input NAND gate. Your description should state how the output relates to the combination of the two inputs, and write down its truth table outputs in order of standard binary input combinations (00, 01, 10, 11).
Show answer & marking schemeHide answer & marking scheme
Worked solution
A NAND (NOT AND) gate is the inverse of an AND gate. It outputs a logical 0 (false) only when all of its inputs are 1 (true). If any input is 0 (or if both are 0), the output is 1 (true). Standard truth table outputs for inputs (00, 01, 10, 11): - Input (0,0) -> Output 1 - Input (0,1) -> Output 1 - Input (1,0) -> Output 1 - Input (1,1) -> Output 0
Marking scheme
- 1 mark: States that the output is 0 (or FALSE) only if both inputs are 1 (or TRUE). - 0.5 marks: States that for all other input combinations, the output is 1 (or TRUE). - 1 mark: Correctly lists the outputs in the exact order: 1, 1, 1, 0 (award 0.25 marks per correct output value).
Question 21 · Structured
2.5 marks
Robots are widely used in manufacturing. Identify two defining characteristics of a robot, and explain how a sensor is used in a robotic arm assembly system.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Robots have three primary defining characteristics: 1. A mechanical structure or frame. 2. Electrical components (such as sensors, actuators, and power sources). 3. Programmability (controlled by a microprocessor or computer program). In a robotic arm assembly system, sensors (such as optical, distance, or pressure sensors) are critical. The sensor measures real-world analogue physical variables (e.g. proximity of an object) and converts this data to digital signals using an ADC. This signal is sent to the processor/microprocessor, which processes the input and determines the next action (such as adjusting the grip pressure or stopping movement if an obstruction is detected).
Marking scheme
- 1 mark (0.5 marks per characteristic, max 2): States any two defining characteristics of a robot (mechanical structure, electrical components/power source, programmability). - 1.5 marks for the explanation of sensor usage (0.5 marks per point): - Sensor measures physical analogue data from the environment. - Sensor converts physical data to digital signals (using an ADC) and sends it to the microprocessor. - The microprocessor uses this data to make a decision (e.g., control actuators to stop/adjust movement).
Question 22 · Structured
2.5 marks
Explain what a cookie is, and describe how a web browser uses a cookie to enhance a user's experience on an e-commerce website.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A cookie is a small text file downloaded onto a user's computer by a web browser when they visit a website. It is sent back to the website server on subsequent visits. On an e-commerce website, cookies enhance the user experience by: 1. Storing session state (e.g., keeping the user logged into their account so they don't have to enter credentials on every page). 2. Remembering shopping cart items (so items remain in the cart if the page is refreshed or closed). 3. Personalization (storing user preferences, currency, language, or displaying targeted product recommendations).
Marking scheme
- 1 mark: Defines a cookie as a small text file saved/stored on the user's hard drive/computer by the web browser (sent by a web server). - 1.5 marks: Describes how it enhances the e-commerce experience (0.5 marks per valid point, up to 1.5): - Remembers login details/keeps user logged in. - Remembers items stored in the virtual shopping cart. - Remembers user preferences (e.g., language, currency choice). - Allows personalized recommendations based on previous browsing history.
Question 23 · Structured descriptions and explanations
2.5 marks
Explain how a checksum is used to detect errors during data transmission.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. Prior to transmission, the sender applies a mathematical algorithm on the data block to generate a numerical checksum value. 2. The checksum is appended to the data packet and transmitted. 3. Upon receipt, the destination system runs the exact same algorithm on the received data. 4. The destination compares its recalculated checksum with the transmitted checksum. If they differ, an error is identified, and a request to re-send the packet is issued.
Marking scheme
1 mark: Description of the sender calculating the checksum using an algorithm and sending it with the data. 1 mark: Description of the receiver recalculating the checksum and comparing it to the received value. 0.5 marks: Identifying that a mismatch indicates corruption and triggers a request for retransmission.
Question 24 · Structured descriptions and explanations
2.5 marks
Explain the role of the Program Counter (PC) register during the Fetch-Decode-Execute (FDE) cycle of the Von Neumann architecture.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The Program Counter (PC) is a CPU register vital for keeping track of instruction sequences. 1. It stores the address of the next instruction in memory. 2. At the beginning of the fetch phase, this address is sent to the Memory Address Register (MAR) via the address bus. 3. Instantly after copying, the PC is incremented by 1 (PC <- PC + 1) to point to the next instruction in memory, allowing sequential execution.
Marking scheme
1 mark: Stating that the PC stores the memory address of the next instruction to be fetched/executed. 1 mark: Explaining that this address is copied to the Memory Address Register (MAR) during the fetch stage. 0.5 marks: Explaining that the PC is incremented by 1 immediately after to prepare for the subsequent cycle.
Question 25 · Structured descriptions and explanations
2.5 marks
Describe how Solid State Drives (SSDs) utilize NAND flash memory to store and retain binary data without a physical power supply.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Solid State Drives contain semiconductor flash memory chips consisting of millions of NAND flash cells. Inside these cells are floating gate transistors. By applying a control voltage, electrons are forced across an insulating layer into the floating gate (trapping them) or pulled out. Trapped electrons block electric current flow, registering as a binary 0, while a clear gate permits current, registering as binary 1. This state persists even when power is disconnected, providing non-volatile storage.
Marking scheme
1 mark: Explaining the use of floating gate transistors (or flash memory cells) where electrical charge/electrons are trapped or released. 1 mark: Describing how the presence or absence of trapped electrons affects conductivity to represent binary states (1 and 0). 0.5 marks: Stating that the system is non-volatile, meaning trapped charges remain stable when the power is turned off.
Question 26 · Structured descriptions and explanations
2.5 marks
Explain two physical and electrical limitations that restrict parallel data transmission to short-distance applications.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Parallel data transmission uses multiple physical wires to send several bits of data simultaneously. 1. Over long distances, subtle variations in electrical resistance and capacitance of each wire cause 'data skewing', where bits arrive at slightly different times, corrupting the alignment. 2. Placing multiple signal-carrying wires close together for long distances creates 'crosstalk' (electromagnetic interference), causing bits to jump or distort. 3. Parallel cables are thicker, heavier, and far more expensive to deploy over extended distances compared to a single serial wire.
Marking scheme
1 mark: Clearly explaining 'data skewing' (bits arriving out of synchronization/alignment over distance). 1 mark: Clearly explaining 'crosstalk' (electromagnetic interference/corruption between adjacent wires). 0.5 marks: Mentioning the physical cost, size, or difficulty of manufacturing and installing multi-core cables for long runs.
Question 27 · Matching
3 marks
Match each data transmission method to its correct description. Transmission Methods: 1. Simplex, 2. Half-duplex, 3. Full-duplex. Descriptions: A. Data can be transmitted in both directions simultaneously. B. Data can be transmitted in both directions, but not at the same time. C. Data can only be transmitted in one direction.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1 matches C because Simplex allows transmission in only one direction. 2 matches B because Half-duplex allows two-way transmission but not simultaneously. 3 matches A because Full-duplex allows simultaneous two-way transmission.
Marking scheme
Award 1 mark for each correct match: 1-C (1 mark), 2-B (1 mark), 3-A (1 mark). No half marks are awarded.
Question 28 · Matching
3 marks
Match each utility software to its correct purpose. Utility Software: 1. Disk defragmenter, 2. Backup software, 3. File compression software. Purposes: A. Reduces the size of files to save storage space and transmission time. B. Reorganizes files on a hard drive so that parts of files are stored in contiguous sectors. C. Creates a copy of data/files to allow restoration in case of data loss.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1 matches B because a disk defragmenter reorganizes fragmented files on a hard drive into contiguous sectors to improve access speeds. 2 matches C because backup software creates copies of files to prevent data loss. 3 matches A because file compression reduces file size using algorithms.
Marking scheme
Award 1 mark for each correct match: 1-B (1 mark), 2-C (1 mark), 3-A (1 mark). No half marks are awarded.
Question 29 · Matching
3 marks
Match each CPU register to its correct description. Registers: 1. Program Counter (PC), 2. Memory Address Register (MAR), 3. Accumulator (ACC). Descriptions: A. Stores the address of the next instruction to be fetched. B. Stores the address of the memory location currently being read from or written to. C. Holds the results of calculations and logical operations carried out by the ALU.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1 matches A because the Program Counter holds the memory address of the next instruction to be executed. 2 matches B because the Memory Address Register holds the address of the current memory location being accessed. 3 matches C because the Accumulator temporarily stores the output of the Arithmetic Logic Unit.
Marking scheme
Award 1 mark for each correct match: 1-A (1 mark), 2-B (1 mark), 3-C (1 mark). No half marks are awarded.
Question 30 · Trace statement completion
6 marks
The CPU of a computer has several registers used during the fetch-decode-execute cycle. Initially, the registers contain these values: Program Counter (PC): 0A2, Accumulator (ACC): 15. The memory location at address 0A2 contains the instruction 'ADD 0F0' (which instructs the CPU to add the contents of memory address 0F0 to the Accumulator). The memory location at address 0F0 contains the denary value 30. Complete the following trace statements to describe the fetch-decode-execute cycle for this instruction. 1. The address 0A2 is copied from the Program Counter (PC) to the [ 1 ]. 2. The Program Counter (PC) is incremented to [ 2 ]. 3. The instruction at address 0A2 is loaded from memory into the [ 3 ]. 4. The instruction is copied from the register in statement 3 to the [ 4 ] for decoding. 5. During the execution of the instruction, the value 30 at address 0F0 is fetched into the [ 5 ]. 6. The value is added to the Accumulator (ACC), leaving the final value of [ 6 ] in the ACC.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Step 1: The FDE cycle always begins with the address in the PC (0A2) being copied to the Memory Address Register (MAR). Step 2: The PC is then incremented to point to the next sequential address, which is 0A3. Step 3: The actual instruction ('ADD 0F0') stored at memory address 0A2 is read into the Memory Data Register (MDR). Step 4: To allow decoding without losing the instruction during subsequent memory operations, it is copied into the Current Instruction Register (CIR). Step 5: During execution, the operand address (0F0) is sent to the MAR, and the data stored at that address (30) is fetched into the MDR. Step 6: The ALU adds the value in the MDR (30) to the current ACC value (15), which results in 45 being stored back in the ACC.
Marking scheme
1 mark for each correct trace statement completion: [1] Memory Address Register (accept MAR), [2] 0A3 (accept A3), [3] Memory Data Register (accept MDR), [4] Current Instruction Register (accept CIR), [5] Memory Data Register (accept MDR), [6] 45.
Question 31 · structured
5 marks
An automated warehouse uses several automated guided vehicles (AGVs) controlled by a central computer system.
(a) Identify the most appropriate transmission method (serial or parallel) to send control instructions from the central computer to an AGV located 100 metres away on the warehouse floor. Justify your choice. [3]
(b) A technician at a diagnostic workstation needs to run tests on an AGV. The diagnostic data needs to be sent from the AGV to the workstation, and control commands must be sent from the workstation to the AGV simultaneously.
Identify the transmission direction required for this scenario and describe how it operates. [2]
Show answer & marking schemeHide answer & marking scheme
Worked solution
Part (a): - The correct transmission method is serial. (1 mark) - Justification: Over a long distance like 100 metres, parallel transmission is highly susceptible to data skewing, where bits sent down multiple wires arrive out of synchronization. Serial transmission prevents this by sending one bit at a time down a single channel. (1 mark) - Serial cabling is also significantly cheaper and easier to install over long distances due to using fewer physical wires. (1 mark)
Part (b): - The correct transmission direction is full-duplex. (1 mark) - Description: This allows data to travel in both directions at the same time (simultaneously), allowing diagnostic data and control commands to be processed without waiting for the channel to become clear. (1 mark)
Marking scheme
Part (a) [Max 3 marks]: - 1 mark for identifying 'Serial'. - 1 mark for explaining that it does not suffer from data skewing / crosstalk over long distances. - 1 mark for explaining it is cheaper / simpler to install / requires fewer wires over a long distance.
Part (b) [Max 2 marks]: - 1 mark for identifying 'Full-duplex'. - 1 mark for describing that data can be transmitted in both directions simultaneously / at the same time.
Paper 2 (Algorithms, Programming and Logic)
Answer all questions. Calculators must not be used.
A developer is designing a database table named `tblBooks` to store library book records. The fields are:
- `BookID` (e.g., 'BK-9921') - `Title` (e.g., 'Computer Science Basics') - `PublicationYear` (e.g., 2023) - `InStock` (stores whether a book is currently available or not)
Identify: 1. The field that must be selected as the Primary Key. 2. The most appropriate data type for the field `InStock`.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. `BookID` is the most suitable primary key because it is unique for each book record, unlike title or publication year. 2. `InStock` stores only two states (available or not available), so `BOOLEAN` (or logical/Yes-No) is the most appropriate data type.
Marking scheme
1 mark for identifying `BookID` as the primary key. 1 mark for identifying `BOOLEAN` (accept logical/Boolean/Yes/No) as the data type for `InStock`.
Match each of the following SQL clauses to its correct purpose in a query:
1. `SELECT` 2. `WHERE`
Choose from the following purposes: - A) Specifies the table from which to retrieve data. - B) Specifies the fields to be displayed in the query result. - C) Filters the records based on a specific condition.
Your answer should pair the clause number with its correct purpose letter (e.g., 1-A, 2-B).
Show answer & marking schemeHide answer & marking scheme
Worked solution
- `SELECT` is used to specify the fields to be projected or displayed in the final query result (B). - `WHERE` is used to specify criteria to filter the database records (C).
Marking scheme
1 mark for matching 1 to B. 1 mark for matching 2 to C.
Identify: 1. The role of the `CustomerID` field in the `tblOrders` table. 2. The type of relationship (e.g., One-to-One, One-to-Many, Many-to-Many) established between `tblCustomers` and `tblOrders` using this field.
Show answer & marking schemeHide answer & marking scheme
Worked solution
1. `CustomerID` in `tblOrders` links back to the primary key of `tblCustomers`, making it a foreign key. 2. One customer can place multiple orders, but each order belongs to only one customer, representing a One-to-Many relationship.
Marking scheme
1 mark for identifying `CustomerID` in `tblOrders` as a Foreign Key. 1 mark for identifying the relationship as One-to-Many.
Write a single SQL query to display the `Title` and `Price` fields for all books in the table `tblBooks` that have a `Price` of less than 15.00.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To retrieve specific fields, use `SELECT Title, Price`. To specify the table, use `FROM tblBooks`. To filter based on the price condition, use the conditional statement `WHERE Price < 15.00`.
Marking scheme
1 mark for selecting the correct fields and table: `SELECT Title, Price FROM tblBooks` 1 mark for the correct condition: `WHERE Price < 15.00` (accept with or without trailing semicolon; accept case-insensitive keywords).
A student database table named `tblStudents` contains fields: `StudentID`, `Name`, `Grade`, and `Score`.
Match the following query requirements to the correct SQL code segment:
Requirements: 1. Sort the records by `Score` from highest to lowest. 2. Select records where the `Score` is between 80 and 90 (inclusive).
Code Segments: - A) `WHERE Score BETWEEN 80 AND 90` - B) `WHERE Score >= 80 OR Score <= 90` - C) `ORDER BY Score DESC` - D) `ORDER BY Score ASC`
Show answer & marking schemeHide answer & marking scheme
Worked solution
- To sort from highest to lowest (descending order), we use the `ORDER BY` clause with the `DESC` keyword (C). - To filter scores inclusive of 80 and 90, we use `WHERE Score BETWEEN 80 AND 90` (A). Option B is incorrect because `OR` would match all scores.
Marking scheme
1 mark for matching Requirement 1 with C. 1 mark for matching Requirement 2 with A.
Question 6 · short_answer
2.5 marks
An online system requires users to enter a new password. Explain how validation and verification are used in this context to ensure the password is both valid and entered correctly.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Validation is an automatic computer check to ensure that the password entered matches predetermined rules, such as having a minimum length of 8 characters and containing a mix of letters and numbers. Verification, on the other hand, is used to ensure the password has been entered without typing mistakes. This is typically done by prompting the user to enter the password a second time and checking if both entries match, or by displaying the characters clearly for visual confirmation.
Marking scheme
1 mark for explaining validation in this context (e.g., checking password length or composition rules). 1 mark for explaining verification in this context (e.g., double entry of the password to prevent typing errors). 0.5 marks for clearly distinguishing that validation checks against rules while verification checks for human transcription errors.
Question 7 · short_answer
2.5 marks
A program expects an integer input between 10 and 50 inclusive. State the three types of test data used to test this system, and provide one specific example of data for each type.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Normal test data: inputs that are valid and lie within the expected range, such as 25. Boundary/Extreme test data: inputs that are at the limits of what is acceptable, such as 10 or 50. Erroneous/Abnormal test data: inputs that are outside the acceptable range or of the wrong data type, such as 5, 55, or 'abc'.
Marking scheme
1.5 marks for correctly identifying and describing the three types of test data (0.5 marks each for Normal, Boundary/Extreme, Erroneous/Abnormal). 1 mark for providing correct, matching examples for all three types based on the 10 to 50 inclusive range (0.5 marks if only one or two examples are correct/valid).
Question 8 · short_answer
2.5 marks
Explain how a presence check and a format check can be used to validate a user's input when filling in an online form that requests their date of birth in the format DD/MM/YYYY.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A presence check is used to guarantee that the user has actually entered some data into the date of birth field and has not submitted the form with this field empty. A format check is used to verify that the entered data conforms to the required layout pattern, which in this case is two digits, followed by a slash, another two digits, another slash, and finally four digits (DD/MM/YYYY).
Marking scheme
1 mark for explaining the role of a presence check (ensures the input is not left empty/blank). 1 mark for explaining the role of a format check (checks that the character pattern/structure is correct). 0.5 marks for applying these explanations directly to the DD/MM/YYYY date of birth scenario.
Question 9 · short_answer
2.5 marks
A system is designed to accept any temperature reading above absolute zero (-273.15 degrees Celsius). Explain why a limit check is used rather than a range check to validate this input, and state the threshold value that will be checked.
Show answer & marking schemeHide answer & marking scheme
Worked solution
A range check requires both a minimum and a maximum acceptable value to be defined. Because there is only a physical lower limit (absolute zero) and no realistic upper limit to the temperature reading in this context, a limit check is more appropriate as it only checks one boundary. The threshold value to be checked is -273.15, and any input must be greater than or equal to this value.
Marking scheme
1 mark for explaining that a range check requires both an upper and lower limit, whereas a limit check only tests one boundary. 1 mark for explaining that there is only a lower limit (absolute zero) with no upper limit in this scenario. 0.5 marks for identifying -273.15 as the threshold value.
Question 10 · short-answer
3 marks
An automated greenhouse ventilation system has three inputs: T (temperature high), H (humidity high), and W (window override). The system opens the ventilation window (Output V = 1) if: (temperature is high AND humidity is NOT high) OR (the window override is active AND temperature is high). Write the Boolean expression that represents this system, using only the operators AND, OR, and NOT.
Show answer & marking schemeHide answer & marking scheme
Worked solution
To find the Boolean expression, we break down the logic: 1) 'temperature is high AND humidity is NOT high' is represented as (T AND NOT H). 2) 'window override is active AND temperature is high' is represented as (W AND T). 3) These two conditions are combined using OR. Therefore, the complete expression is V = (T AND NOT H) OR (W AND T).
Marking scheme
1 mark for: T AND NOT H. 1 mark for: W AND T. 1 mark for: combining both terms with OR. Accept equivalent correct bracket arrangements (e.g. without outer brackets) or alternative valid variable orderings.
Question 11 · short-answer
3 marks
A logic circuit has three inputs: A, B, and C. Inputs A and B are passed through a NOR gate to produce an intermediate output. This intermediate output and input C are then passed through an XOR gate to produce the final output Z. Write the Boolean expression for this logic circuit.
Show answer & marking schemeHide answer & marking scheme
Worked solution
First, the inputs A and B are inputs to a NOR gate, which is represented as (A NOR B). Next, the output of this NOR gate is combined with input C using an XOR gate. This gives the final expression: Z = (A NOR B) XOR C.
Marking scheme
1 mark for: A NOR B (or NOT(A OR B)). 1 mark for: XOR C. 1 mark for: correct use of parentheses showing priority/order of operations. Accept: Z = NOT(A OR B) XOR C.
Question 12 · short-answer
3 marks
A logic circuit is represented by the Boolean expression: X = NOT (A AND B) OR (A XOR C). Describe the logic circuit by identifying the input(s) and the type of gate used for each of the three stages to produce output X.
Show answer & marking schemeHide answer & marking scheme
Worked solution
By breaking down the expression X = NOT (A AND B) OR (A XOR C): Stage 1 handles the expression NOT (A AND B), which corresponds to a NAND gate with inputs A and B (or an AND gate followed by a NOT gate). Stage 2 handles (A XOR C), which corresponds to an XOR gate with inputs A and C. Stage 3 combines the two stages with OR, requiring an OR gate.
Marking scheme
1 mark for: Stage 1 has inputs A and B connected to a NAND gate (accept AND gate followed by NOT gate). 1 mark for: Stage 2 has inputs A and C connected to an XOR gate. 1 mark for: Stage 3 has the outputs of Stage 1 and Stage 2 connected to an OR gate.
Question 13 · Algorithm debugging and correction
3 marks
An algorithm is written in pseudocode to calculate the average of all positive numbers stored in a 1-dimensional array, NumArray, which contains 10 integer elements indexed from 1 to 10.
1 Count <- 0 2 Sum <- 0 3 FOR Index <- 0 TO 10 4 IF NumArray[Index] > 0 5 THEN 6 Sum <- Sum + Count 7 Count <- Count + 1 8 ENDIF 9 NEXT Index 10 Average <- Sum / Index 11 OUTPUT Average
Identify the three errors in this pseudocode and write the corrected line for each error.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The three errors in the pseudocode are: 1. In Line 3, the loop variable Index is initialized to 0, which is out of bounds for the array (indexed 1 to 10). The corrected line is: FOR Index <- 1 TO 10. 2. In Line 6, the algorithm incorrectly adds Count to Sum instead of adding the element from the array. The corrected line is: Sum <- Sum + NumArray[Index]. 3. In Line 10, the calculation of the average divides by the loop index variable instead of the count of positive numbers. The corrected line is: Average <- Sum / Count.
Marking scheme
1 mark for each correct identification of the error and its corresponding correction: - Corrects Line 3 to start at 1 instead of 0 (FOR Index <- 1 TO 10). - Corrects Line 6 to add NumArray[Index] instead of Count. - Corrects Line 10 to divide by Count instead of Index.
Question 14 · Algorithm debugging and correction
3 marks
A programmer has written a pseudocode algorithm to perform a linear search on a 1D array of 50 student names, StudentNames (indexed 1 to 50), to find a target name and output its index position.
1 INPUT TargetName 2 Found <- TRUE 3 Counter <- 1 4 WHILE Found = FALSE AND Counter < 50 5 IF StudentNames[Counter] = TargetName 6 THEN 7 Found <- TRUE 8 ELSE 9 Counter <- Counter + 1 10 ENDIF 11 ENDWHILE 12 IF Found = TRUE 13 THEN 14 OUTPUT "Found at position ", Found 15 ELSE 16 OUTPUT "Not found" 17 ENDIF
Identify the three errors in this pseudocode and write the corrected line for each error.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The three errors are: 1. In Line 2, Found is set to TRUE. Because the loop condition requires Found to be FALSE, the loop will never execute. Corrected line: Found <- FALSE. 2. In Line 4, the condition is Counter < 50, which prevents the algorithm from checking the final 50th element of the array. Corrected line: WHILE Found = FALSE AND Counter <= 50. 3. In Line 14, the output displays the boolean value Found instead of the actual array position index. Corrected line: OUTPUT "Found at position ", Counter.
Marking scheme
1 mark for each correct error identification and correction: - Corrects initialization on Line 2 (Found <- FALSE). - Corrects loop bound on Line 4 (Counter <= 50 or Counter < 51). - Corrects output on Line 14 (outputting Counter instead of Found).
Question 15 · Algorithm debugging and correction
3 marks
The following pseudocode algorithm is intended to count the total number of negative numbers entered by a user. The input terminates when the sentinel value 999 is entered.
1 NegCount <- 0 2 INPUT Number 3 WHILE Number = 999 DO 4 IF Number < 0 5 THEN 6 NegCount <- NegCount + Number 7 ENDIF 8 INPUT NegCount 9 ENDWHILE 10 OUTPUT "Total negative numbers: ", NegCount
Identify the three errors in this pseudocode and write the corrected line for each error.
Show answer & marking schemeHide answer & marking scheme
Worked solution
The three errors are: 1. In Line 3, the loop runs while Number is equal to 999, which is the terminating condition. It should loop while Number is not equal to 999. Corrected line: WHILE Number <> 999 DO. 2. In Line 6, the code adds the actual value of Number to NegCount instead of incrementing the count by 1. Corrected line: NegCount <- NegCount + 1. 3. In Line 8, the program requests input for NegCount, which overwrites the counter instead of retrieving the next number to analyze. Corrected line: INPUT Number.
Marking scheme
1 mark for each correct error identification and correction: - Corrects loop condition in Line 3 to use NOT EQUAL (<> or != or !==). - Corrects addition in Line 6 to increment NegCount by 1. - Corrects input variable in Line 8 to input Number instead of NegCount.
Question 16 · trace-table
2.5 marks
Consider the following pseudocode algorithm that processes an array of integers:
```text DECLARE Num : ARRAY[0:4] OF INTEGER Num <- [5, 12, 3, 8, 2] Count <- 0 Sum <- 0 FOR i <- 0 TO 4 IF Num[i] MOD 2 = 0 THEN Count <- Count + 1 Sum <- Sum + Num[i] ENDIF NEXT i OUTPUT Count, Sum ```
Complete the trace table below for this algorithm and state the final outputs.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let us trace the algorithm step-by-step: 1. Initialize `Count = 0` and `Sum = 0`. 2. **i = 0**: `Num[0]` is 5. `5 MOD 2 = 0` is False. No change to `Count` or `Sum`. 3. **i = 1**: `Num[1]` is 12. `12 MOD 2 = 0` is True. `Count` becomes 1, `Sum` becomes 12. 4. **i = 2**: `Num[2]` is 3. `3 MOD 2 = 0` is False. No change. 5. **i = 3**: `Num[3]` is 8. `8 MOD 2 = 0` is True. `Count` becomes 2, `Sum` becomes 12 + 8 = 20. 6. **i = 4**: `Num[4]` is 2. `2 MOD 2 = 0` is True. `Count` becomes 3, `Sum` becomes 20 + 2 = 22. 7. After loop ends, the algorithm outputs `Count` and `Sum`.
Total Marks: 2.5 - 1 mark: Correctly updating the `Count` column (values 1, 2, 3 sequentially on correct rows). - 1 mark: Correctly updating the `Sum` column (values 12, 20, 22 sequentially on correct rows). - 0.5 marks: Correct final OUTPUT statement (3, 22).
Question 17 · trace-table
2.5 marks
Consider the following loop-based pseudocode algorithm:
```text Value <- 256 Product <- 1 WHILE Value > 0 DO Digit <- Value MOD 10 IF Digit <> 0 THEN Product <- Product * Digit ENDIF Value <- Value DIV 10 ENDWHILE OUTPUT Product ```
Trace the execution of this algorithm and determine the final value of the variables and the final output.
Show answer & marking schemeHide answer & marking scheme
Worked solution
Let us trace the loop iterations step-by-step:
- **Initial values**: `Value = 256`, `Product = 1`. - **Iteration 1**: - `Value > 0` (256 > 0) is True. - `Digit <- 256 MOD 10` which is 6. - `Digit <> 0` is True, so `Product <- 1 * 6 = 6`. - `Value <- 256 DIV 10` which is 25. - **Iteration 2**: - `Value > 0` (255 > 0) is True. - `Digit <- 25 MOD 10` which is 5. - `Digit <> 0` is True, so `Product <- 6 * 5 = 30`. - `Value <- 25 DIV 10` which is 2. - **Iteration 3**: - `Value > 0` (2 > 0) is True. - `Digit <- 2 MOD 10` which is 2. - `Digit <> 0` is True, so `Product <- 30 * 2 = 60`. - `Value <- 2 DIV 10` which is 0. - **Termination**: - `Value > 0` (0 > 0) is False. Loop terminates. - `OUTPUT Product` outputs 60.
Total Marks: 2.5 - 1 mark: Correctly extracting all digits in reverse order (6, 5, 2) in the `Digit` column. - 1 mark: Correct calculation of cumulative product values (6, 30, 60) in the `Product` column. - 0.5 marks: Correct final OUTPUT value (60).
Question 18 · structured
3 marks
An algorithm is required to save high scores to a text file. The subroutine `SaveScores` takes an array `Scores` (containing 100 integers, indexed 0 to 99) and a string `FileToWrite` (the file name) as parameters.
The subroutine must: - Open the file in write mode. - Loop through the array and write any score that is 150 or greater to the file. - Close the file.
Complete the pseudocode for this subroutine by writing the missing code for lines (1), (2), and (3):
```pseudocode SUBROUTINE SaveScores(Scores, FileToWrite) OPEN (1) FOR WRITE FOR Index <- 0 TO 99 IF (2) THEN WRITEFILE FileToWrite, Scores[Index] ENDIF NEXT Index (3) ENDSUBROUTINE ```
Show answer & marking schemeHide answer & marking scheme
Worked solution
To complete the subroutine: 1. The `OPEN` statement must specify the name of the file stored in the parameter variable `FileToWrite`. 2. The condition must check if the score at the current array index is greater than or equal to 150, which is written as `Scores[Index] >= 150`. 3. After the loop completes, the file must be closed using the statement `CLOSEFILE FileToWrite`.
Marking scheme
1 mark for each correct line: - (1) `FileToWrite` - (2) `Scores[Index] >= 150` (Accept `150 <= Scores[Index]` or `Scores[Index] > 149`) - (3) `CLOSEFILE FileToWrite`
Question 19 · structured
3 marks
The function `CountLines` is designed to open a text file, count the total number of lines of text inside it, close the file, and return the final count.
Complete the pseudocode for this function by writing the missing code for lines (1), (2), and (3):
```pseudocode FUNCTION CountLines(FileName : STRING) RETURNS INTEGER DECLARE Count : INTEGER DECLARE TempLine : STRING Count <- 0 OPEN FileName FOR READ WHILE (1) DO READFILE FileName, TempLine (2) ENDWHILE CLOSEFILE FileName (3) ENDFUNCTION ```
Show answer & marking schemeHide answer & marking scheme
Worked solution
To complete the function: 1. The loop must continue reading as long as the end of the file has not been reached. In pseudocode, this is written as `NOT EOF(FileName)`. 2. Inside the loop, the variable `Count` must be incremented by 1 each time a line is read, which is written as `Count <- Count + 1`. 3. At the end of the function, the accumulated total must be sent back using `RETURN Count`.
Marking scheme
1 mark for each correct line: - (1) `NOT EOF(FileName)` (Accept `EOF(FileName) = FALSE` or `NOT EOF`) - (2) `Count <- Count + 1` (Accept `Count = Count + 1`) - (3) `RETURN Count`
Question 20 · structured
3 marks
A text file, `stock.txt`, contains a list of stock codes. A procedure `FindStock` is written to search this file for a specific stock code passed as a parameter named `TargetCode` and stop searching as soon as it is found.
Complete the pseudocode for this procedure by writing the missing code for lines (1), (2), and (3):
```pseudocode PROCEDURE FindStock(TargetCode : STRING) DECLARE CurrentCode : STRING DECLARE Found : BOOLEAN Found <- FALSE OPEN "stock.txt" FOR READ WHILE NOT EOF("stock.txt") AND (1) DO READFILE "stock.txt", CurrentCode IF CurrentCode = TargetCode THEN (2) ENDIF ENDWHILE (3) ENDPROCEDURE ```
Show answer & marking schemeHide answer & marking scheme
Worked solution
To complete the procedure: 1. The loop condition must ensure the loop continues only while the item has not been found, which is represented by `Found = FALSE` or `NOT Found`. 2. Once `CurrentCode` matches `TargetCode`, the flag `Found` must be set to `TRUE` to stop the loop on the next iteration. 3. The file `stock.txt` must be closed before the procedure ends using the statement `CLOSEFILE "stock.txt"`.
Marking scheme
1 mark for each correct line: - (1) `Found = FALSE` (Accept `NOT Found` or `Found <=> FALSE`) - (2) `Found <- TRUE` (Accept `Found = TRUE`) - (3) `CLOSEFILE "stock.txt"` (Accept `CLOSEFILE stock.txt` without quotes)
Question 21 · scenario
15 marks
A transport company uses three parallel 1D arrays to store loading data for 100 delivery trucks: - `TruckID` contains the unique ID of each truck (integer). - `Capacity` contains the maximum permitted load weight in tonnes (real). - `CurrentLoad` contains the actual weight currently loaded on the truck in tonnes (real).
Write an algorithm in pseudocode that meets the following requirements: 1. Prompts the user to enter a target truck ID, then searches the `TruckID` array for this value. - If the ID is not found, outputs an appropriate error message. - If the ID is found, compares its current load with its capacity and outputs: - "Overloaded" if `CurrentLoad` is greater than `Capacity`. - "At limit" if `CurrentLoad` is equal to `Capacity`. - "Within limit" if `CurrentLoad` is less than `Capacity`. 2. Iterates through all 100 trucks to calculate and output: - The total number of overloaded trucks. - The average load of all 100 trucks. - The `TruckID` of the truck with the largest remaining unused capacity (unused capacity = `Capacity - CurrentLoad`). Only consider trucks where the unused capacity is greater than 0 (i.e. not overloaded or at capacity).
You should assume that all three arrays are already fully populated with data. Use standard Cambridge IGCSE pseudocode notation.
Show answer & marking schemeHide answer & marking scheme
Worked solution
An elegant solution involves initializing tracking variables, performing a linear search, implementing conditional output logic for the search results, and iterating through the entire arrays to perform calculations.
### Step-by-Step Logic: 1. **Initialization**: Set `Found` status to `FALSE`, `OverloadCount` to `0`, `TotalLoad` to `0.0`, and `MaxUnused` to `0.0`. Set `MaxUnusedID` to a placeholder value (e.g., `-1`). 2. **Search**: Loop through the arrays from index `1` to `100`. If `TruckID[i]` matches `TargetID`, store `i` in `FoundIndex` and set `Found` to `TRUE`. 3. **Search Output**: If `Found` is `TRUE`, compare `CurrentLoad[FoundIndex]` with `Capacity[FoundIndex]`. Use conditional statements (`IF`, `ELSEIF`, `ELSE`) to output "Overloaded", "At limit", or "Within limit". If not found, output an error message. 4. **Stats Loop**: Iterate from `1` to `100` to accumulate `TotalLoad` and count overloaded trucks. For non-overloaded trucks, calculate `Unused = Capacity[i] - CurrentLoad[i]`. If this value exceeds `MaxUnused`, update `MaxUnused` and `MaxUnusedID`. 5. **Calculations & Output**: Calculate `AverageLoad` as `TotalLoad / 100`. Output all aggregated results.
Marking scheme
Marks are awarded as follows (up to a maximum of 15 marks):
- **1 mark**: Prompting for and inputting target `TruckID` variable. - **1 mark**: Loop correctly established to iterate through all 100 array indices. - **1 mark**: Linear search correctly implemented (comparing array elements to input ID). - **1 mark**: Maintaining a boolean flag or tracking index to check if ID exists. - **1 mark**: Outputting an error message if the ID is not found in the array. - **2 marks**: Correct nested or conditional logic comparing `CurrentLoad` and `Capacity` for the found ID (1 mark for syntax/nesting, 1 mark for correct output strings). - **1 mark**: Initializing `OverloadCount`, `TotalLoad`, and `MaxUnused` to suitable starting values (e.g. 0). - **1 mark**: Incrementing running total of load (`TotalLoad`) correctly inside loop. - **1 mark**: Incrementing `OverloadCount` correctly inside loop based on condition (`CurrentLoad[i] > Capacity[i]`). - **2 marks**: Correct calculation of unused capacity and tracking of maximum unused capacity (1 mark for logic, 1 mark for excluding overloaded/at-capacity trucks). - **1 mark**: Tracking and storing the correct `TruckID` corresponding to the maximum unused capacity. - **1 mark**: Correct calculation of average load outside of loop (division of total by 100). - **1 mark**: Outputting final statistics (`OverloadCount`, average load, and the identified truck ID).
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.