Cambridge IGCSE · thinka-original Practice Paper

2024 Cambridge IGCSE Computer Science (0478) Practice Paper with Answers

Thinka Nov 2024 (V2) Cambridge IGCSE-Style Mock — Computer Science (0478)

150 marks210 mins2024
An original Thinka practice paper modelled on the structure and difficulty of the Nov 2024 (V2) Cambridge IGCSE Computer Science (0478) paper. Not affiliated with or reproduced from Cambridge.

Paper 1 Computer Systems

Answer all questions. Calculators must not be used. Total mark is 75.
28 Question · 71.79999999999998 marks
Question 1 · Short Answer Theory
2 marks
State what is meant by an overflow error in binary addition and explain why it occurs in a computer register.
Show answer & marking scheme

Worked solution

An overflow error happens when a mathematical operation yields a number that requires more bits than the storage system can hold. Because computer registers have a fixed length (for example, 8 bits), any carry-over into a non-existent 9th bit is discarded, which results in an incorrect and often much smaller value being stored.

Marking scheme

1 mark: Definition of an overflow error (result too large to be stored in the allocated number of bits).
1 mark: Explanation of why it occurs (fixed size/width of the register / the carry bit is discarded or has no place to go).
Question 2 · Short Answer Theory
2 marks
Identify and describe one benefit and one drawback of using parallel data transmission compared to serial data transmission.
Show answer & marking scheme

Worked solution

Parallel data transmission sends multiple bits simultaneously down several wires. This provides high speed (benefit) but makes it highly susceptible to data skewing and crosstalk over longer distances, as well as increasing manufacturing costs (drawback).

Marking scheme

1 mark: Benefit (e.g., faster rate of transfer / multiple bits sent at once).
1 mark: Drawback (e.g., higher cost of cabling / risk of data skewing / crosstalk over longer distances).
Question 3 · Short Answer Theory
2 marks
State the purpose of the Program Counter (PC) in the Von Neumann architecture during the fetch-decode-execute cycle.
Show answer & marking scheme

Worked solution

The main purpose of the Program Counter (PC) is to track the execution flow of programs. It stores the address of the next instruction that the CPU needs to retrieve from primary memory. Once that address is sent to the Memory Address Register (MAR), the PC is updated/incremented.

Marking scheme

1 mark: Stores/holds the address of the next instruction to be fetched.
1 mark: Automatically incremented/updated to point to the next instruction in sequence.
Question 4 · Short Answer Theory
2 marks
Explain the purpose of an interrupt in a computer system.
Show answer & marking scheme

Worked solution

Interrupts allow a computer system to respond to external events dynamically. For example, when a printer runs out of paper or a user presses a key, an interrupt signal tells the CPU to pause what it is doing, run code to handle the event, and then resume the original program.

Marking scheme

1 mark: Signal sent to the CPU (by hardware/software) to suspend the current task/request immediate attention.
1 mark: Allows the CPU to respond to urgent/asynchronous events or manage multitasking efficiently.
Question 5 · Short Answer Theory
2 marks
Describe how the sampling rate and the sample resolution affect the quality and file size of a recorded sound file.
Show answer & marking scheme

Worked solution

A higher sampling rate means more sound snapshots are taken per second, and a higher resolution means more bits are used to represent each snapshot. Combined, they yield a sound output that closely matches the original audio (higher quality) but drastically increase the volume of digital data stored (larger file size).

Marking scheme

1 mark: Effect on quality (higher rate/resolution results in a more realistic/accurate reproduction of the analogue sound).
1 mark: Effect on file size (higher rate/resolution requires storing more bits/samples per second, increasing file size).
Question 6 · Short Answer Theory
2 marks
Describe how a checksum is used to detect errors during data transmission.
Show answer & marking scheme

Worked solution

A checksum acts as a cryptographic or mathematical signature of a data block. By running the identical calculation at both ends of a transmission, the receiving system can verify if any of the bits changed during transit. A discrepancy between the calculated checksum and the received checksum triggers an error response.

Marking scheme

1 mark: Sender calculates checksum using an algorithm on the data block and sends it with the data.
1 mark: Receiver recalculates the checksum and compares it; any difference indicates an error has occurred.
Question 7 · Short Answer Theory
2 marks
Explain the difference between narrow AI (weak AI) and general AI (strong AI).
Show answer & marking scheme

Worked solution

Narrow AI excels in a limited, specialized domain (e.g., self-driving navigation or recommendation algorithms). General AI refers to a system with broad cognitive abilities that can mimic human understanding, reasoning, and learning across different, unrelated subjects without being reprogrammed.

Marking scheme

1 mark: Explanation of Narrow AI (focused on one specific task / cannot generalize).
1 mark: Explanation of General AI (broad intellectual capacity / able to solve various unfamiliar tasks / human-level intelligence).
Question 8 · Short Answer Theory
2 marks
Explain how a resistive touchscreen operates to register a user's touch.
Show answer & marking scheme

Worked solution

Resistive touch screens rely on physical pressure. The screen is composed of a flexible top layer and a rigid bottom layer, both coated with a conductive material. Pressing the screen pushes the layers together, causing an electrical current to flow at the point of contact. The controller detects this change in resistance and determines the precise coordinates.

Marking scheme

1 mark: Mention of two conductive/resistive layers separated by a thin gap/spacer dots.
1 mark: Pressure causes the layers to touch, completing a circuit / changing resistance to calculate touch coordinates.
Question 9 · Short Answer Theory
2 marks
An interrupt is a signal sent to the processor. State two different events that would generate a hardware-related interrupt.
Show answer & marking scheme

Worked solution

1. A peripheral device requires attention, such as a printer running out of paper or a user pressing a key on a keyboard. 2. A critical hardware system error occurs, such as a hard disk failure or power loss warning.

Marking scheme

One mark for each correct hardware event, up to a maximum of two marks. Accept: keyboard key press, mouse click, printer out of paper, power failure, hardware malfunction. Reject: software errors such as division by zero, or general software crashes.
Question 10 · Short Answer Theory
2 marks
An image file is stored as a bitmap. Explain how a computer system represents a bitmap image.
Show answer & marking scheme

Worked solution

A bitmap image is broken down into a grid of small squares known as pixels. The colour of each individual pixel is stored as a specific sequence of binary bits, where the number of bits per pixel depends on the colour depth of the image.

Marking scheme

One mark for stating that the image is made up of a grid/matrix of pixels. One mark for explaining that each pixel has a binary value representing its colour.
Question 11 · Short Answer Theory
2 marks
Describe the role of the Memory Data Register (MDR) during the fetch stage of the Fetch-Decode-Execute cycle.
Show answer & marking scheme

