An original Thinka practice paper modelled on the structure and difficulty of the Jun 2023 (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. Write answers clearly in spaces provided.
11 PastPaper.question · 80 PastPaper.marks
PastPaper.question 1 · written
11 PastPaper.marks
Part (a) Convert the denary number 154 into: (i) 8-bit binary [2 marks] (ii) Hexadecimal [1 mark]
Part (b) Perform the binary addition of the following two 8-bit binary integers. Show your working. 01101100 + 01011011 ---------- [2 marks]
State whether an overflow error occurs during this addition, and explain your answer. [2 marks]
Part (c) (i) Perform a logical right shift of 2 places on the 8-bit binary number 11001000. [1 mark] (ii) State the denary value of 11001000 before the shift. [1 mark] (iii) State the denary value of the shifted binary number. [1 mark] (iv) Explain the mathematical effect of performing a logical right shift of 2 places on any positive binary integer. [1 mark]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Part (a) (i) To convert 154 to 8-bit binary: \(154 = 128 + 16 + 8 + 2\), which corresponds to bit positions: 128 (1), 64 (0), 32 (0), 16 (1), 8 (1), 4 (0), 2 (1), 1 (0). Binary representation: 10011010. (ii) To convert 10011010 to hexadecimal, split into two 4-bit nibbles: 1001 = 9 1010 = 10 = A Hexadecimal representation: 9A.
Part (b) Perform the addition: 01101100 + 01011011 ---------- 11000111 Carries: Carry 1 into bit positions 4, 5, 6, and 7. No overflow error occurs. This is because there is no carry-out from the eighth bit (the most significant bit / MSB), meaning the result can be represented within the 8-bit limit. The denary sum is \(108 + 91 = 199\), which is well below the maximum limit of 255.
Part (c) (i) Shift 11001000 to the right by 2 places: Shift 1: 01100100 Shift 2: 00110010 (ii) Denary value of 11001000 is \(128 + 64 + 8 = 200\). (iii) Denary value of 00110010 is \(32 + 16 + 2 = 50\). (iv) A logical right shift of 2 places divides the denary value by 4 (or \(2^{2}\)).
PastPaper.markingScheme
Part (a) (i) [2 marks] - 1 mark for correct 4 bits on the left (1001) - 1 mark for correct 4 bits on the right (1010) (ii) [1 mark] - 1 mark for 9A (accept 9a)
Part (b) Addition: [2 marks] - 2 marks for correct answer: 11000111 - 1 mark for correct working with at least 3 correct bits added from right-to-left with carry representation. Overflow: [2 marks] - 1 mark for stating: No overflow (occurs / occurred) - 1 mark for explanation: e.g. the addition does not produce a carry-out from the 8th bit / MSB, OR the result (199) is within the maximum limit of an 8-bit register (255).
Part (c) (i) [1 mark] - 1 mark for 00110010 (ii) [1 mark] - 1 mark for 200 (iii) [1 mark] - 1 mark for 50 (iv) [1 mark] - 1 mark for stating that it divides the number by 4 (or by \(2^{2}\)) / halves the value twice.
PastPaper.question 2 · descriptive
10 PastPaper.marks
An audio engineer records a new musical track on a computer and then sends it to a producer over the internet. [Part a] Describe how the analogue sound wave of the music is converted into a digital format. (3 marks) [Part b] The engineer decides to double the sampling rate of the recording. Describe the effects this change will have on: (i) the accuracy of the digital audio recording (1 mark), and (ii) the file size of the digital audio recording (1 mark). [Part c] The completed audio file is sent over the internet using packet switching. Explain how packet switching is used to transmit the file from the engineer's computer to the producer's computer. (5 marks)
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
[Part a] The analogue sound wave is picked up by a microphone, which converts it into an analogue electrical signal. The amplitude of the sound wave is sampled at regular time intervals. These continuous analogue values are then converted into discrete digital/binary values by an Analogue-to-Digital Converter (ADC) so the computer can store and process them. [Part b] (i) Accuracy: The recording will be more accurate and closer to the original analogue wave, resulting in higher sound quality. (ii) File size: The file size of the digital audio recording will increase because twice as many samples are saved per second. [Part c] The audio file is split into smaller units called packets. Each packet is given a header containing the sender's IP address, the receiver's IP address, the packet sequence number, and error-checking data (such as a checksum). The packets are sent onto the network and travel independently. Routers direct the packets across the network; because routes can change depending on network traffic, different packets may take different paths. Packets can arrive at the destination (the producer's computer) out of order. The receiving computer uses the packet sequence numbers to reassemble the packets in the correct order to reconstruct the original audio file. If a packet is missing or corrupted, a request is sent to retransmit it.
PastPaper.markingScheme
Part a (Max 3 marks): 1 mark for stating that the amplitude of the sound wave is sampled/measured. 1 mark for stating that sampling occurs at regular/fixed time intervals (sampling rate). 1 mark for stating that analogue values are converted to digital/binary values using an ADC. 1 mark for stating that the analogue wave is converted to electrical signals by a microphone. Part b (Max 2 marks): 1 mark for stating that accuracy/sound quality increases (or the representation is closer to the original analogue wave). 1 mark for stating that the file size increases (or doubles). Part c (Max 5 marks): 1 mark for stating the file is divided into packets. 1 mark for stating each packet has a header containing IP addresses, packet sequence numbers, or a checksum. 1 mark for stating packets travel independently across the network. 1 mark for stating routers determine the path / packets can take different routes. 1 mark for stating packets can arrive out of order. 1 mark for stating the receiving computer uses sequence numbers to reorder/reassemble them. 1 mark for stating that a checksum is used to detect corruption or trigger retransmission.
PastPaper.question 3 · written
4 PastPaper.marks
A computer manufacturer is designing a new ultra-thin, portable laptop. They have decided to use a Solid State Drive (SSD) rather than a magnetic Hard Disk Drive (HDD) for secondary storage.
Identify two benefits of using an SSD instead of an HDD for this laptop. For each benefit, describe how the physical nature of solid-state technology enables it.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To secure full marks, the response must identify two distinct benefits relevant to a portable laptop and explain how the physical characteristics of solid-state storage achieve these benefits.
Example answers: - Benefit: Shock resistance / durability. - Physical Explanation: No moving parts (no read/write heads or spinning platters) to get damaged when the laptop is moved.
- Benefit: Longer laptop battery life / low power consumption. - Physical Explanation: SSDs operate completely electronically using flash memory (transistors/gates), meaning no energy is wasted powering mechanical drive motors.
- Benefit: Thinner / lighter laptop design. - Physical Explanation: SSDs store data on miniature silicon chips rather than heavy, bulky physical platters, enabling a much smaller physical footprint.
PastPaper.markingScheme
Award marks as follows (maximum 4 marks total): - 1 mark for each valid benefit identified (maximum 2 marks). - 1 mark for each corresponding physical explanation (maximum 2 marks).
Acceptable benefits: - More durable / robust / shock-resistant - Lower power consumption / energy efficient / extends battery life - Faster read/write speeds / faster boot-up - Lightweight / compact physical size - Silent operation
Acceptable physical explanations: - Has no moving parts (which could break or fail on impact) - Uses no mechanical motors (eliminates power needed to spin disks/move heads) - Uses electronic NAND flash memory / transistors (allowing rapid electronic data transfer compared to waiting for a physical platter to spin to the correct position) - Uses tiny microchips instead of heavy, metallic disks (reducing overall weight and volume)
Note: The physical explanation must directly align with the benefit identified to receive the mark.
PastPaper.question 4 · matching
4 PastPaper.marks
A software developer is classifying different programs used on a computer. Tick to show whether each program is an example of System software or Application software. Program 1: A utility program that defragments a hard disk drive to improve read/write speeds. Program 2: A web browser used to access and view websites on the Internet. Program 3: A device driver that allows the operating system to communicate with a printer. Program 4: A word processor used to write, edit, and format essays.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Program 1 is System software because a disk defragmenter is a utility program that helps maintain and optimize the computer system. Program 2 is Application software because a web browser allows users to perform a specific user-oriented task. Program 3 is System software because a device driver is a system-level program that facilitates communication between the OS and hardware. Program 4 is Application software because a word processor is a productivity tool used directly by the user to perform a specific task.
PastPaper.markingScheme
Award 1 mark for each correct classification, up to a maximum of 4 marks: Program 1 = System software (1 mark); Program 2 = Application software (1 mark); Program 3 = System software (1 mark); Program 4 = Application software (1 mark).
PastPaper.question 5 · descriptive
7 PastPaper.marks
A high-tech agricultural greenhouse uses an automated system to maintain the air humidity within an optimal range of 45% to 70% inclusive.
Describe how the sensors, microprocessor, and actuators work together to maintain the humidity in the greenhouse.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To maintain the humidity, the automated system operates as follows: - The **humidity sensor** continuously detects the moisture level of the air in the greenhouse. - The analogue readings from the sensor are converted into digital data using an **ADC (Analogue-to-Digital Converter)** so the microprocessor can understand it. - The digital data is sent to the **microprocessor**. - The microprocessor **compares** this data against pre-stored values ( (45\%\) and \(70\%\)). - If the humidity value is below \(45\%\), the microprocessor sends a signal (converted to analogue using a **DAC** if required) to the **actuator** of the water mister to turn it on. - If the humidity value is above \(70\%\), the microprocessor sends a signal to the **actuator** of the exhaust fan to turn it on. - If the value is within the range, the microprocessor sends signals to turn off (or keep off) both the mister and the fan. - This process is performed **continuously** in an infinite loop.
PastPaper.markingScheme
Award 1 mark per correct point, up to a maximum of 7 marks: - Humidity sensor continuously senses/measures the air humidity in the greenhouse. - Analogue data from the sensor is converted to digital using an ADC. - Digital data is transmitted to the microprocessor. - Microprocessor compares the humidity reading against pre-stored/optimal values (45% and 70%). - If reading < 45%, microprocessor sends a signal to the actuator to turn on the water mister. - If reading > 70%, microprocessor sends a signal to the actuator to turn on the exhaust fan. - If reading is between 45% and 70% inclusive, the microprocessor sends a signal to turn off (or keep off) the mister and fan. - The system operates as a continuous loop.
Note: Do not accept 'microprocessor changes the humidity' - it must be the actuator that performs the physical action.
PastPaper.question 6 · Addressing and networking components
6 PastPaper.marks
Devices on a network use both MAC addresses and IP addresses to communicate.
(a) Describe two differences between a Media Access Control (MAC) address and an Internet Protocol (IP) address. [4]
(b) A router is a key networking component used to connect a local area network (LAN) to the internet. Explain the role of a router in forwarding data packets. [2]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Part (a): - Difference 1: A MAC (Media Access Control) address is a permanent physical address hardcoded onto the Network Interface Card (NIC) during manufacturing and cannot be easily changed. In contrast, an IP (Internet Protocol) address is a logical address allocated dynamically or statically by an ISP or network DHCP server, and it can change depending on the location of the device. - Difference 2: MAC addresses operate at the local link layer to uniquely identify a device within a local network. IP addresses operate at the network layer to identify the global network location of the device, enabling routing across different networks.
Part (b): - When a router receives a packet, it reads the packet header to extract the destination IP address. - It consults its routing table (which stores network paths) to determine the quickest or most efficient path to send the packet. - It then forwards the packet to the next router or destination node.
PastPaper.markingScheme
Part (a) [Max 4 marks total, max 2 marks per difference]: Difference 1: - MAC address is permanent / assigned by manufacturer / unique to NIC [1 mark] - IP address is dynamic or static / assigned by network/ISP / can be changed [1 mark]
Difference 2: - MAC address is used to identify the physical device on a local network [1 mark] - IP address is used to identify the location of the device on the network/internet (for routing) [1 mark]
Alternative difference: - MAC address is 48-bit (or 12 hex digits) [1 mark] - IP address is 32-bit (IPv4) or 128-bit (IPv6) [1 mark]
Part (b) [Max 2 marks]: - Receives data packets (from a network/host) [1 mark] - Inspects / reads the packet header to find the destination IP address [1 mark] - References its routing table [1 mark] - Identifies the most efficient route/path [1 mark] - Forwards the packet to the next node / router / destination [1 mark]
PastPaper.question 7 · short_answer
4 PastPaper.marks
A software engineer is developing the control software for an artificial cardiac pacemaker (a small medical device implanted in a patient's chest to regulate their heartbeat). The engineer decides to write the critical control software in a low-level language (assembly language) rather than a high-level language.
Explain four reasons why a low-level language is more suitable than a high-level language for this specific application.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
A low-level language is highly suitable for embedded medical systems like pacemakers due to the following reasons:
1. **Direct Hardware Access:** Low-level languages (like assembly) allow the programmer to directly manipulate CPU registers, memory addresses, and input/output ports. This is vital for interacting directly with the pacemaker's physical sensors. 2. **Execution Speed and Real-time Operation:** Because assembly language has a near one-to-one relationship with machine code, the resulting program executes extremely quickly with minimal latency. This ensures instantaneous, real-time response to heart rate changes. 3. **Memory Constraints:** Microcontrollers inside implants have very small, restricted storage (ROM) and memory (RAM) capacities. Low-level code compiles into a highly compact machine code footprint compared to high-level language binaries. 4. **No Runtime Overhead:** Unlike high-level languages (e.g., Python or Java), low-level languages do not require virtual machines, garbage collectors, or heavy runtime libraries to run, eliminating unexpected execution pauses and reducing potential points of failure.
PastPaper.markingScheme
Award 1 mark for each valid reason explained, up to a maximum of 4 marks: - Direct control/manipulation of internal hardware components / CPU registers / memory addresses [1 mark] - Faster execution speed / code runs more efficiently / critical for real-time response [1 mark] - Requires less memory / smaller file size / occupies less RAM/ROM on the microcontroller [1 mark] - No runtime environment / virtual machine / interpreter overhead required to run the code [1 mark] - Gives precise control over the exact timing of instructions [1 mark] - Can utilize specialized instructions specific to that custom microcontroller's CPU architecture [1 mark]
(Note: Do not accept vague answers such as "it is safer" or "it is harder to hack" without technical justification.)
PastPaper.question 8 · short-answer
10 PastPaper.marks
A small online retailer, 'GadgetWorld', stores customer account data, including payment information, on its server.
(a) Describe the security threats of Pharming and Spyware, and state how each could affect GadgetWorld or its customers. [4 marks]
(b) GadgetWorld's web server suffers a Denial of Service (DoS) attack. Explain how a DoS attack works and describe one negative effect of this attack on the business. [3 marks]
(c) GadgetWorld wants to improve its security. Explain how the use of a Firewall and Two-Factor Authentication (2FA) can help protect their system. [3 marks]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
(a) Pharming: Malicious code is installed on a user's device or web server, which redirects the user to a fraudulent website even if they typed the correct web address. This affects customers as they might input sensitive login credentials or credit card details on the fake website, leading to identity theft or financial loss. Spyware: Software that is secretly installed on a user's computer to monitor their activities (e.g., using a keylogger to record keystrokes). This allows attackers to steal sensitive data, such as passwords or bank details, compromising customer accounts.
(b) Denial of Service (DoS): The attacker floods GadgetWorld's web server with a massive volume of fake traffic/requests. This consumes the server's bandwidth or CPU/RAM resources, causing the server to crash or become unresponsive to legitimate users. Negative effect: The business suffers from a loss of revenue (as customers cannot buy products during downtime) and a loss of customer trust/reputation.
(c) Firewall: It acts as a barrier between GadgetWorld's internal network and the internet. It monitors incoming and outgoing traffic, analyzing data packets based on a set of predefined security rules, and blocks unauthorized access or suspicious traffic. Two-Factor Authentication (2FA): Requires users to provide two different authentication factors to verify themselves (e.g., a password and a one-time code sent to their registered mobile device). This prevents unauthorized login attempts even if an attacker has stolen a customer's password.
PastPaper.markingScheme
Part (a) [4 marks max]: - Pharming (2 marks): - 1 mark for describing the mechanism (redirects users to a fake website by modifying DNS/hosts or installing malicious code). - 1 mark for describing the impact (harvests user credentials/identity theft). - Spyware (2 marks): - 1 mark for describing the mechanism (monitors user activity/keystrokes without their knowledge). - 1 mark for describing the impact (steals usernames, passwords, or personal data).
Part (b) [3 marks max]: - 1 mark for explaining that the server is flooded with a huge volume of traffic/requests. - 1 mark for explaining that this overloads resources/bandwidth, making the website unavailable to legitimate users. - 1 mark for identifying a business impact (e.g., loss of sales, reputation damage, downtime).
Part (c) [3 marks max]: - Firewall (2 marks): - 1 mark for mentioning monitoring/filtering incoming and outgoing traffic. - 1 mark for stating it blocks unauthorized access based on a set of security rules. - Two-Factor Authentication (2FA) (1 mark): - 1 mark for explaining that it requires two forms of verification (e.g., password and a code), making stolen passwords alone useless for unauthorized entry.
PastPaper.question 9 · short_answer
5 PastPaper.marks
An automated warehouse uses autonomous mobile robots (AMRs) to retrieve and move inventory.
(a) State the three core characteristics that define a robot. [3]
(b) Identify one advantage and one disadvantage to the warehouse company of replacing human workers with these robots. [2]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Part (a): A robot is characterized by three main components: 1. Mechanical structure/framework: This is the physical body of the robot. 2. Electrical components: This includes sensors (to detect environmental changes), actuators (to produce physical movement), and a power source. 3. Programmable/computer controller: This is the brain of the robot (such as a microprocessor) that runs code to process inputs and make decisions.
Part (b): - Advantage: Improved productivity as robots can work continuously (24/7) without breaks, holidays, or sick leave. (Alternatively: greater accuracy/consistency, or ability to lift extremely heavy loads safely). - Disadvantage: High initial capital cost to buy and install the system. (Alternatively: expensive ongoing maintenance, or loss of flexibility compared to human workers).
PastPaper.markingScheme
Part (a) [Max 3 marks]: - 1 mark for: Mechanical structure / physical framework / body - 1 mark for: Electrical components / sensors / actuators / power source - 1 mark for: Programmable / computer controller / microprocessor
Part (b) [Max 2 marks]: - 1 mark for a valid advantage, e.g.: - Can work 24/7 / continuously / without breaks - More consistent / higher accuracy / fewer mistakes - Performs heavy/unsafe lifting, reducing workplace injuries - Lower long-term operating/salary costs - 1 mark for a valid disadvantage, e.g.: - High initial/capital cost of purchase and setup - Expensive maintenance/repair costs / need for skilled technicians - If a robot breaks down, it can cause severe downtime / bottlenecks - Lack of flexibility / cannot easily adapt to unusual or unexpected situations
PastPaper.question 10 · short_answer
5 PastPaper.marks
An automated warehouse uses autonomous mobile robots (AMRs) to retrieve and move inventory.
(a) State the three core characteristics that define a robot. [3]
(b) Identify one advantage and one disadvantage to the warehouse company of replacing human workers with these robots. [2]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Part (a): A robot is characterized by three main components: 1. Mechanical structure/framework: This is the physical body of the robot. 2. Electrical components: This includes sensors (to detect environmental changes), actuators (to produce physical movement), and a power source. 3. Programmable/computer controller: This is the brain of the robot (such as a microprocessor) that runs code to process inputs and make decisions.
Part (b): - Advantage: Improved productivity as robots can work continuously (24/7) without breaks, holidays, or sick leave. (Alternatively: greater accuracy/consistency, or ability to lift extremely heavy loads safely). - Disadvantage: High initial capital cost to buy and install the system. (Alternatively: expensive ongoing maintenance, or loss of flexibility compared to human workers).
PastPaper.markingScheme
Part (a) [Max 3 marks]: - 1 mark for: Mechanical structure / physical framework / body - 1 mark for: Electrical components / sensors / actuators / power source - 1 mark for: Programmable / computer controller / microprocessor
Part (b) [Max 2 marks]: - 1 mark for a valid advantage, e.g.: - Can work 24/7 / continuously / without breaks - More consistent / higher accuracy / fewer mistakes - Performs heavy/unsafe lifting, reducing workplace injuries - Lower long-term operating/salary costs - 1 mark for a valid disadvantage, e.g.: - High initial/capital cost of purchase and setup - Expensive maintenance/repair costs / need for skilled technicians - If a robot breaks down, it can cause severe downtime / bottlenecks - Lack of flexibility / cannot easily adapt to unusual or unexpected situations
PastPaper.question 11 · written
14 PastPaper.marks
An internet user is browsing an e-commerce website using a web browser. The website uses HTTPS to secure transactions and utilizes cookies to track user interactions. (a) Explain the purpose of HTTPS and describe how it differs from HTTP. [3] (b) (i) Describe the differences between session cookies and persistent cookies. [4] (ii) Identify three different uses of cookies on a commercial website. [3] (c) Describe four main functions of a web browser. [4]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
(a) The purpose of HTTPS is to provide secure, encrypted data transmission over the internet, protecting sensitive user data. HTTPS differs from HTTP in that HTTPS encrypts the transmitted data using SSL/TLS protocols (HTTP transmits data in plaintext) and HTTPS uses SSL/TLS digital certificates to authenticate the identity of the web server (HTTP does not). (b) (i) Session cookies are temporary files stored in the computer's temporary memory/RAM; they are automatically deleted when the web browser is closed. In contrast, persistent cookies are stored directly on the user's secondary storage (hard drive/SSD); they remain there even after the browser is closed, until they reach their pre-defined expiration date or are manually deleted. (b) (ii) Three uses of cookies on a commercial website include: 1. Storing items currently held in a user's virtual shopping basket. 2. Maintaining the user's logged-in status so they do not have to re-enter credentials on every page. 3. Saving user preferences such as preferred language or website theme settings. (c) Four functions of a web browser include: 1. Rendering HTML, CSS, and executing JavaScript to display web pages visually to the user. 2. Sending requests (HTTP/HTTPS GET/POST) to web servers to retrieve resources and receiving the returned data. 3. Providing navigation tools such as the address bar (URL input), back and forward buttons, and bookmarking systems. 4. Managing and storing cookies and browsing history locally on the user's device.
PastPaper.markingScheme
Part (a): Max 3 marks. 1 mark for the purpose: To provide secure/encrypted communication/data transmission. 1 mark for difference 1: HTTPS encrypts data (using SSL/TLS) whereas HTTP transmits data in cleartext/plaintext. 1 mark for difference 2: HTTPS requires/uses an SSL certificate (for authentication) whereas HTTP does not. Accept other valid differences (e.g., HTTPS uses port 443 whereas HTTP uses port 80). Part (b)(i): Max 4 marks. 1 mark: Session cookies are stored in RAM/temporary memory. 1 mark: Session cookies are deleted when the browser/session is closed. 1 mark: Persistent cookies are stored on the hard drive/SSD/secondary storage. 1 mark: Persistent cookies remain after browser closure / until an expiry date is reached. Part (b)(ii): Max 3 marks. 1 mark per valid use: Storing shopping cart items, saving login credentials/session token, storing user preferences (language, theme), tracking user behavior for analytics, targeted advertising. Part (c): Max 4 marks. 1 mark per valid function of a web browser: Renders/interprets HTML/CSS to display web pages; Sends HTTP/HTTPS requests to servers; Receives responses/data from web servers; Manages/stores cookies; Stores/manages browsing history/bookmarks; Provides user navigation features (e.g., back, forward, refresh buttons, address bar).
Paper 2 Algorithms, Programming and Logic
Answer all questions. Calculators are not permitted. Use pseudocode or program code for programming questions.
12 PastPaper.question · 76 PastPaper.marks
PastPaper.question 1 · matching
7 PastPaper.marks
The program development life cycle consists of four main stages: Analysis, Design, Coding, and Testing. Match each of the seven tasks to the correct stage of the program development life cycle: Task 1: Gathering requirements from the client using interviews or questionnaires. Task 2: Creating structure diagrams and flowcharts. Task 3: Writing the instructions in a high-level programming language. Task 4: Dry-running an algorithm using a trace table. Task 5: Producing a data dictionary to define variables and data types. Task 6: Identifying the input, process, and output requirements. Task 7: Executing the program with normal, boundary, and erroneous data.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Task 1 corresponds to Analysis because gathering requirements from the client is done to understand the scope of the problem. Task 2 corresponds to Design as structure diagrams and flowcharts plan the layout and flow of the program before coding. Task 3 corresponds to Coding because writing the actual instructions in a programming language represents implementation. Task 4 corresponds to Testing as dry-running with a trace table checks the algorithm logic for errors. Task 5 corresponds to Design since a data dictionary establishes variable specifications during the planning phase. Task 6 corresponds to Analysis because defining what inputs are needed and what outputs are expected is part of analyzing the problem. Task 7 corresponds to Testing as executing code with specific datasets checks if it runs correctly and handles errors.
PastPaper.markingScheme
1 mark for each correct match, up to a maximum of 7 marks: Task 1 = Analysis, Task 2 = Design, Task 3 = Coding, Task 4 = Testing, Task 5 = Design, Task 6 = Analysis, Task 7 = Testing. Accept any clear format showing these correct pairings.
PastPaper.question 2 · short-answer
1 PastPaper.marks
State the standard technical term used to describe the numerical position of an individual item of data within an array.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The position of an item of data in an array is called its index (or subscript). For example, in an array named Names, the first item is accessed using Names[1] or Names[0], where 1 or 0 is the index.
PastPaper.markingScheme
Award 1 mark for any of the following: - index - subscript
Reject: - element (this refers to the item itself) - pointer - key
PastPaper.question 3 · short-answer
1 PastPaper.marks
State the standard technical term used to describe the numerical position of an individual item of data within an array.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
The position of an item of data in an array is called its index (or subscript). For example, in an array named Names, the first item is accessed using Names[1] or Names[0], where 1 or 0 is the index.
PastPaper.markingScheme
Award 1 mark for any of the following: - index - subscript
Reject: - element (this refers to the item itself) - pointer - key
PastPaper.question 4 · written
8 PastPaper.marks
An online registration system for a youth summer camp requires users to enter two pieces of data:
1. **Camper ID**: Must consist of exactly 5 characters: the uppercase letter 'C' followed by exactly 4 digits (e.g., C4012). 2. **Camper Age**: Must be an integer from 7 to 16 inclusive.
(a) Identify **two** different validation checks that could be applied to the **Camper ID** input. Describe how each check would be used to validate this input.
(b) Complete the table below to provide **four** different test cases to test the validation of the **Camper Age** input.
You must include: - One **normal** test case - One **boundary** (extreme) test case - Two **invalid** test cases
| Test Value | Type of Test Data | Expected Outcome (Accept / Reject) | | :--- | :--- | :--- | | | | | | | | | | | | | | | | |
[4 marks]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
### Part (a) Solution: Any two from: - **Length Check**: Verifies that the entered Camper ID has exactly 5 characters. Reject if it has more or fewer characters. - **Format Check**: Verifies that the input matches the pattern "C" followed by four digits (Cdddd). Reject if any other character pattern is used. - **Type Check**: Verifies that the first character is alphabetic and the other four are numeric. Reject if not. - **Presence Check**: Verifies that the user has actually typed something in the input field. Reject if empty.
### Part (b) Solution: Example test case suite: 1. **Normal**: Test Value = `12` | Type = `Normal` | Expected Outcome = `Accept` (tests typical valid input) 2. **Boundary**: Test Value = `7` (or `16`) | Type = `Boundary` | Expected Outcome = `Accept` (tests the extreme limits of acceptable data) 3. **Invalid**: Test Value = `5` | Type = `Invalid` | Expected Outcome = `Reject` (tests out-of-range value) 4. **Invalid**: Test Value = `18` (or `"ten"` or `12.5`) | Type = `Invalid` | Expected Outcome = `Reject` (tests another out-of-range value or invalid type)
PastPaper.markingScheme
### Part (a) Marking Scheme (Max 4 marks): - **1 mark** for naming a valid check (Max 2) - **1 mark** for describing its specific application to the Camper ID (Max 2) - *Acceptable checks:* Length check, Format check / Character check, Type check, Presence check. - *Do NOT accept:* Range check, Limit check.
### Part (b) Marking Scheme (Max 4 marks): - **1 mark per row** correctly filled in. To gain the mark, all three columns in that row must align logically. - Row 1 (Normal): Value must be an integer between 8 and 15 inclusive. Type must be "Normal". Outcome must be "Accept". - Row 2 (Boundary): Value must be 7 or 16 (or 6 or 17 if justified by extreme boundaries). Type must be "Boundary" or "Extreme". Outcome must be "Accept" (for 7 or 16) or "Reject" (for 6 or 17). - Row 3 & 4 (Invalid): Value must be < 7, > 16, a decimal, or text. Type must be "Invalid". Outcome must be "Reject".
PastPaper.question 5 · short-answer
4 PastPaper.marks
A shipping application processes the weight of packages, which is stored as a positive real number in a variable called Weight (for example, 5.74).
Write a one-line pseudocode statement for each of the following tasks. You must use the standard mathematical library functions INT() and/or ROUND(), along with standard arithmetic operators where necessary.
1. Round the Weight to the nearest whole kilogram and store the result in LabelWeight. 2. Round the Weight to one decimal place and store the result in SurchargeWeight. 3. Extract only the integer part of Weight (rounding down to the nearest whole number) and store the result in BaseWeight. 4. Extract only the fractional (decimal) part of Weight (for example, 0.74 from 5.74) and store the result in FractionalWeight.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
1. To round a number to the nearest whole unit, use the ROUND function with 0 decimal places: LabelWeight <- ROUND(Weight, 0) 2. To round to one decimal place, specify 1 as the second parameter: SurchargeWeight <- ROUND(Weight, 1) 3. To extract only the integer part, use the INT function: BaseWeight <- INT(Weight) 4. To get the fractional part, subtract the integer part from the original weight: FractionalWeight <- Weight - INT(Weight) or FractionalWeight <- Weight - BaseWeight
PastPaper.markingScheme
Award 1 mark for each correct statement: 1. LabelWeight <- ROUND(Weight, 0) (Accept ROUND(Weight) if 0 is omitted, or alternative assignment symbols like =) 2. SurchargeWeight <- ROUND(Weight, 1) 3. BaseWeight <- INT(Weight) 4. FractionalWeight <- Weight - INT(Weight) OR Weight - BaseWeight (or mathematically equivalent)
PastPaper.question 6 · structural
8 PastPaper.marks
The following pseudocode algorithm is designed to input 10 integers from a user, store them in an array named Numbers, and then calculate and output the average of these numbers along with the maximum value entered.
However, the program contains four errors.
01 DECLARE Numbers : ARRAY[1:10] OF INTEGER 02 DECLARE Count, Sum, Max, Temp : INTEGER 03 DECLARE Average : REAL 04 Sum <- 0 05 Max <- -10000 06 FOR Count <- 0 TO 10 07 OUTPUT "Enter number: " 08 INPUT Temp 09 Numbers[Count] <- Temp 10 Sum <- Sum + Count 11 IF Temp < Max THEN 12 Max <- Temp 13 ENDIF 14 NEXT Temp 15 Average <- Sum / 10 16 OUTPUT "The average is: ", Average 17 OUTPUT "The maximum is: ", Max
Identify the line number, describe the error, and write the corrected pseudocode line for each of the four errors.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To solve this problem, we trace the logic of the pseudocode to identify where it deviates from the intended behavior of capturing 10 integers, storing them, and computing the average and maximum:
1. Array Index & Loop Bounds (Line 06): The array is declared as Numbers[1:10]. Line 06 initializes the loop with Count <- 0 TO 10. In the first iteration, Numbers[0] is accessed (Line 09), causing an array out-of-bounds error. It also runs 11 times instead of 10. The fix is to change the range to 1 TO 10.
2. Accumulator Variable (Line 10): Line 10 adds the loop counter Count to Sum. To compute the true total of the inputs, the program must add the input value Temp to Sum. The correct line is Sum <- Sum + Temp.
3. Selection logic for Maximum (Line 11): To find the maximum value, we compare if the newly entered value (Temp) is larger than the current maximum (Max). Line 11 incorrectly uses <, which would find the minimum. This must be corrected to >.
4. Loop Iteration Control (Line 14): The loop variable declared on line 06 is Count, but the loop termination on line 14 is NEXT Temp. The loop variable in the NEXT statement must match the FOR loop control variable, so it must be NEXT Count (or simply NEXT).
PastPaper.markingScheme
Award marks up to a maximum of 8 marks: - For each identified error, award 1 mark for the correct line number/description (Max 4 marks). - For each identified error, award 1 mark for the correct pseudocode fix (Max 4 marks).
Error 1 (Line 06): - Identification (1 mark): Line 06; loop starts at index 0 instead of 1 / loop runs 11 times instead of 10 / causes array index out-of-bounds error. - Correction (1 mark): FOR Count <- 1 TO 10
Error 2 (Line 10): - Identification (1 mark): Line 10; adds the loop counter 'Count' instead of the entered value 'Temp'. - Correction (1 mark): Sum <- Sum + Temp
Error 3 (Line 11): - Identification (1 mark): Line 11; uses '<' comparison instead of '>' / searches for minimum instead of maximum. - Correction (1 mark): IF Temp > Max THEN
Error 4 (Line 14): - Identification (1 mark): Line 14; NEXT statement refers to the incorrect variable 'Temp' instead of loop variable 'Count'. - Correction (1 mark): NEXT Count (accept: NEXT)
PastPaper.question 7 · written
4 PastPaper.marks
A programmer wants to write a software program that is easy to maintain by other developers.
Describe four practices that the programmer can use to make the program code easier to read and maintain.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To make a program maintainable, a programmer should apply the following techniques:
1. **Meaningful Variable/Identifier Names**: Instead of using generic names like 'x' or 'y', use descriptive names like 'totalPrice' or 'customerAge'. This helps someone reading the code understand what data is being processed. 2. **Comments and Documentation**: Writing comments (e.g., using '//' or '#' depending on the language) to explain complex logic, algorithms, or the overall purpose of a section of code. 3. **Consistent Indentation / Spacing**: Indenting blocks of code inside loops, selection structures, and subroutines helps visually separate different logical blocks, making the execution flow easy to follow. 4. **Use of Constants**: Declaring values that do not change (like `VAT_RATE = 0.20` or `MAX_USERS = 100`) as named constants instead of hardcoding literal values. This ensures that if the value needs to change in the future, it only needs to be updated in one place. 5. **Use of Subroutines (Procedures/Functions)**: Breaking down a large, complex program into smaller, self-contained, and reusable modular blocks of code, making debugging and updating much simpler.
PastPaper.markingScheme
Award 1 mark for each valid practice described, up to a maximum of 4 marks.
- **Meaningful identifier/variable names** (1 mark): To ensure the purpose of each variable or structure is clear to the reader. - **Comments/documentation** (1 mark): To explain what complex sections of code, algorithms, or functions do. - **Indentation/blank lines** (1 mark): To visually separate blocks of code (e.g., within loops or IF statements) and clarify program structure. - **Use of named constants** (1 mark): To make updating fixed values easier by changing them in one single location instead of multiple places in the code. - **Use of subroutines/procedures/functions/modularity** (1 mark): To break down a long program into smaller, manageable, and reusable parts.
*(Accept any four unique and valid practices with a brief explanation of how they aid readability/maintenance. Do not award marks for simply naming the practice without a brief explanation or context of how it helps.)*
FOR i <- 1 TO 6 Current <- Data[i] IF Current > Limit THEN IF Current = Data[i+1] THEN DupCount <- DupCount + 1 ELSE Limit <- Limit + 2 ENDIF ENDIF NEXT i
OUTPUT DupCount, Limit ```
Complete the trace table for the given algorithm. Do not write any variable values that do not change on a given step.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
To trace the algorithm step-by-step:
1. **Initialization**: - `Limit` is initialized to `10`. - `DupCount` is initialized to `0`.
2. **Loop iteration i = 1**: - `Current` is `Data[1]` which is `12`. - `Current > Limit` (12 > 10) is TRUE. - `Current = Data[2]` (12 = 15) is FALSE. This executes the `ELSE` block. - `Limit` is updated to `Limit + 2` = `12`.
3. **Loop iteration i = 2**: - `Current` is `Data[2]` which is `15`. - `Current > Limit` (15 > 12) is TRUE. - `Current = Data[3]` (15 = 15) is TRUE. This executes the `IF` block. - `DupCount` is updated to `DupCount + 1` = `1`.
4. **Loop iteration i = 3**: - `Current` is `Data[3]` which is `15`. - `Current > Limit` (15 > 12) is TRUE. - `Current = Data[4]` (15 = 8) is FALSE. This executes the `ELSE` block. - `Limit` is updated to `Limit + 2` = `14`.
5. **Loop iteration i = 4**: - `Current` is `Data[4]` which is `8`. - `Current > Limit` (8 > 14) is FALSE. No variables are updated.
6. **Loop iteration i = 5**: - `Current` is `Data[5]` which is `18`. - `Current > Limit` (18 > 14) is TRUE. - `Current = Data[6]` (18 = 18) is TRUE. - `DupCount` is updated to `DupCount + 1` = `2`.
7. **Loop iteration i = 6**: - `Current` is `Data[6]` which is `18`. - `Current > Limit` (18 > 14) is TRUE. - `Current = Data[7]` (18 = 10) is FALSE. - `Limit` is updated to `Limit + 2` = `16`.
8. **Post-loop**: - Output is printed as: `2, 16`.
PastPaper.markingScheme
1 mark per correct row/aspect in the trace table, up to a maximum of 7 marks: - 1 mark: Correct initial values for Limit (10) and DupCount (0). - 1 mark: Correct values for i=1 (Current = 12, Limit = 12). - 1 mark: Correct values for i=2 (Current = 15, DupCount = 1). - 1 mark: Correct values for i=3 (Current = 15, Limit = 14). - 1 mark: Correct values for i=4 (Current = 8, other columns blank/unchanged). - 1 mark: Correct values for i=5 (Current = 18, DupCount = 2) and i=6 (Current = 18, Limit = 16). - 1 mark: Correct final output displayed as '2, 16' (or both numbers correctly printed in the output column).
PastPaper.question 9 · short-answer
5 PastPaper.marks
The following pseudocode segment uses built-in string manipulation functions:
FirstName ← "Alexander" LastName ← "Smith" Year ← "2008"
Note: - SUBSTRING(String, Start, Length) uses 1-based indexing (the first character is at position 1). - The operator & is used to concatenate strings.
Answer the following questions: (a) State the value stored in Code1. [1] (b) State the value stored in Code2. [1] (c) State the value stored in Code3. [1] (d) State the value stored in MemberID. [1] (e) Explain why the LENGTH function is used in the expression for Code2 instead of a fixed number. [1]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
(a) SUBSTRING("Alexander", 1, 3) yields "Ale". Applying UCASE results in "ALE". (b) LENGTH("Smith") is 5. 5 - 2 = 3. SUBSTRING("Smith", 3, 3) starting at position 3 extracts "ith". Applying LCASE results in "ith". (c) SUBSTRING("2008", 3, 2) yields the 2 characters starting at position 3, which is "08". (d) Concatenating "ALE", "ith", and "08" results in "ALEith08". (e) The use of LENGTH(LastName) - 2 dynamically calculates the starting index relative to the end of the string. This ensures that the code always extracts the last three characters of any last name, making the algorithm robust for surnames of different lengths.
PastPaper.markingScheme
1 mark for each correct answer: (a) "ALE" (Accept ALE with or without quotation marks. Reject lowercase or mixed case.) (b) "ith" (Accept ith with or without quotation marks. Reject uppercase or mixed case.) (c) "08" (Accept 08 with or without quotation marks. Reject 8.) (d) "ALEith08" (Accept ALEith08 with or without quotation marks. Must match the exact concatenation of answers from a, b, and c.) (e) 1 mark for any of the following explanations: - To allow the algorithm to work with last names of any length / make it dynamic. - To ensure it always extracts the final 3 characters of the surname. - If a fixed number was used, it would only work for names of length 5.
PastPaper.question 10 · Logic gate schematic and truth table
8 PastPaper.marks
An automated industrial furnace uses a safety system to trigger an alarm (X). The system monitors three inputs: • Temperature (T), where 1 represents high temperature and 0 represents normal temperature. • Pressure (P), where 1 represents high pressure and 0 represents normal pressure. • Exhaust Valve status (V), where 1 represents open and 0 represents closed.
The alarm (X) is active (1) if: Temperature is high AND Pressure is NOT high OR Pressure is high AND Exhaust Valve is NOT open.
Part (a): Write a Boolean expression to represent this safety system. Use the inputs T, P, V and the logical operators: AND, OR, NOT. [4 marks]
Part (b): Complete the truth table below for this safety system. [4 marks]
TPVT AND NOT PP AND NOT VX000 001 010 011 100 101 110 111
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
Part (a): The Boolean expression is: X = (T AND NOT P) OR (P AND NOT V) Accept alternative notation such as: X = (T • P̅) + (P • V̅) or equivalent logic notation.
Part (b): Complete Truth Table: TPVT AND NOT PP AND NOT VX000000001000010011011000100101101101110011111000
PastPaper.markingScheme
Part (a): Boolean Expression [Max 4 marks] • 1 mark for correct first term: T AND NOT P (or equivalent) • 1 mark for correct second term: P AND NOT V (or equivalent) • 1 mark for OR operator linking the two terms • 1 mark for correct overall expression matching output X = ... (brackets are not required but highly encouraged for clarity; ignore minor spelling of operators if intention is clear, but do not accept NAND/NOR in place of AND/NOT)
Part (b): Truth Table [Max 4 marks] • 1 mark for complete correct column 'T AND NOT P' (values: 0, 0, 0, 0, 1, 1, 0, 0) • 1 mark for complete correct column 'P AND NOT V' (values: 0, 0, 1, 0, 0, 0, 1, 0) • 2 marks for complete correct column 'X' (values: 0, 0, 1, 0, 1, 1, 1, 0). Give 1 mark if 6 or 7 rows are correct for column 'X'.
PastPaper.question 11 · short_answer
8 PastPaper.marks
A space agency uses a relational database to store details about its spacecraft, astronauts, and launches.
Two tables in the database are: - SPACECRAFT with fields: SpacecraftID, CraftName, CrewCapacity, Status - ASTRONAUT with fields: AstronautID, LastName, FirstName, Nationality, SpacecraftID
(a) (i) State the relationship between the SPACECRAFT table and the ASTRONAUT table. [1] (ii) Identify the field in the ASTRONAUT table that acts as a foreign key. [1]
(b) Another table, LAUNCH_LOG, is used to keep track of satellite deployments. It has the following fields: - LaunchID (Primary Key) - PayloadName - MassKG - Orbit - Success (Boolean: TRUE or FALSE)
Write an SQL query to display the PayloadName and MassKG of all payloads that have a MassKG greater than 5000, an Orbit of 'LEO', and where Success is TRUE. The results must be ordered by MassKG from heaviest to lightest. [4]
(c) Write an SQL query using the LAUNCH_LOG table to count the total number of launches where the target Orbit is 'LEO'. [2]
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
(a) (i) One-to-many (or 1:M). One spacecraft can carry many astronauts, but each astronaut is assigned to exactly one spacecraft. (ii) SpacecraftID is the foreign key because it links the ASTRONAUT table to the primary key of the SPACECRAFT table.
(b) The SQL query needs to retrieve 'PayloadName' and 'MassKG', filter on the three conditions using AND operators, and order the results in descending order by mass: SELECT PayloadName, MassKG FROM LAUNCH_LOG WHERE MassKG > 5000 AND Orbit = 'LEO' AND Success = TRUE ORDER BY MassKG DESC;
(c) To count the number of matching records, the COUNT() function can be applied to the primary key (LaunchID) or used as COUNT(*): SELECT COUNT(LaunchID) FROM LAUNCH_LOG WHERE Orbit = 'LEO';
PastPaper.markingScheme
(a) (i) - 1 mark for stating: One-to-many / 1-to-many / 1:M
(a) (ii) - 1 mark for identifying: SpacecraftID (case-insensitive)
(b) - 1 mark: SELECT PayloadName, MassKG FROM LAUNCH_LOG (both fields present, correct table name) - 1 mark: WHERE MassKG > 5000 - 1 mark: AND Orbit = 'LEO' AND Success = TRUE (accept single/double quotes, accept "Success = TRUE" or "Success") - 1 mark: ORDER BY MassKG DESC (both field name and DESC are required for the mark)
(c) - 1 mark: SELECT COUNT(LaunchID) OR SELECT COUNT(*) FROM LAUNCH_LOG - 1 mark: WHERE Orbit = 'LEO' (correct filter condition)
PastPaper.question 12 · practical
15 PastPaper.marks
A parcel delivery company needs a program to process and analyze the packages dispatched in a single day. The program is required to process data for exactly 50 packages.
Write an algorithm in pseudocode that meets the following requirements: 1. Inputs and validates the following details for each package: - PackageID: must be exactly 6 characters long and must start with the letter 'P' - Weight: must be a real number between 0.5 and 25.0 kg inclusive - Distance: must be an integer between 1 and 500 km inclusive 2. Stores the validated PackageID, Weight, and Distance into three separate 1D arrays. 3. Calculates the delivery cost for each package using the formula: Cost = 5.00 + (Weight * 2.00) + (Distance * 0.80) 4. Calculates and outputs: - The total delivery cost for all 50 packages - The PackageID of the package with the highest delivery cost (you may assume all delivery costs are unique) - The average weight of all 50 packages
Use pseudocode or program code. Declare all variables and arrays used with appropriate data types.
PastPaper.showAnswersPastPaper.hideAnswers
PastPaper.workedSolution
A standard solution written in Cambridge IGCSE pseudocode:
``` DECLARE IDArray : ARRAY[1:50] OF STRING DECLARE WeightArray : ARRAY[1:50] OF REAL DECLARE DistanceArray : ARRAY[1:50] OF INTEGER
DECLARE PackageID : STRING DECLARE Weight : REAL DECLARE Distance : INTEGER DECLARE Cost, TotalCost, HighestCost, TotalWeight, AverageWeight : REAL DECLARE HighestID : STRING DECLARE I : INTEGER
FOR I <- 1 TO 50 REPEAT OUTPUT "Enter Package ID (6 chars, starts with P): " INPUT PackageID UNTIL LENGTH(PackageID) = 6 AND SUBSTRING(PackageID, 1, 1) = "P" IDArray[I] <- PackageID
REPEAT OUTPUT "Enter Weight (0.5 to 25.0 kg): " INPUT Weight UNTIL Weight >= 0.5 AND Weight <= 25.0 WeightArray[I] <- Weight TotalWeight <- TotalWeight + Weight
REPEAT OUTPUT "Enter Distance (1 to 500 km): " INPUT Distance UNTIL Distance >= 1 AND Distance <= 500 DistanceArray[I] <- Distance NEXT I
FOR I <- 1 TO 50 Cost <- 5.00 + (WeightArray[I] * 2.00) + (DistanceArray[I] * 0.80) TotalCost <- TotalCost + Cost
IF Cost > HighestCost THEN HighestCost <- Cost HighestID <- IDArray[I] ENDIF NEXT I
Award marks for any of the following points, up to a maximum of 15:
* **Declarations & Initialization (Max 3 marks)**: - 1 mark: Declaring 3 arrays of size 50 with correct names and data types (String, Real/Float, Integer). - 1 mark: Declaring variables with appropriate names and data types. - 1 mark: Initializing accumulator variables (e.g. TotalCost, TotalWeight) to 0, and HighestCost to a low value (e.g. -1).
* **Input and Validation Loops (Max 5 marks)**: - 1 mark: Loop set up to run 50 times (e.g., FOR I <- 1 TO 50). - 1 mark: Input and validation loop for PackageID checking length = 6 AND first letter is 'P'. - 1 mark: Input and validation loop for Weight checking range 0.5 to 25.0 inclusive. - 1 mark: Input and validation loop for Distance checking range 1 to 500 inclusive. - 1 mark: Validated inputs correctly stored in respective arrays inside the loop using index variable I.
* **Calculations & Logic (Max 5 marks)**: - 1 mark: Correct calculation of the delivery cost for each package using the specified formula (Cost = 5.00 + Weight * 2.00 + Distance * 0.80). - 1 mark: Accumulating the calculated cost of each package to find the total cost of all deliveries. - 1 mark: Accumulating the weight of all packages to find the sum of weights. - 1 mark: Correct conditional test (e.g., IF Cost > HighestCost) to identify the highest cost package. - 1 mark: Saving the corresponding PackageID when a new highest cost is found.
* **Calculations and Output (Max 2 marks)**: - 1 mark: Calculating the correct average weight of the packages after the loop (TotalWeight / 50). - 1 mark: Outputting the total cost, average weight, and highest-cost PackageID with appropriate and user-friendly messages.