Worked solution

When the CPU fetches an instruction, it retrieves the instruction from the RAM address located in the MAR. This fetched instruction is loaded into the MDR. The MDR then transfers this instruction to the Current Instruction Register (CIR) so that it can be decoded.

Marking scheme

One mark for stating that the MDR receives/stores the instruction copied from the address in RAM. One mark for stating that it passes the fetched instruction to the Current Instruction Register (CIR).
Question 12 · Short Answer Theory
2 marks
State two reasons why computer scientists use hexadecimal instead of binary to represent data.
Show answer & marking scheme

Worked solution

1. Hexadecimal is much more compact than binary, allowing long strings of bits to be represented in just a few characters, which is easier for human programmers to read. 2. The shorter length significantly reduces the likelihood of typing or copying errors when entering data manually.

Marking scheme

One mark per valid reason (max two marks). Accept: Easier/quicker for humans to read/write/type, less likely to make errors when copying/inputting, easier to debug. Reject: takes up less memory, processes faster.
Question 13 · Short Answer Theory
2 marks
Explain how a checksum is used to detect transmission errors in a block of data.
Show answer & marking scheme

Worked solution

Before transmission, the sender calculates a checksum value from the data using a specific mathematical algorithm. This value is transmitted alongside the data block. Upon receipt, the receiver runs the same algorithm on the received data. If the calculated checksum does not match the received checksum, an error is detected and a request for retransmission is made.

Marking scheme

One mark for stating that the sender calculates and transmits a checksum with the data. One mark for explaining that the receiver recalculates the checksum and compares it, with a mismatch indicating an error.
Question 14 · Short Answer Theory
2 marks
Explain how a firewall helps to secure a local network.
Show answer & marking scheme

Worked solution

A firewall sits between a local network and an external network. It acts as a filter by constantly monitoring all incoming and outgoing data packets. It compares these packets against a set of pre-defined security rules and blocks any traffic that does not meet the criteria, preventing unauthorized access.

Marking scheme

One mark for stating that it inspects/monitors incoming and outgoing network traffic. One mark for explaining that it blocks traffic that does not meet the pre-defined security rules/criteria.
Question 15 · Calculation / Representation
2.5 marks
A sound recording has a duration of 32 seconds. It is captured with a sample rate of 16,000 Hz and a sample resolution of 16 bits. Calculate the file size of the recording in kibibytes (KiB). Show your working.
Show answer & marking scheme

Worked solution

Step 1: Calculate total bytes.
File size = Duration (s) * Sample rate (Hz) * (Sample resolution (bits) / 8)
File size = 32 * 16,000 * (16 / 8)
File size = 32 * 16,000 * 2 = 1,024,000 bytes.

Step 2: Convert bytes to kibibytes (KiB).
1 KiB = 1024 bytes.
File size in KiB = 1,024,000 / 1024 = 1000 KiB.

Marking scheme

1 mark for calculating the correct number of bytes (1,024,000 bytes) or bits (8,192,000 bits).
1 mark for dividing the total by 1024 (or 8 then 1024).
0.5 marks for the correct final answer (1000 KiB).
Question 16 · Calculation / Representation
2.5 marks
An image file is 512 pixels wide and 256 pixels high. It uses a colour depth of 24 bits. Calculate the file size of this image in kibibytes (KiB). Show your working.
Show answer & marking scheme

Worked solution

Step 1: Calculate the total number of pixels.
Total pixels = 512 * 256 = 131,072 pixels.

Step 2: Calculate file size in bytes.
Since colour depth is 24 bits, each pixel uses 24 bits / 8 = 3 bytes.
File size in bytes = 131,072 * 3 = 393,216 bytes.

Step 3: Convert bytes to KiB.
File size in KiB = 393,216 / 1024 = 384 KiB.

Marking scheme

1 mark for calculating the correct size in bytes (393,216 bytes) or bits (3,145,728 bits).
1 mark for showing division by 1024.
0.5 marks for the correct final answer (384 KiB).
Question 17 · Calculation / Representation
2.5 marks
A network address uses the hexadecimal value C4. Convert this hexadecimal value into an 8-bit binary register. Show your working.
Show answer & marking scheme

Worked solution

Step 1: Convert the first hex digit 'C' (denary 12) to 4-bit binary.
12 in binary = 1100.

Step 2: Convert the second hex digit '4' to 4-bit binary.
4 in binary = 0100.

Step 3: Combine both nibbles together.
C4 = 11000100.

Marking scheme

1 mark for correctly converting C to 1100.
1 mark for correctly converting 4 to 0100.
0.5 marks for combining them to form the correct 8-bit register (11000100).
Question 18 · Calculation / Representation
2.5 marks
Represent the denary number -83 as an 8-bit binary integer using two's complement representation. Show your working.
Show answer & marking scheme

Worked solution

Step 1: Represent positive 83 in binary.
83 = 64 + 16 + 2 + 1 = 01010011.

Step 2: Invert all the bits (one's complement).
01010011 becomes 10101100.

Step 3: Add 1 to the result.
10101100 + 1 = 10101101.

Marking scheme

1 mark for representing +83 in binary (01010011).
1 mark for inverting the bits (10101100).
0.5 marks for adding 1 to obtain the correct final answer (10101101).
Question 19 · Calculation / Representation
2.5 marks
An 8-bit register contains the binary pattern 00111100. Perform a logical right shift of 3 places on this register. State the resulting binary pattern and its denary value.
Show answer & marking scheme

Worked solution

Step 1: Shift all bits to the right by 3 positions, filling the empty positions on the left with 0s.
00111100 shifted right by 3 becomes 00000111.

Step 2: Convert the shifted binary pattern to denary.
00000111 = 4 + 2 + 1 = 7.

Marking scheme

1 mark for the correct shifted binary pattern (00000111).
1 mark for the correct denary value of 7.
0.5 marks for showing the shifting process / placeholder zeros.
Question 20 · Calculation / Representation
2.5 marks
A system uses a simple modulo 256 checksum to verify transmitted data. A block of data consists of the four denary values: 105, 87, 42, 112. Calculate the checksum value that will be transmitted. Show your working.
Show answer & marking scheme

Worked solution

Step 1: Add all the data values together.
Sum = 105 + 87 + 42 + 112 = 346.

Step 2: Perform modulo 256 division on the sum.
346 / 256 = 1 remainder 90.
Therefore, Checksum = 90.

Marking scheme

1 mark for correctly summing the values to 346.
1 mark for performing the modulo 256 calculation.
0.5 marks for the correct final checksum value of 90.
Question 21 · Calculation / Representation
2.5 marks
Convert the hexadecimal number 2A5 into a denary value. Show your working.
Show answer & marking scheme

Worked solution

Step 1: Determine the place values for each digit.
Place values: 16^2 = 256, 16^1 = 16, 16^0 = 1.

Step 2: Multiply each digit by its place value.
2 * 256 = 512
A (10) * 16 = 160
5 * 1 = 5

Step 3: Add the values together.
Total = 512 + 160 + 5 = 677.

Marking scheme

1 mark for identifying place values and multiplying (e.g. 2 * 256 and 10 * 16).
1 mark for correct intermediate terms (512 and 160).
0.5 marks for the correct final denary value of 677.
Question 22 · Calculation / Representation
2.5 marks
A digital media file has a size of 4 Megabytes (MB). It is to be transmitted over a network with a constant speed of 8 Megabits per second (Mbps). Calculate the time, in seconds, it will take to transmit the file. Show your working.
Show answer & marking scheme

Worked solution

Step 1: Convert the file size from Megabytes to Megabits.
Since 1 Byte = 8 bits, 4 MB = 4 * 8 = 32 Megabits (Mb).

Step 2: Calculate the transmission time.
Time = File size (Mb) / Transmission speed (Mbps)
Time = 32 Mb / 8 Mbps = 4 seconds.

Marking scheme

1 mark for converting file size to Megabits (32 Mb) or converting transmission speed to Megabytes per second (1 MB/s).
1 mark for showing division of size by speed.
0.5 marks for the correct final answer of 4 seconds.
Question 23 · Diagram / Table
5 marks
A central processing unit (CPU) contains many different internal registers and components.

Complete the table by giving the missing component names and descriptions.

| Component name | Description |
| :--- | :--- |
| Memory Address Register (MAR) | **(i)** ......................................................................................................... |
| **(ii)** ......................................... | Decodes instructions and controls the flow of data through the CPU |
| Accumulator (ACC) | **(iii)** ....................................................................................................... |
| **(iv)** ......................................... | Stores data fetched from memory or data waiting to be written to memory |
| Program Counter (PC) | **(v)** ......................................................................................................... |
Show answer & marking scheme

Worked solution

During the fetch-decode-execute cycle, each register and component has a distinct role:
- **MAR**: Holds the address of the current memory location being accessed.
- **Control Unit**: Manages the CPU cycles and decodes instructions.
- **Accumulator**: Temporarily holds calculation results from the ALU.
- **MDR**: Temporarily holds data fetched from or about to be written to memory.
- **Program Counter**: Points to the address of the next instruction to be executed.

Marking scheme

1 mark for each correct component/description:
- **(i)** Stores the address of the memory location currently being read from / written to (1 mark)
- **(ii)** Control Unit / CU (1 mark)
- **(iii)** Stores the results of calculations / operations performed by the ALU / temporarily holds output from latest operation (1 mark)
- **(iv)** Memory Data Register / MDR (Accept: Memory Buffer Register / MBR) (1 mark)
- **(v)** Stores the address of the next instruction to be fetched (1 mark)
Question 24 · Diagram / Table
5 marks
A transmission uses even parity. A block of data is received as shown in the table:

| | Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Parity Bit |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| **Byte 1** | 1 | 0 | 1 | 1 | 0 | 0 | 1 | 0 |
| **Byte 2** | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
| **Byte 3** | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
| **Byte 4** | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 |
| **Parity Byte** | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 |

(a) Identify the row number and column name of the corrupted bit.

(b) State the corrected Byte 4 in binary (including the parity bit).

(c) Explain how a parity block check is used to detect and correct a single-bit error during transmission.
Show answer & marking scheme

Worked solution

(a) Calculating even parity for each row:
- Byte 1: 4 ones (even) - Correct
- Byte 2: 4 ones (even) - Correct
- Byte 3: 4 ones (even) - Correct
- Byte 4: 5 ones (odd) - Error in Byte 4

Calculating even parity for each column:
- Bit 7: 2 ones (even) - Correct
- Bit 6: 2 ones (even) - Correct
- Bit 5: 4 ones (even) - Correct
- Bit 4: 2 ones (even) - Correct
- Bit 3: 2 ones (even) - Correct
- Bit 2: 3 ones (odd) - Error in Bit 2
- Bit 1: 2 ones (even) - Correct
- Parity Bit: 2 ones (even) - Correct

Thus, the corrupted bit is in **Byte 4**, column **Bit 2**.

(b) The received Byte 4 is `00101111`. Since Bit 2 is corrupted (received as 1), the corrected bit is 0. The corrected Byte 4 is `00101011`.

(c) By performing both row (horizontal) and column (vertical) parity checks, a two-dimensional grid is validated. A single error triggers a parity violation in exactly one row and one column. The intersection uniquely identifies the bit, allowing it to be corrected automatically by flipping its binary state.

Marking scheme

(a) 2 marks:
- 1 mark for Row: Byte 4
- 1 mark for Column: Bit 2

(b) 1 mark:
- 1 mark for 00101011 (or 0 0 1 0 1 0 1 1)

(c) 2 marks:
- 1 mark for stating that parity is calculated horizontally and vertically (row and column) / a parity byte is transmitted.
- 1 mark for stating that the intersection of the erroneous row and column pinpoints the error / the bit is flipped to correct it.
Question 25 · Diagram / Table
6 marks
Consider the logic expression:

$$\mathbf{X = (A \text{ AND } B) \text{ NOR } (B \text{ XOR } C)}$$

(a) Complete the truth table for the given logic expression.

| A | B | C | Working space | X |
| :---: | :---: | :---: | :--- | :---: |
| 0 | 0 | 0 | | |
| 0 | 0 | 1 | | |
| 0 | 1 | 0 | | |
| 0 | 1 | 1 | | |
| 1 | 0 | 0 | | |
| 1 | 0 | 1 | | |
| 1 | 1 | 0 | | |
| 1 | 1 | 1 | | |

(b) (i) State the name of a logic gate that has the same output truth table as the expression: $$\text{NOT (A OR B)}$$

(ii) State the name of a logic gate that produces a logic high output (1) only when its two inputs are different.
Show answer & marking scheme

Worked solution

(a) Let's evaluate step-by-step:
- Row 1: A=0, B=0, C=0. A AND B = 0, B XOR C = 0. 0 NOR 0 = 1.
- Row 2: A=0, B=0, C=1. A AND B = 0, B XOR C = 1. 0 NOR 1 = 0.
- Row 3: A=0, B=1, C=0. A AND B = 0, B XOR C = 1. 0 NOR 1 = 0.
- Row 4: A=0, B=1, C=1. A AND B = 0, B XOR C = 0. 0 NOR 0 = 1.
- Row 5: A=1, B=0, C=0. A AND B = 0, B XOR C = 0. 0 NOR 0 = 1.
- Row 6: A=1, B=0, C=1. A AND B = 0, B XOR C = 1. 0 NOR 1 = 0.
- Row 7: A=1, B=1, C=0. A AND B = 1, B XOR C = 1. 1 NOR 1 = 0.
- Row 8: A=1, B=1, C=1. A AND B = 1, B XOR C = 0. 1 NOR 0 = 0.

Outputs are: 1, 0, 0, 1, 1, 0, 0, 0.

(b) (i) NOT (A OR B) is the logical equivalent of a NOR gate.
(ii) A gate that outputs 1 only when inputs are different (one is 1, the other is 0) is an Exclusive-OR (XOR) gate.

Marking scheme

(a) 4 marks:
- 4 marks for 8 correct outputs (1, 0, 0, 1, 1, 0, 0, 0)
- 3 marks for 6 or 7 correct outputs
- 2 marks for 4 or 5 correct outputs
- 1 mark for 2 or 3 correct outputs

(b) 2 marks:
- (i) 1 mark for NOR
- (ii) 1 mark for XOR
Question 26 · multiple_choice
2.6 marks
A digital image has a resolution of 1024 by 512 pixels. The image is saved using a color depth of 8 bits (1 byte) per pixel. Calculate the file size of this image in kibibytes (KiB).
  1. A.512 KiB
  2. B.1024 KiB
  3. C.256 KiB
  4. D.4096 KiB
Show answer & marking scheme

Worked solution

1. Find the total number of pixels in the image: \(1024 \times 512 = 524,288\) pixels. 2. Since each pixel requires 8 bits of storage, which is equal to 1 byte, the total size in bytes is: \(524,288 \times 1 = 524,288\) bytes. 3. Convert bytes to kibibytes (KiB) by dividing by 1024: \(524,288 / 1024 = 512\) KiB.

Marking scheme

1 mark for calculating total pixels of the image (1024 x 512 = 524,288 pixels); 1 mark for converting to bytes (8 bits = 1 byte); 0.6 marks for dividing by 1024 to get 512 KiB.
Question 27 · multiple_choice
2.6 marks
During the fetch stage of the fetch-decode-execute cycle in the Von Neumann architecture, several registers are used to retrieve an instruction from memory. Which sequence of operations correctly describes this process?
  1. A.The address in the Program Counter (PC) is copied to the Memory Address Register (MAR). The instruction is loaded into the Memory Data Register (MDR), and then copied to the Current Instruction Register (CIR).
  2. B.The address in the Memory Address Register (MAR) is copied to the Program Counter (PC). The instruction is loaded into the Accumulator (ACC), and then copied to the Current Instruction Register (CIR).
  3. C.The address in the Current Instruction Register (CIR) is copied to the Memory Address Register (MAR). The instruction is loaded into the Program Counter (PC), and then copied to the Memory Data Register (MDR).
  4. D.The address in the Program Counter (PC) is copied to the Accumulator (ACC). The instruction is loaded into the Memory Address Register (MAR), and then copied to the Memory Data Register (MDR).
Show answer & marking scheme

Worked solution

At the start of the fetch cycle, the address of the next instruction is copied from the Program Counter (PC) to the Memory Address Register (MAR). The instruction at that address is then read from memory and placed into the Memory Data Register (MDR). Finally, the instruction is copied from the MDR to the Current Instruction Register (CIR) for decoding.

Marking scheme

1 mark for identifying PC to MAR transfer; 1 mark for instruction loaded into MDR; 0.6 marks for transfer from MDR to CIR.
Question 28 · multiple_choice
2.6 marks
A system uses odd parity to transmit 8-bit binary numbers. Which of the following bytes has been received with a transmission error?
  1. A.10110010
  2. B.11010110
  3. C.00111000
  4. D.11111110
Show answer & marking scheme

Worked solution

Under odd parity, the total number of 1s in a correctly received byte must be odd. Let's count the number of 1s in each option: Option A has four 1s (even), Option B has five 1s (odd), Option C has three 1s (odd), Option D has seven 1s (odd). Since Option A contains an even number of 1s, it must have been corrupted during transmission.

Marking scheme

1 mark for explaining that odd parity requires an odd number of 1-bits; 1 mark for analyzing correct bytes (B, C, D); 0.6 marks for identifying A as having an even number of 1-bits (4 ones) and thus indicating an error.

Ready to test yourself?

Turn these notes into exam-style practice. Get unlimited AI questions on this topic with instant marking and explanations.

Practice This Topic

Paper 2 Algorithms, Programming and Logic

Answer all questions. Calculators must not be used. Total mark is 75.
19 Question · 72 marks
Question 1 · Short Answer
3 marks
Explain the term decomposition in the context of designing computer systems. State one benefit of using decomposition.
Show answer & marking scheme

Worked solution

Decomposition involves breaking a large problem into smaller sub-problems. This makes the overall system easier to design, implement, and maintain. Benefit: It allows sub-tasks to be allocated to different members of a programming team.

Marking scheme

1 mark for definition of decomposition (breaking a complex problem into smaller/sub-problems). 1 mark for expansion (sub-problems can be solved/developed/tested individually). 1 mark for a valid benefit (e.g., enables team collaboration, easier debugging/testing, promotes code reusability).
Question 2 · Short Answer
2 marks
State what is meant by a constant in programming and give one reason why a programmer would choose to use a constant rather than a variable.
Show answer & marking scheme

Worked solution

A constant is an identifier whose associated value cannot be altered during program run-time. Reasons to use it: prevents accidental change of values, makes the program easier to update if the value changes (only need to change it in one place).

Marking scheme

1 mark for definition of constant (value cannot change during program execution). 1 mark for reason (e.g., prevents accidental change of value, improves readability, easier to update in one place).
Question 3 · Short Answer
2 marks
Identify the difference between opening a text file in WRITE mode and opening a text file in APPEND mode.
Show answer & marking scheme

Worked solution

In WRITE mode, if the file already exists, its previous contents are deleted/cleared before writing new data. In APPEND mode, any new data is added to the end of the existing file without altering the existing contents.

Marking scheme

1 mark: explanation of WRITE mode (overwrites/deletes existing data). 1 mark: explanation of APPEND mode (adds/writes to the end of the existing file / keeps old data).
Question 4 · Short Answer
3 marks
Algorithms often include mechanisms to ensure data is correct. Describe the difference between data validation and data verification.
Show answer & marking scheme

Worked solution

Validation checks if the data is sensible/reasonable and follows specific rules before processing. Verification checks if the data has been accurately entered from the source without corruption or keying errors.

Marking scheme

1 mark: Validation checks if data is sensible/valid/within rules (e.g. length check, range check). 1 mark: Verification checks if data has been entered correctly/matches source. 1 mark: Clear comparison or example illustrating the difference (e.g., validation does not check if data is true/accurate, only if it is allowed; verification checks accuracy against the original).
Question 5 · Short Answer
3 marks
Explain the relationship between a primary key and a foreign key in a relational database.
Show answer & marking scheme

Worked solution

A primary key uniquely identifies a row in its own table. When that primary key is included in another table, it acts as a foreign key. This establishes a connection/relationship (often one-to-many) between the two tables.

Marking scheme

1 mark: Primary key uniquely identifies a record in a table. 1 mark: Foreign key is a primary key from one table used in another table. 1 mark: Explaining the link (it creates a relationship/link between the tables).
Question 6 · Short Answer
2 marks
Describe how data is accessed in a two-dimensional (2D) array compared to a one-dimensional (1D) array.
Show answer & marking scheme

Worked solution

A 1D array uses one index, e.g., MyArray[5]. A 2D array uses two indices, e.g., MyArray[2, 3], representing the coordinates (row and column).

Marking scheme

1 mark: 1D array needs one index / subscript (to reference a single line of elements). 1 mark: 2D array needs two indices / subscripts (to reference row and column in a table/grid structure).
Question 7 · Short Answer
3 marks
Explain the main structural difference between a WHILE ... DO ... ENDWHILE loop and a REPEAT ... UNTIL loop.
Show answer & marking scheme

Worked solution

A WHILE loop checks the loop condition before executing the loop body; if the condition is false initially, the loop does not run. A REPEAT loop executes the loop body first and then checks the condition, so it runs at least once. Also, a WHILE loop continues while a condition is true, whereas a REPEAT loop continues until a condition becomes true.

Marking scheme

1 mark: WHILE loop checks condition at the start / REPEAT loop checks condition at the end. 1 mark: WHILE loop can execute zero times / REPEAT loop always executes at least once. 1 mark: WHILE loop continues while the condition is true / REPEAT loop continues until the condition becomes true.
Question 8 · Short Answer
2 marks
State the difference in output between a 2-input OR gate and a 2-input XOR gate when both inputs are high (1).
Show answer & marking scheme

Worked solution

For input values of A = 1 and B = 1: OR outputs 1, XOR outputs 0.

Marking scheme

1 mark: OR gate outputs 1 / High. 1 mark: XOR gate outputs 0 / Low.
Question 9 · dry_run
5 marks
Complete the trace table for the given pseudocode algorithm.

```
DECLARE Count : INTEGER
DECLARE Total : INTEGER
DECLARE Num : INTEGER
DECLARE Divisor : INTEGER

Total <- 0
Count <- 0
REPEAT
INPUT Num
IF Num <> 999
THEN
Divisor <- 2
WHILE (Num MOD Divisor <> 0) AND (Divisor * Divisor <= Num) DO
Divisor <- Divisor + 1
ENDWHILE
IF (Divisor * Divisor > Num) AND (Num > 1)
THEN
Total <- Total + Num
Count <- Count + 1
ENDIF
ENDIF
UNTIL Num = 999 OR Count = 3

OUTPUT Total
```

Input data: 4, 5, 9, 11, 999

Trace table structure:
| Num | Divisor | Total | Count | OUTPUT |
|---|---|---|---|---|
Show answer & marking scheme

Worked solution

Let us trace the execution step-by-step:
1. Initialize Total = 0, Count = 0.
2. Input Num = 4. Divisor = 2. Loop condition (4 MOD 2 <> 0) is False. Divisor * Divisor > Num is 4 > 4 (False). Total and Count remain unchanged.
3. Input Num = 5. Divisor = 2. 5 MOD 2 <> 0 (True) and 4 <= 5 (True). Divisor becomes 3. 5 MOD 3 <> 0 (True) but 9 <= 5 (False). Loop terminates. Divisor * Divisor > Num is 9 > 5 (True). Total becomes 5, Count becomes 1.
4. Input Num = 9. Divisor = 2. 9 MOD 2 <> 0 (True) and 4 <= 9 (True). Divisor becomes 3. 9 MOD 3 <> 0 (False). Loop terminates. Divisor * Divisor > Num is 9 > 9 (False). Total and Count remain unchanged.
5. Input Num = 11. Divisor = 2. Loop cycles Divisor through 3 to 4. Loop terminates because 16 <= 11 is False. Divisor * Divisor > Num is 16 > 11 (True). Total becomes 16, Count becomes 2.
6. Input Num = 999. Condition Num = 999 is met, so the loop terminates.
7. Finally, OUTPUT Total which is 16.

Marking scheme

- 1 mark: Correct initial values of Total and Count (0, 0) in the first row.
- 1 mark: Correct trace of Num = 4 (Divisor gets 2, no change to Total/Count).
- 1 mark: Correct trace of Num = 5 (Divisor gets 2 then 3, Total updated to 5, Count updated to 1).
- 1 mark: Correct trace of Num = 9 (Divisor gets 2 then 3, no change to Total/Count).
- 1 mark: Correct trace of Num = 11, Num = 999, and correct final OUTPUT of 16.
Question 10 · dry_run
4 marks
Complete the trace table for the given pseudocode algorithm.

```
DECLARE Num : INTEGER
DECLARE Temp : INTEGER
DECLARE Result : INTEGER
DECLARE Digit : INTEGER

REPEAT
INPUT Num
IF Num > 0
THEN
Temp <- Num
Result <- 0
WHILE Temp > 0 DO
Digit <- Temp MOD 10
IF Digit MOD 3 = 0
THEN
Result <- Result * 10 + Digit
ENDIF
Temp <- Temp DIV 10
ENDWHILE
IF Result > 0
THEN
OUTPUT Result
ENDIF
ENDIF
UNTIL Num = 0
```

Input data: 365, 409, 12, 0

Trace table structure:
| Num | Temp | Result | Digit | OUTPUT |
|---|---|---|---|---|
Show answer & marking scheme

Worked solution

Let us trace the algorithm step-by-step:
1. Input Num = 365. Temp = 365, Result = 0.
- Digit = 5. MOD 3 check is false. Temp becomes 36.
- Digit = 6. MOD 3 check is true. Result = 0 * 10 + 6 = 6. Temp becomes 3.
- Digit = 3. MOD 3 check is true. Result = 6 * 10 + 3 = 63. Temp becomes 0.
- Result (63) > 0 is True, so OUTPUT 63.
2. Input Num = 409. Temp = 409, Result = 0.
- Digit = 9. MOD 3 check is true. Result = 9. Temp becomes 40.
- Digit = 0. MOD 3 check is true. Result = 9 * 10 + 0 = 90. Temp becomes 4.
- Digit = 4. MOD 3 check is false. Temp becomes 0.
- Result (90) > 0 is True, so OUTPUT 90.
3. Input Num = 12. Temp = 12, Result = 0.
- Digit = 2. MOD 3 check is false. Temp becomes 1.
- Digit = 1. MOD 3 check is false. Temp becomes 0.
- Result remains 0, so no output.
4. Input Num = 0. Loop terminates.

Marking scheme

- 1 mark: Correct trace of variables and OUTPUT (63) for Num = 365.
- 1 mark: Correct trace of variables and OUTPUT (90) for Num = 409.
- 1 mark: Correct trace of variables for Num = 12 (Result remains 0, no output).
- 1 mark: Correct termination of the dry run with Num = 0.
Question 11 · Logic Circuit and Truth Table Diagram
4 marks
Consider the logic expression:

$$Z = (A \text{ AND NOT } B) \text{ OR } (B \text{ XOR } C)$$

Complete the truth table for this logic expression.

| A | B | C | Working space | Z |
|---|---|---|---|---|
| 0 | 0 | 0 | | |
| 0 | 0 | 1 | | |
| 0 | 1 | 0 | | |
| 0 | 1 | 1 | | |
| 1 | 0 | 0 | | |
| 1 | 0 | 1 | | |
| 1 | 1 | 0 | | |
| 1 | 1 | 1 | | |
Show answer & marking scheme

Worked solution

To find the value of Z for each row, we evaluate the expression:

1. For A=0, B=0, C=0:
- $A \text{ AND NOT } B = 0 \text{ AND } 1 = 0$
- $B \text{ XOR } C = 0 \text{ XOR } 0 = 0$
- $Z = 0 \text{ OR } 0 = 0$

2. For A=0, B=0, C=1:
- $A \text{ AND NOT } B = 0 \text{ AND } 1 = 0$
- $B \text{ XOR } C = 0 \text{ XOR } 1 = 1$
- $Z = 0 \text{ OR } 1 = 1$

3. For A=0, B=1, C=0:
- $A \text{ AND NOT } B = 0 \text{ AND } 0 = 0$
- $B \text{ XOR } C = 1 \text{ XOR } 0 = 1$
- $Z = 0 \text{ OR } 1 = 1$

4. For A=0, B=1, C=1:
- $A \text{ AND NOT } B = 0 \text{ AND } 0 = 0$
- $B \text{ XOR } C = 1 \text{ XOR } 1 = 0$
- $Z = 0 \text{ OR } 0 = 0$

5. For A=1, B=0, C=0:
- $A \text{ AND NOT } B = 1 \text{ AND } 1 = 1$
- $B \text{ XOR } C = 0 \text{ XOR } 0 = 0$
- $Z = 1 \text{ OR } 0 = 1$

6. For A=1, B=0, C=1:
- $A \text{ AND NOT } B = 1 \text{ AND } 1 = 1$
- $B \text{ XOR } C = 0 \text{ XOR } 1 = 1$
- $Z = 1 \text{ OR } 1 = 1$

7. For A=1, B=1, C=0:
- $A \text{ AND NOT } B = 1 \text{ AND } 0 = 0$
- $B \text{ XOR } C = 1 \text{ XOR } 0 = 1$
- $Z = 0 \text{ OR } 1 = 1$

8. For A=1, B=1, C=1:
- $A \text{ AND NOT } B = 1 \text{ AND } 0 = 0$
- $B \text{ XOR } C = 1 \text{ XOR } 1 = 0$
- $Z = 0 \text{ OR } 0 = 0$

Marking scheme

4 marks in total:
- 4 marks for all 8 correct outputs (Z)
- 3 marks for 6 or 7 correct outputs
- 2 marks for 4 or 5 correct outputs
- 1 mark for 2 or 3 correct outputs
Question 12 · Logic Circuit and Truth Table Diagram
4 marks
An automated green house ventilation system controls a fan (output $F$) based on three inputs:
- $D$ (door is closed: $1 = \text{closed}$, $0 = \text{open}$)
- $T$ (temperature is high: $1 = \text{high}$, $0 = \text{normal}$)
- $H$ (humidity is high: $1 = \text{high}$, $0 = \text{normal}$)

The fan is turned on ($F = 1$) when the door is closed AND either the temperature is high OR the humidity is NOT high.

(a) Write the logic expression for this system. [1]

(b) Complete the truth table for this logic expression. [3]

| D | T | H | F |
|---|---|---|---|
| 0 | 0 | 0 | |
| 0 | 0 | 1 | |
| 0 | 1 | 0 | |
| 0 | 1 | 1 | |
| 1 | 0 | 0 | |
| 1 | 0 | 1 | |
| 1 | 1 | 0 | |
| 1 | 1 | 1 | |
Show answer & marking scheme

Worked solution

(a) The logic expression is:
$$F = D \text{ AND } (T \text{ OR NOT } H)$$

(b) Evaluating $F$ for each row:
1. D=0, T=0, H=0: $0 \text{ AND } (0 \text{ OR } 1) = 0$
2. D=0, T=0, H=1: $0 \text{ AND } (0 \text{ OR } 0) = 0$
3. D=0, T=1, H=0: $0 \text{ AND } (1 \text{ OR } 1) = 0$
4. D=0, T=1, H=1: $0 \text{ AND } (1 \text{ OR } 0) = 0$
5. D=1, T=0, H=0: $1 \text{ AND } (0 \text{ OR } 1) = 1$
6. D=1, T=0, H=1: $1 \text{ AND } (0 \text{ OR } 0) = 0$
7. D=1, T=1, H=0: $1 \text{ AND } (1 \text{ OR } 1) = 1$
8. D=1, T=1, H=1: $1 \text{ AND } (1 \text{ OR } 0) = 1$

Marking scheme

Part (a) [1 mark]:
- 1 mark for correct logic expression: $F = D \text{ AND } (T \text{ OR NOT } H)$ (accept equivalent Boolean notation/symbols)

Part (b) [3 marks]:
- 3 marks for 8 correct outputs (F)
- 2 marks for 5 to 7 correct outputs
- 1 mark for 2 to 4 correct outputs
Question 13 · File Handling & Simple Pseudocode Writing
6 marks
The function STR_TO_NUM(X) converts a numeric string X into a real number, and NUM_TO_STR(Y) converts a number Y back into a string.

Write the pseudocode statements to:
* declare any variables used
* open an existing text file named "SensorData.txt" for reading
* open a text file named "HighReadings.txt" for writing (clearing any existing data)
* read each value line-by-line from "SensorData.txt" until the end of the file is reached
* convert each read value into a number, and if it is greater than 150.0, write the value to the file "HighReadings.txt"
* close both files after use.
Show answer & marking scheme

Worked solution

DECLARE SensorVal : STRING
DECLARE NumericVal : REAL

OPENFILE "SensorData.txt" FOR READ
OPENFILE "HighReadings.txt" FOR WRITE

WHILE NOT EOF("SensorData.txt") DO
READFILE "SensorData.txt", SensorVal
NumericVal <- STR_TO_NUM(SensorVal)
IF NumericVal > 150.0 THEN
WRITEFILE "HighReadings.txt", NUM_TO_STR(NumericVal)
ENDIF
ENDWHILE

CLOSEFILE "SensorData.txt"
CLOSEFILE "HighReadings.txt"

Marking scheme

One mark per mark point (max six):
* Correct declaration of string and numeric variables.
* Opening both files with the correct modes (READ and WRITE).
* Use of a loop that correctly checks for the end of the input file (EOF).
* Correctly reading each line and converting the string to a numeric value.
* Conditional comparison (> 150.0) and writing the matching values back to "HighReadings.txt".
* Closing both files after processing is complete.
Question 14 · File Handling & Simple Pseudocode Writing
6 marks
The function STR_TO_NUM(X) converts a numeric string X into an integer.

Write the pseudocode statements to:
* declare all variables used
* open an existing text file named "Results.txt" for reading
* read each score (stored as a string on a separate line) until the end of the file is reached
* convert each score to an integer, and count how many scores are 50 or above (passing score)
* output the total count of passing scores with an appropriate text message
* close the "Results.txt" file after processing.
Show answer & marking scheme

Worked solution

DECLARE ScoreStr : STRING
DECLARE ScoreNum : INTEGER
DECLARE PassCount : INTEGER

PassCount <- 0
OPENFILE "Results.txt" FOR READ

WHILE NOT EOF("Results.txt") DO
READFILE "Results.txt", ScoreStr
ScoreNum <- STR_TO_NUM(ScoreStr)
IF ScoreNum >= 50 THEN
PassCount <- PassCount + 1
ENDIF
ENDWHILE

CLOSEFILE "Results.txt"
OUTPUT "The number of passing students is: ", PassCount

Marking scheme

One mark per mark point (max six):
* Declaring all variables with correct types and initializing the counter variable to 0.
* Opening the file "Results.txt" for reading.
* Constructing a loop that reads until the end of "Results.txt" (using EOF).
* Reading the value into a variable and converting it to an integer using STR_TO_NUM.
* Implementing the selection check (>= 50) and correctly incrementing the counter variable.
* Closing the file "Results.txt" and outputting the counter with a suitable string message.
Question 15 · Written
2 marks
A database table named `DEVICE` stores information about computer lab computers: `DeviceID`, `OS`, `RAM_GB`, `PurchaseYear`.

Write an SQL query to display the `DeviceID` and `RAM_GB` of all devices where the `OS` is `'Linux'`.
Show answer & marking scheme

Worked solution

To select the desired fields, use `SELECT DeviceID, RAM_GB`. Specify the table name with `FROM DEVICE`. Apply the filter condition with `WHERE OS = 'Linux'`.

Marking scheme

1 mark for correct SELECT and FROM clauses: `SELECT DeviceID, RAM_GB FROM DEVICE`
1 mark for correct WHERE clause: `WHERE OS = 'Linux'` (accept double quotes, ignore case of SQL keywords, ignore trailing semicolon)
Question 16 · Written
2 marks
A database table named `INVENTORY` stores data about store items: `ItemID`, `ItemName`, `StockLevel`, `ReorderLevel`.

A query is required to show the `ItemName` and `StockLevel` for all items where the `StockLevel` is less than the `ReorderLevel`. The list must be sorted alphabetically by `ItemName`.

Complete the SQL statement:

```sql
SELECT ItemName, StockLevel
FROM INVENTORY
WHERE ...........................................................
ORDER BY .......................................................
```
Show answer & marking scheme

Worked solution

To filter where the `StockLevel` is less than the `ReorderLevel`, write `StockLevel < ReorderLevel` after the `WHERE` clause. To sort alphabetically by name, use `ItemName` after `ORDER BY`.

Marking scheme

1 mark for completing the WHERE clause: `StockLevel < ReorderLevel` (accept `ReorderLevel > StockLevel`)
1 mark for completing the ORDER BY clause: `ItemName` (accept `ItemName ASC`)
Question 17 · Written
2 marks
A database table named `TUTOR` contains the following data:

| TutorID | Name | Subject | GroupSize |
|---|---|---|---|
| T01 | Alice | Math | 12 |
| T02 | Bob | Physics | 8 |
| T03 | Carol | Math | 15 |
| T04 | Dave | Chemistry | 10 |

State the output produced by the following SQL statement:

```sql
SELECT Name, GroupSize FROM TUTOR WHERE Subject = 'Math' AND GroupSize > 10;
```
Show answer & marking scheme

Worked solution

The query searches for records where `Subject` is 'Math' and `GroupSize` is greater than 10. Alice (12) and Carol (15) meet this condition. The fields specified to be projected are `Name` and `GroupSize`.

Marking scheme

1 mark for identifying the correct rows (Alice and Carol)
1 mark for displaying only the correct columns (Name and GroupSize) with their correct values
Question 18 · Written
2 marks
A database table named `FLIGHT` has fields `FlightNo`, `Destination`, `SeatsAvailable`, `Price`.

Write an SQL query to retrieve all fields from the `FLIGHT` table for flights with a `Price` of less than 150.00, sorted with the cheapest flights first.
Show answer & marking scheme

Worked solution

Use `SELECT *` to retrieve all fields. Use `FROM FLIGHT` to define the target table. Specify the criteria `WHERE Price < 150.00` to select matching rows, and sort by `ORDER BY Price` to order by price in ascending order.

Marking scheme

1 mark for correct select, from, and filter statement: `SELECT * FROM FLIGHT WHERE Price < 150.00` (accept explicit listing of all fields)
1 mark for sorting clause: `ORDER BY Price` (accept `ORDER BY Price ASC`)
Question 19 · standard
15 marks
A one-dimensional (1D) array `Cities[]` contains the names of up to 15 cities.
A two-dimensional (2D) array `WeatherData[]` is used to store the maximum temperature, minimum temperature, and temperature range of each city.

The position of any city’s data is the same in both arrays. For example, the data in index 3 of `WeatherData[]` belongs to the city in index 3 of `Cities[]`.

The variable `CityCount` stores the number of cities for which data is to be input. There must be at least 4 cities but no more than 15.

Write a program that meets the following requirements:
* allows the number of cities for which data is required to be input, stored, and validated
* allows the name of the city and the maximum and minimum temperatures (in °C) to be entered, validated (maximum temperature must be greater than or equal to minimum temperature), and stored
* allows the temperature range of each city to be calculated as maximum temperature minus minimum temperature and stored, rounded to one decimal place
* calculates the average maximum temperature and the average minimum temperature of all the cities, rounded to one decimal place
* finds the city with the largest temperature range and the city with the smallest temperature range
* outputs the names of all cities with their maximum temperature, minimum temperature, and temperature range
* outputs the name of the city with the largest temperature range and the city with the smallest temperature range
* outputs the overall average maximum temperature and overall average minimum temperature.

You must use pseudocode or program code and add comments to explain how your code works.

You do not need to declare any arrays or variables; you may assume that this has already been done.

All inputs and outputs must contain suitable messages.
Show answer & marking scheme

Worked solution

```text
// Task 1: Input and validate the number of cities (between 4 and 15)
REPEAT
OUTPUT "Enter the number of cities (4 to 15 inclusive): "
INPUT CityCount
IF CityCount < 4 OR CityCount > 15 THEN
OUTPUT "Invalid count. Please enter a value between 4 and 15."
ENDIF
UNTIL CityCount >= 4 AND CityCount <= 15

// Task 2 & 3: Input city data, validate temperature conditions, and calculate range
FOR i <- 1 TO CityCount
OUTPUT "Enter name for city ", i, ": "
INPUT Cities[i]

// Validate that Max Temp is not less than Min Temp
REPEAT
OUTPUT "Enter maximum temperature for ", Cities[i], " (°C): "
INPUT MaxTemp
OUTPUT "Enter minimum temperature for ", Cities[i], " (°C): "
INPUT MinTemp
IF MaxTemp < MinTemp THEN
OUTPUT "Error: Max temperature cannot be lower than Min temperature. Please re-enter."
ENDIF
UNTIL MaxTemp >= MinTemp

// Store values in the 2D array
WeatherData[i, 1] <- MaxTemp
WeatherData[i, 2] <- MinTemp
WeatherData[i, 3] <- ROUND(MaxTemp - MinTemp, 1)
NEXT i

// Task 4: Calculate overall averages
SumMax <- 0
SumMin <- 0
FOR i <- 1 TO CityCount
SumMax <- SumMax + WeatherData[i, 1]
SumMin <- SumMin + WeatherData[i, 2]
NEXT i
AvgMax <- ROUND(SumMax / CityCount, 1)
AvgMin <- ROUND(SumMin / CityCount, 1)

// Task 5: Find the city with the largest and smallest temperature range
MaxRange <- WeatherData[1, 3]
MinRange <- WeatherData[1, 3]
MaxIndex <- 1
MinIndex <- 1

FOR i <- 2 TO CityCount
IF WeatherData[i, 3] > MaxRange THEN
MaxRange <- WeatherData[i, 3]
MaxIndex <- i
ENDIF
IF WeatherData[i, 3] < MinRange THEN
MinRange <- WeatherData[i, 3]
MinIndex <- i
ENDIF
NEXT i

// Task 6, 7 & 8: Output all reports
OUTPUT "
--- INDIVIDUAL CITY WEATHER REPORTS ---"
FOR i <- 1 TO CityCount
OUTPUT "City Name: ", Cities[i]
OUTPUT " Maximum Temp: ", WeatherData[i, 1], " °C"
OUTPUT " Minimum Temp: ", WeatherData[i, 2], " °C"
OUTPUT " Temperature Range: ", WeatherData[i, 3], " °C"
NEXT i

OUTPUT "
--- OVERALL ANALYSIS REPORT ---"
OUTPUT "City with the largest temperature range: ", Cities[MaxIndex], " (Range: ", MaxRange, " °C)"
OUTPUT "City with the smallest temperature range: ", Cities[MinIndex], " (Range: ", MinRange, " °C)"
OUTPUT "Overall Average Maximum Temperature: ", AvgMax, " °C"
OUTPUT "Overall Average Minimum Temperature: ", AvgMin, " °C"
```

Marking scheme

**AO2: Apply knowledge and understanding (Max 9 marks)**
* **7–9 marks:**
* The range of programming techniques used is fully appropriate to the problem.
* All criteria stated for the scenario have been covered by the use of appropriate programming techniques (such as validation loops, iteration over nested parameters, totalling, logical min/max tracking).
* The data structures used (1D and 2D arrays) store all data correctly and appropriately.
* **4–6 marks:**
* Some programming techniques used are appropriate to the problem.
* More than one technique is applied correctly to the scenario.
* Some of the data structures chosen are appropriate and store some of the data required.
* **1–3 marks:**
* At least one programming technique has been used.
* Some data has been stored, but not always appropriately or using the requested structures.

**AO3: Provide solutions to problems (Max 6 marks)**
* **5–6 marks:**
* The program has been fully and clearly commented throughout.
* Suitable identifiers with names highly meaningful to their purpose have been used consistently.
* The solution is accurate, in a logical order, and performs all required tasks given in the scenario.
* **3–4 marks:**
* Program seen with some relevant comments.
* The majority of identifiers used are appropriately named.
* The solution contains parts that are inaccurate or contain minor syntax/logic errors, but attempts to meet most requirements.
* **1–2 marks:**
* Program seen without relevant comments.
* Some identifier names are appropriate.
* The solution is illogical or highly inaccurate in many places.

Wondering how well you actually know this?

thinka is an AI practice app for IGCSE & IB 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.

Want more questions like this? Practice unlimited on thinka, instant answers included.

Start Practicing Free