HKDSE · thinka-original Practice Paper

2022 HKDSE Information and Communication Technology Practice Paper with Answers

Thinka 2022 HKDSE-Style Mock — Information and Communication Technology

145 marks210 mins2022
An original Thinka practice paper modelled on the structure and difficulty of the 2022 HKDSE Information and Communication Technology paper. Not affiliated with or reproduced from HKDSE.

Paper 1 Section A (Multiple Choice)

Answer all forty questions. All questions carry equal marks. No marks will be deducted for wrong answers.
40 Question · 40 marks
Question 1 · Multiple Choice
1 marks
An 8-bit register uses two's complement representation for signed integers. Which of the following binary additions will result in an arithmetic overflow?
  1. A.0101 0000 + 0011 0000
  2. B.0011 0010 + 0010 1000
  3. C.1110 0000 + 0010 0000
  4. D.1101 0000 + 1110 0000
Show answer & marking scheme

Worked solution

In 8-bit two's complement representation, the range of representable integers is from −128 to +127.
In Option A: \(0101\,0000_2 = +80_{10}\) and \(0011\,0000_2 = +48_{10}\). Adding them gives \(+80 + 48 = +128\), which exceeds the maximum positive value (+127). The binary sum \(1000\,0000_2\) represents −128, which is negative despite adding two positive numbers, indicating an overflow.
In Option B: \(0011\,0010_2 (+50) + 0010\,1000_2 (+40) = +90\), which falls within [−128, 127].
In Option C: \(1110\,0000_2 (-32) + 0010\,0000_2 (+32) = 0\), which does not overflow.
In Option D: \(1101\,0000_2 (-48) + 1110\,0000_2 (-32) = -80\), which falls within [−128, 127].

Marking scheme

1 mark for selecting A. No marks deducted for incorrect answers.
Question 2 · Multiple Choice
1 marks
Which of the following statements about CPU cache memory is/are correct?

(1) It operates at a higher access speed than main memory (RAM).
(2) It stores frequently used instructions and data to reduce processor wait time.
(3) It has a larger storage capacity than secondary storage.
  1. A.(1) and (2) only
  2. B.(1) and (3) only
  3. C.(2) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

Statement (1) is correct because cache memory is built from high-speed SRAM located close to or directly on the CPU die, making it much faster than DRAM (RAM).
Statement (2) is correct because the primary purpose of cache is to store recently and frequently accessed instructions and data so the CPU does not have to wait for slower main memory.
Statement (3) is incorrect because cache capacity (usually a few megabytes) is far smaller than secondary storage devices like SSDs or hard disks (gigabytes or terabytes).

Marking scheme

1 mark for selecting A. 0 marks otherwise.
Question 3 · Multiple Choice
1 marks
A workstation has an IP address of `192.168.10.75` with a subnet mask of `255.255.255.192`. Which of the following IP addresses belongs to the same subnetwork as this workstation?
  1. A.192.168.10.50
  2. B.192.168.10.110
  3. C.192.168.10.130
  4. D.192.168.10.200
Show answer & marking scheme

Worked solution

The subnet mask is `255.255.255.192`. In binary, 192 is \(11000000_2\), which leaves 6 host bits (block size \(= 2^6 = 64\)).
The subnet ranges for the last octet are:
- Subnet 0: 0 to 63 (Network: 0, Usable: 1–62, Broadcast: 63)
- Subnet 1: 64 to 127 (Network: 64, Usable: 65–126, Broadcast: 127)
- Subnet 2: 128 to 191
- Subnet 3: 192 to 255

The IP `192.168.10.75` has a last octet of 75, which lies in Subnet 1 (`192.168.10.64/26`), where usable hosts are `192.168.10.65` to `192.168.10.126`.
Among the options, `192.168.10.110` is within this range [65, 126].

Marking scheme

1 mark for selecting B. 0 marks otherwise.
Question 4 · Multiple Choice
1 marks
A school grading system in a spreadsheet uses the lookup table shown below in cells `E2:F5` to convert numerical marks into letter grades:

```
E F
1 Mark Grade
2 0 D
3 50 C
4 70 B
5 85 A
```

A student's score of 78 is stored in cell `B2`. Which of the following formulas will correctly return the grade `B`?
  1. A.=VLOOKUP(B2, $E$2:$F$5, 1, TRUE)
  2. B.=VLOOKUP(B2, $E$2:$F$5, 2, FALSE)
  3. C.=VLOOKUP(B2, $E$2:$F$5, 2, TRUE)
  4. D.=VLOOKUP(78, $E$2:$F$5, 1, FALSE)
Show answer & marking scheme

Worked solution

The `VLOOKUP` function syntax is `=VLOOKUP(lookup_value, table_array, col_index_num, [range_lookup])`.
To find the grade for an interval (e.g. 70 to 84 is grade 'B'), approximate match is needed, which requires `TRUE` or omitting the fourth argument (default is `TRUE`). The lookup table must be sorted in ascending order (0, 50, 70, 85), which it is.
Thus, `=VLOOKUP(B2, $E$2:$F$5, 2, TRUE)` finds the largest value less than or equal to 78, which is 70, and returns the corresponding value from column 2, namely 'B'.

Marking scheme

1 mark for selecting C. 0 marks otherwise.
Question 5 · Multiple Choice
1 marks
Alice wants to send a sensitive document to Bob over the Internet. She wishes to ensure that:
- Only Bob can read the content of the document.
- Bob can verify that the document was indeed created by Alice and has not been modified.

Which keys should Alice use to encrypt the document and create the digital signature?
  1. A.Encrypt document with Alice's public key; create signature with Bob's private key
  2. B.Encrypt document with Alice's private key; create signature with Bob's public key
  3. C.Encrypt document with Bob's private key; create signature with Alice's public key
  4. D.Encrypt document with Bob's public key; create signature with Alice's private key
Show answer & marking scheme

Worked solution

1. Confidentiality (only Bob can read): Alice must encrypt the message/document using Bob's public key. Only Bob's corresponding private key can decrypt it.
2. Authentication / Non-repudiation / Integrity (verifying sender is Alice): Alice generates a hash of the document and encrypts the hash using Alice's private key to form the digital signature. Bob can verify it using Alice's public key.

Marking scheme

1 mark for selecting D. 0 marks otherwise.
Question 6 · Multiple Choice
1 marks
Consider the following algorithm:

```text
P ← 1
S ← 0
WHILE P ≤ 25 DO
IF P mod 3 = 0 THEN
S ← S + P
END IF
P ← P * 2
END WHILE
OUTPUT S
```

What is the output of the algorithm?
  1. A.6
  2. B.0
  3. C.12
  4. D.24
Show answer & marking scheme

Worked solution

Let's trace the values of `P` and `S`:
- Initial: `P = 1`, `S = 0`
- Iteration 1: `P = 1 ≤ 25`. `1 mod 3 ≠ 0`. `S` remains 0. `P` becomes `1 * 2 = 2`.
- Iteration 2: `P = 2 ≤ 25`. `2 mod 3 ≠ 0`. `S` remains 0. `P` becomes `2 * 2 = 4`.
- Iteration 3: `P = 4 ≤ 25`. `4 mod 3 ≠ 0`. `S` remains 0. `P` becomes `4 * 2 = 8`.
- Iteration 4: `P = 8 ≤ 25`. `8 mod 3 ≠ 0`. `S` remains 0. `P` becomes `8 * 2 = 16`.
- Iteration 5: `P = 16 ≤ 25`. `16 mod 3 ≠ 0`. `S` remains 0. `P` becomes `16 * 2 = 32`.
- Termination: `P = 32 > 25`, loop ends.
- Output `S = 0`.

Marking scheme

1 mark for selecting B. 0 marks otherwise.
Question 7 · Multiple Choice
1 marks
A database contains a table `ORDERS` with the following structure and records:

```text
OrderID | CustomerID | Amount | Status
---------------------------------------
101 | C01 | 300 | Paid
102 | C02 | 150 | Pending
103 | C01 | 450 | Paid
104 | C03 | 200 | Paid
105 | C02 | 500 | Paid
106 | C01 | 100 | Cancelled
```

What is the number of records returned by the following SQL statement?

```sql
SELECT CustomerID, SUM(Amount)
FROM ORDERS
WHERE Status = 'Paid'
GROUP BY CustomerID
HAVING COUNT(*) >= 1 AND SUM(Amount) > 400;
```
  1. A.2
  2. B.1
  3. C.3
  4. D.4
Show answer & marking scheme

Worked solution

Step 1: Filter records by `WHERE Status = 'Paid'`:
- OrderID 101: C01, 300
- OrderID 103: C01, 450
- OrderID 104: C03, 200
- OrderID 105: C02, 500

Step 2: `GROUP BY CustomerID` and compute aggregates:
- C01: `COUNT() = 2`, `SUM(Amount) = 300 + 450 = 750`
- C02: `COUNT(
) = 1`, `SUM(Amount) = 500`
- C03: `COUNT() = 1`, `SUM(Amount) = 200`

Step 3: Evaluate `HAVING COUNT(
) >= 1 AND SUM(Amount) > 400`:
- C01: `COUNT() = 2 >= 1` AND `750 > 400` → TRUE
- C02: `COUNT(
) = 1 >= 1` AND `500 > 400` → TRUE
- C03: `COUNT(*) = 1 >= 1` AND `200 > 400` → FALSE

Thus, 2 records (for C01 and C02) are returned.

Marking scheme

1 mark for selecting A. 0 marks otherwise.
Question 8 · Multiple Choice
1 marks
Which of the following statements regarding software licensing is/are correct?

(1) Open-source software usually permits users to view, modify, and redistribute the source code.
(2) Freeware grants users the right to modify its source code and sell the modified product.
(3) Shareware is distributed free of charge on a trial basis, often with limited features or an expiration date.
  1. A.(1) only
  2. B.(1) and (3) only
  3. C.(2) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

Statement (1) is correct: Open-source software licenses grant users rights to inspect, modify, and redistribute the source code.
Statement (2) is incorrect: Freeware is copyrighted proprietary software distributed free of charge, but source code is generally not provided or permitted to be modified or sold.
Statement (3) is correct: Shareware provides free evaluation for a limited trial period or with restricted features, after which payment is required for full continued use.

Marking scheme

1 mark for selecting B. 0 marks otherwise.
Question 9 · Multiple Choice
1 marks
Which of the following additions of two 4-bit signed binary numbers in two's complement representation will result in an overflow error?
  1. A.\(0101_2 + 0011_2\)
  2. B.\(1011_2 + 1101_2\)
  3. C.\(0110_2 + 1001_2\)
  4. D.\(1110_2 + 0101_2\)
Show answer & marking scheme

Worked solution

In 4-bit two's complement representation, the range of valid values is from \(-8\) to \(+7\).

- Option A: \(0101_2 (+5) + 0011_2 (+3) = 1000_2 (-8)\). Adding two positive numbers results in a negative representation, which exceeds the maximum positive value \(+7\). Hence, an overflow error occurs.
- Option B: \(1011_2 (-5) + 1101_2 (-3) = 11000_2 \rightarrow 1000_2 (-8)\). \(-8\) is within the valid range, so no overflow occurs.
- Option C: \(0110_2 (+6) + 1001_2 (-7) = 1111_2 (-1)\). Adding numbers with different signs never produces an overflow.
- Option D: \(1110_2 (-2) + 0101_2 (+5) = 10011_2 \rightarrow 0011_2 (+3)\). Adding numbers with different signs never produces an overflow.

Marking scheme

Award 1 mark for selecting option A.
Question 10 · Multiple Choice
1 marks
A database table `STAFF` stores employee records with attributes `ID`, `DEPT`, `SALARY`, and `RATING`.

Consider the following SQL query:

`SELECT DEPT, AVG(SALARY) FROM STAFF WHERE RATING >= 4 GROUP BY DEPT HAVING COUNT(*) >= 5;`

Which of the following describes the output of the query?
  1. A.The average salary of employees with a rating of 4 or above in departments having at least 5 such employees.
  2. B.The average salary of all employees in departments that have at least 5 employees in total.
  3. C.The average salary of all employees in departments where the average rating is at least 4.
  4. D.The average salary of employees with a rating of 4 or above across the 5 highest-rated departments.
Show answer & marking scheme

Worked solution

- `WHERE RATING >= 4` filters records so that only employees with a rating of 4 or above are considered.
- `GROUP BY DEPT` groups these qualified employees by department.
- `HAVING COUNT(*) >= 5` filters the groups to include only departments with at least 5 such qualifying employees.
- `SELECT DEPT, AVG(SALARY)` computes the average salary of these qualifying employees for each remaining department.

Therefore, it displays the average salary of employees having a rating of 4 or above for departments that contain at least 5 employees meeting this rating criterion.

Marking scheme

Award 1 mark for selecting option A.
Question 11 · Multiple Choice
1 marks
Which of the following statements about IPv4 addresses and MAC addresses is/are correct?

(1) A MAC address is a physical address hardcoded onto a network interface card.
(2) A subnet mask is used alongside an IP address to identify the network portion and the host portion.
(3) Two computers connected to the same local area network (LAN) can share the same IP address as long as their MAC addresses are different.
  1. A.(1) and (2) only
  2. B.(1) and (3) only
  3. C.(2) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

- Statement (1) is correct: A Media Access Control (MAC) address is a unique hardware identifier assigned to a network interface controller (NIC).
- Statement (2) is correct: The subnet mask determines which bits of an IPv4 address belong to the network prefix and which belong to the host identifier.
- Statement (3) is incorrect: Every host on the same LAN must have a unique IP address to avoid IP address conflicts.

Marking scheme

Award 1 mark for selecting option A.
Question 12 · Multiple Choice
1 marks
Consider the following algorithm:

```
X ← 1
Y ← 32
WHILE X < Y DO
X ← X * 2
Y ← Y - 4
OUTPUT X, Y
```

What is the output of the algorithm?
  1. A.8, 20
  2. B.16, 16
  3. C.32, 12
  4. D.16, 20
Show answer & marking scheme

Worked solution

We trace the variables step-by-step:

- Initially: \(X = 1\), \(Y = 32\).
- Iteration 1: \(X < Y\) is \(1 < 32\) (True) \(\rightarrow X = 2\), \(Y = 28\).
- Iteration 2: \(X < Y\) is \(2 < 28\) (True) \(\rightarrow X = 4\), \(Y = 24\).
- Iteration 3: \(X < Y\) is \(4 < 24\) (True) \(\rightarrow X = 8\), \(Y = 20\).
- Iteration 4: \(X < Y\) is \(8 < 20\) (True) \(\rightarrow X = 16\), \(Y = 16\).
- Loop check: \(X < Y\) is \(16 < 16\) (False). The loop terminates.

Output: \(X = 16\), \(Y = 16\).

Marking scheme

Award 1 mark for selecting option B.
Question 13 · Multiple Choice
1 marks
An online registration form uses a check digit algorithm to verify whether a user's input identity card number follows the mathematical rule. Which type of data control does this illustrate?
  1. A.Data verification to detect transcription errors.
  2. B.Data verification to detect transposition errors.
  3. C.Data validation to ensure data validity based on a rule.
  4. D.Data encryption to protect confidential data during entry.
Show answer & marking scheme

Worked solution

A check digit is a data validation method (consistency/check digit check) performed automatically by software to verify that the entered code conforms to predefined mathematical rules. Data verification, on the other hand, involves comparing input against the original source (such as double entry or visual inspection).

Marking scheme

Award 1 mark for selecting option C.
Question 14 · Multiple Choice
1 marks
Which of the following correctly describes the primary role of the Program Counter (PC) in a CPU?
  1. A.It holds the instruction currently being decoded and executed.
  2. B.It stores the memory address of the next instruction to be fetched.
  3. C.It stores the intermediate results of arithmetic and logical operations.
  4. D.It coordinates data signals between the CPU and external peripheral devices.
Show answer & marking scheme

Worked solution

The Program Counter (PC) is a dedicated CPU register that holds the memory address of the next instruction to be fetched from main memory. The instruction currently being decoded and executed is held in the Instruction Register (IR), while intermediate calculations are stored in the Accumulator (AC) or general-purpose registers.

Marking scheme

Award 1 mark for selecting option B.
Question 15 · Multiple Choice
1 marks
A user receives an email appearing to originate from their bank, claiming that their account has been temporarily suspended and instructing them to click a link to a login page to verify their credentials. What type of cybersecurity attack is this?
  1. A.Phishing
  2. B.Distributed Denial of Service (DDoS)
  3. C.Spyware
  4. D.Ransomware
Show answer & marking scheme

Worked solution

Phishing is a social engineering technique where attackers impersonate trustworthy entities (such as banks or service providers) via fraudulent emails or websites to deceive individuals into disclosing sensitive credentials or personal information.

Marking scheme

Award 1 mark for selecting option A.
Question 16 · Multiple Choice
1 marks
An uncompressed 24-bit true colour bitmap image has a resolution of \(1200 \times 800\) pixels. What is the approximate file size of this image in megabytes (MB), where \(1\text{ MB} = 1024 \times 1024\text{ bytes}\)?
  1. A.0.92 MB
  2. B.2.75 MB
  3. C.7.32 MB
  4. D.22.0 MB
Show answer & marking scheme

Worked solution

- Total number of pixels = \(1200 \times 800 = 960,000\) pixels.
- Colour depth = 24 bits = 3 bytes per pixel.
- Total uncompressed size in bytes = \(960,000 \times 3 = 2,880,000\) bytes.
- Size in MB = \(\frac{2,880,000}{1024 \times 1024} = \frac{2,880,000}{1,048,576} \approx 2.75\text{ MB}\).

Marking scheme

Award 1 mark for selecting option B.
Question 17 · Multiple Choice
1 marks
A 3-minute stereo sound track is recorded with a sampling rate of \(44.1\text{ kHz}\) and a bit depth of 16 bits. Which of the following expressions calculates the storage size of this uncompressed audio file in Megabytes (MB)?
  1. A.\(\frac{44100 \times 16 \times 180 \times 2}{8 \times 1024 \times 1024}\)
  2. B.\(\frac{44100 \times 16 \times 3 \times 2}{8 \times 1024 \times 1024}\)
  3. C.\(\frac{44100 \times 16 \times 180}{8 \times 1000 \times 1000}\)
  4. D.\(\frac{44100 \times 16 \times 180 \times 2}{1024 \times 1024}\)
Show answer & marking scheme

Worked solution

The uncompressed audio file size in bits is calculated as: \(\text{Sampling Rate} \times \text{Bit Depth} \times \text{Number of Channels} \times \text{Duration in seconds}\).
Here, duration = \(3 \times 60 = 180\text{ seconds}\), channels = 2 (stereo).
Total bits = \(44100 \times 16 \times 2 \times 180\).
To convert bits to MB, divide by \(8 \times 1024 \times 1024\).
Thus, the required expression is \(\frac{44100 \times 16 \times 180 \times 2}{8 \times 1024 \times 1024}\).

Marking scheme

A (1 mark)
Question 18 · Multiple Choice
1 marks
A database contains a table `STAFF` with fields `StaffID`, `Department`, and `Salary`. Consider the following SQL statement:

```sql
SELECT Department, AVG(Salary)
FROM STAFF
WHERE Salary > 20000
GROUP BY Department
HAVING COUNT(*) >= 3;
```

Which of the following best describes the output produced by this query?
  1. A.The average salary of all staff in each department that has at least 3 staff members in total.
  2. B.The average salary of staff earning more than 20000 in departments that have at least 3 staff members in total.
  3. C.The average salary of staff earning more than 20000 in departments that have at least 3 such staff members.
  4. D.The total number of staff in departments where the average salary exceeds 20000.
Show answer & marking scheme

Worked solution

`WHERE Salary > 20000` filters out all staff members with a salary of 20000 or below before grouping. `GROUP BY Department` aggregates the remaining records by department. `HAVING COUNT(*) >= 3` filters the grouped results, retaining only departments that have at least 3 staff members earning more than 20000. `AVG(Salary)` calculates the average salary among those staff members in each qualifying department.

Marking scheme

C (1 mark)
Question 19 · Multiple Choice
1 marks
Which of the following statements about network transmission devices is/are correct?

(1) A network switch directs data packets to specific destination ports using MAC addresses.
(2) A router connects different networks and determines packet forwarding paths using IP addresses.
(3) A network repeater regenerates signals to extend transmission distance without introducing any latency.
  1. A.(1) only
  2. B.(1) and (2) only
  3. C.(2) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

(1) is correct because a switch operates at Layer 2 and uses a MAC address table to forward frames to specific ports.
(2) is correct because a router operates at Layer 3 and uses routing tables based on IP addresses to forward packets between networks.
(3) is incorrect because any hardware device, including a repeater, introduces a small physical propagation and processing delay (latency).

Marking scheme

B (1 mark)
Question 20 · Multiple Choice
1 marks
In a spreadsheet, cell `C2` contains the formula:

`=IF(B2>=80, "Distinction", IF(B2>=50, "Pass", "Fail"))`

Which of the following formulas will always produce the identical output as `C2` for any integer score in `B2` ranging from 0 to 100?
  1. A.`=IF(B2<50, "Fail", IF(B2<80, "Pass", "Distinction"))`
  2. B.`=IF(B2>=50, "Pass", IF(B2>=80, "Distinction", "Fail"))`
  3. C.`=IF(B2<80, "Pass", IF(B2<50, "Fail", "Distinction"))`
  4. D.`=IF(B2>=80, "Distinction", IF(B2<50, "Pass", "Fail"))`
Show answer & marking scheme

Worked solution

The original formula maps:
- Score \(\ge 80\) to "Distinction"
- \(50 \le\) Score \(< 80\) to "Pass"
- Score \(< 50\) to "Fail"

Option A checks:
- If `B2 < 50` \(\rightarrow\) "Fail"
- Else if `B2 < 80` (which means \(50 \le \text{B2} < 80\)) \(\rightarrow\) "Pass"
- Else (which means \(\text{B2} \ge 80\)) \(\rightarrow\) "Distinction"
This is completely logically equivalent to the original formula.

Marking scheme

A (1 mark)
Question 21 · Multiple Choice
1 marks
During the fetch phase of the CPU instruction cycle, which of the following describes the correct order of register operations?
  1. A.PC \(\rightarrow\) MAR \(\rightarrow\) MDR \(\rightarrow\) IR, then PC is incremented
  2. B.IR \(\rightarrow\) MAR \(\rightarrow\) MDR \(\rightarrow\) PC, then MAR is incremented
  3. C.MDR \(\rightarrow\) PC \(\rightarrow\) MAR \(\rightarrow\) IR, then MDR is incremented
  4. D.PC \(\rightarrow\) IR \(\rightarrow\) MAR \(\rightarrow\) MDR, then IR is incremented
Show answer & marking scheme

Worked solution

The standard instruction fetch sequence in the Von Neumann architecture is:
1. The memory address stored in the Program Counter (PC) is copied to the Memory Address Register (MAR).
2. The CPU sends a read signal to memory, and the instruction at that address is transferred via the data bus into the Memory Data Register (MDR).
3. The instruction in the MDR is loaded into the Instruction Register (IR).
4. The Program Counter (PC) is incremented to point to the next instruction.

Marking scheme

A (1 mark)
Question 22 · Multiple Choice
1 marks
An attacker compromises a DNS server so that queries for a legitimate online banking website return the IP address of a fake website controlled by the attacker. This type of cyber attack is known as
  1. A.Phishing.
  2. B.Pharming.
  3. C.Denial of Service.
  4. D.Ransomware.
Show answer & marking scheme

Worked solution

Pharming is a cyber attack intended to redirect a website's traffic to another, fake site by exploiting vulnerabilities in DNS server software or changing host files/DNS tables. Phishing, by contrast, typically relies on deceptive emails or messages with fraudulent links.

Marking scheme

B (1 mark)
Question 23 · Multiple Choice
1 marks
Consider the following algorithm:

```text
x ← 18
y ← 24
while x ≠ y do
if x > y then
x ← x - y
else
y ← y - x
output x
```

What is the output of the algorithm?
  1. A.0
  2. B.3
  3. C.6
  4. D.12
Show answer & marking scheme

Worked solution

This is Euclidean algorithm for finding the Greatest Common Divisor (GCD):
- Initial: \(x = 18\), \(y = 24\)
- Iteration 1: \(x < y \rightarrow y = 24 - 18 = 6\)
- Iteration 2: \(x > y \rightarrow x = 18 - 6 = 12\)
- Iteration 3: \(x > y \rightarrow x = 12 - 6 = 6\)
- Loop condition \(x \ne y\) becomes false since \(x = 6\) and \(y = 6\).
- Output: 6.

Marking scheme

C (1 mark)
Question 24 · Multiple Choice
1 marks
An artist releases a digital illustration under the Creative Commons license "CC BY-NC-ND". Which of the following uses of the illustration by a third party is/are permitted without obtaining additional written authorization?

(1) Including the original illustration in a non-profit educational booklet with proper attribution.
(2) Recolouring the illustration for use in a free mobile app with proper attribution.
(3) Printing the original illustration on t-shirts for sale in a school charity bazaar with proper attribution.
  1. A.(1) only
  2. B.(2) only
  3. C.(1) and (3) only
  4. D.(2) and (3) only
Show answer & marking scheme

Worked solution

The CC BY-NC-ND license terms mean:
- BY (Attribution): Credit must be given to the creator.
- NC (Non-Commercial): The work cannot be used for commercial purposes. (Selling t-shirts in (3) constitutes commercial/sales activity).
- ND (NoDerivatives): No modifications, adaptations, or remixes are allowed. (Recolouring in (2) creates a derivative work).
Therefore, only (1) is permitted because it is non-commercial, gives attribution, and uses the original unedited work.

Marking scheme

A (1 mark)
Question 25 · Multiple Choice
1 marks
In a computer system using 6-bit two's complement representation for integers, which of the following binary additions will result in an arithmetic overflow?
  1. A.\(010101_2 + 001010_2\)
  2. B.\(010010_2 + 010001_2\)
  3. C.\(101010_2 + 001111_2\)
  4. D.\(110000_2 + 110100_2\)
Show answer & marking scheme

Worked solution

In a 6-bit two's complement representation, the range of representable integers is from
\(-2^{6-1} = -32\) to \(2^{6-1} - 1 = +31\).

Let's evaluate each option:
- A: \(010101_2 (+21) + 001010_2 (+10) = +31\) (within \([-32, 31]\), no overflow).
- B: \(010010_2 (+18) + 010001_2 (+17) = +35\). Since \(35 > 31\), an overflow occurs (adding two positive numbers yields a negative sign bit \(100011_2\)).
- C: \(101010_2 (-22) + 001111_2 (+15) = -7\) (adding positive and negative never overflows).
- D: \(110000_2 (-16) + 110100_2 (-12) = -28\) (within \([-32, 31]\), no overflow).

Therefore, option B results in an arithmetic overflow.

Marking scheme

B (1 mark)
Award 1 mark for the correct answer. No partial credit.
Question 26 · Multiple Choice
1 marks
An organisation is assigned a Class C network segment with the subnet address range from `192.168.10.64` to `192.168.10.127`. What is the subnet mask and the maximum number of host devices that can be assigned usable IP addresses in this subnet?

| | Subnet Mask | Maximum Usable Host Addresses |
|---|---|---|
| A. | 255.255.255.128 | 62 |
| B. | 255.255.255.192 | 62 |
| C. | 255.255.255.192 | 64 |
| D. | 255.255.255.224 | 30 |
  1. A.Subnet Mask: `255.255.255.128`, Maximum Usable Host Addresses: 62
  2. B.Subnet Mask: `255.255.255.192`, Maximum Usable Host Addresses: 62
  3. C.Subnet Mask: `255.255.255.192`, Maximum Usable Host Addresses: 64
  4. D.Subnet Mask: `255.255.255.224`, Maximum Usable Host Addresses: 30
Show answer & marking scheme

Worked solution

The block spans from `192.168.10.64` to `192.168.10.127`, which contains a total of \(127 - 64 + 1 = 64\) IP addresses.
Since \(64 = 2^6\), there are 6 bits for the host ID, leaving \(32 - 6 = 26\) bits for the network/subnet prefix.
A 26-bit subnet mask in decimal is \(255.255.255.192\) (since \(11000000_2 = 192\)).
The number of usable host IP addresses is \(2^6 - 2 = 62\) (excluding the network ID `192.168.10.64` and the broadcast address `192.168.10.127`).

Marking scheme

B (1 mark)
Award 1 mark for the correct answer.
Question 27 · Multiple Choice
1 marks
Which of the following statements about cache memory in a modern computer system are correct?

(1) It has a faster access speed than main memory (RAM).
(2) It is typically built using Static RAM (SRAM).
(3) Increasing the size of the L1 cache increases the maximum size of the physical address space that the CPU can address.
  1. A.(1) and (2) only
  2. B.(1) and (3) only
  3. C.(2) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

(1) is correct: Cache memory operates at much higher speeds compared to main memory (DRAM) to reduce latency when accessing frequently used data.
(2) is correct: Cache memory is typically constructed using SRAM, which is faster but more expensive and less dense than DRAM.
(3) is incorrect: The maximum addressable physical memory space is determined by the width of the CPU's address bus and architecture (e.g., 32-bit or 64-bit), not by the cache capacity.

Therefore, only (1) and (2) are correct.

Marking scheme

A (1 mark)
Award 1 mark for identifying (1) and (2) only.
Question 28 · Multiple Choice
1 marks
A school maintains a database table `STUDENT` containing information about students in different clubs:

`STUDENT (StudentID, SName, ClubName, ServiceHours)`

The teacher wants to list the club name and the average service hours for clubs that have more than 5 members and whose average service hours are at least 10.

Which of the following SQL statements produces the desired result?
  1. A.```sql
    SELECT ClubName, AVG(ServiceHours)
    FROM STUDENT
    WHERE COUNT(*) > 5 AND AVG(ServiceHours) >= 10
    GROUP BY ClubName
    ```
  2. B.```sql
    SELECT ClubName, AVG(ServiceHours)
    FROM STUDENT
    WHERE ServiceHours >= 10
    GROUP BY ClubName
    HAVING COUNT(*) > 5
    ```
  3. C.```sql
    SELECT ClubName, AVG(ServiceHours)
    FROM STUDENT
    GROUP BY ClubName
    HAVING COUNT(*) > 5 AND AVG(ServiceHours) >= 10
    ```
  4. D.```sql
    SELECT ClubName, AVG(ServiceHours)
    FROM STUDENT
    GROUP BY ClubName, ServiceHours
    HAVING COUNT(StudentID) > 5 AND ServiceHours >= 10
    ```
Show answer & marking scheme

Worked solution

To group records by club, `GROUP BY ClubName` is required. Filtering conditions based on aggregate functions (such as `COUNT()` and `AVG(ServiceHours)`) must be placed in the `HAVING` clause, not the `WHERE` clause.
- `COUNT(
) > 5` checks that the club has more than 5 members.
- `AVG(ServiceHours) >= 10` checks that the average service hours are at least 10.

Thus, the correct query is:
```sql
SELECT ClubName, AVG(ServiceHours)
FROM STUDENT
GROUP BY ClubName
HAVING COUNT(*) > 5 AND AVG(ServiceHours) >= 10
```

Marking scheme

C (1 mark)
Award 1 mark for the correct SQL query using GROUP BY and HAVING.
Question 29 · Multiple Choice
1 marks
Consider the following pseudocode algorithm:

```text
count ← 0
total ← 0
for i from 1 to 5 do
for j from i to 5 do
count ← count + 1
if (i + j) mod 2 = 0 then
total ← total + 1
output count, total
```

What are the final values of `count` and `total` displayed?
  1. A.count = 25, total = 12
  2. B.count = 25, total = 13
  3. C.count = 15, total = 8
  4. D.count = 15, total = 9
Show answer & marking scheme

Worked solution

Let's trace the loops for each value of \(i\):
- When \(i = 1\): \(j\) goes from 1 to 5 (5 iterations).
- \(j = 1\): \(i+j=2\) (even) \(\rightarrow\) total + 1
- \(j = 2\): \(i+j=3\) (odd)
- \(j = 3\): \(i+j=4\) (even) \(\rightarrow\) total + 1
- \(j = 4\): \(i+j=5\) (odd)
- \(j = 5\): \(i+j=6\) (even) \(\rightarrow\) total + 1
(Iterations: 5, total increment: 3)
- When \(i = 2\): \(j\) goes from 2 to 5 (4 iterations).
- \(j = 2\): \(2+2=4\) (even) \(\rightarrow\) total + 1
- \(j = 3\): \(2+3=5\) (odd)
- \(j = 4\): \(2+4=6\) (even) \(\rightarrow\) total + 1
- \(j = 5\): \(2+5=7\) (odd)
(Iterations: 4, total increment: 2)
- When \(i = 3\): \(j\) goes from 3 to 5 (3 iterations).
- \(j = 3\) (even), \(j = 4\) (odd), \(j = 5\) (even) \(\rightarrow\) total increment: 2
- When \(i = 4\): \(j\) goes from 4 to 5 (2 iterations).
- \(j = 4\) (even), \(j = 5\) (odd) \(\rightarrow\) total increment: 1
- When \(i = 5\): \(j\) goes from 5 to 5 (1 iteration).
- \(j = 5\) (even) \(\rightarrow\) total increment: 1

Total iterations (`count`) = \(5 + 4 + 3 + 2 + 1 = 15\).
Total even sums (`total`) = \(3 + 2 + 2 + 1 + 1 = 9\).

Therefore, `count = 15` and `total = 9`.

Marking scheme

D (1 mark)
Award 1 mark for count = 15, total = 9.
Question 30 · Multiple Choice
1 marks
Which of the following descriptions best explains the primary purpose of a Digital Certificate used in HTTPS communication?
  1. A.To store the user's login credentials in an encrypted cookie on the client computer.
  2. B.To authenticate the identity of the web server and provide its authentic public key.
  3. C.To compress data packets to speed up the transmission over the network.
  4. D.To prevent viruses and malware from being downloaded onto the client machine.
Show answer & marking scheme

Worked solution

A digital certificate is issued by a trusted Certificate Authority (CA) to authenticate and verify the true identity of the website/server and to bind the website's public key to its verified domain name, thus preventing man-in-the-middle attacks and spoofing.

Marking scheme

B (1 mark)
Award 1 mark for the correct explanation of digital certificate functionality.
Question 31 · Multiple Choice
1 marks
An uncompressed true-colour (24-bit) image has a resolution of \(1920 \times 1080\) pixels. What is its estimated file size in megabytes (MB), where \(1\text{ MB} = 1024 \times 1024\text{ bytes}\)?
  1. A.1.98 MB
  2. B.2.07 MB
  3. C.5.93 MB
  4. D.47.46 MB
Show answer & marking scheme

Worked solution

Number of pixels = \(1920 \times 1080 = 2,073,600\) pixels.
Colour depth = 24 bits = 3 bytes per pixel.
Total size in bytes = \(2,073,600 \times 3 = 6,220,800\) bytes.
File size in MB = \(\frac{6,220,800}{1024 \times 1024} = \frac{6,220,800}{1,048,576} \approx 5.93\text{ MB}\).

Marking scheme

C (1 mark)
Award 1 mark for finding approx 5.93 MB.
Question 32 · Multiple Choice
1 marks
A software developer releases an application under an open-source license. Which of the following statements about this application is/are correct?

(1) Other programmers are legally permitted to view and modify the source code.
(2) The software must always be provided completely free of charge.
(3) The author automatically relinquishes all copyright ownership to the public domain.
  1. A.(1) only
  2. B.(2) only
  3. C.(1) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

(1) is correct: A fundamental characteristic of open-source software is that users and developers have access to inspect and modify the source code.
(2) is incorrect: Open-source refers to freedom of access to source code, not necessarily price; distributors may charge fees for distribution, physical media, or support.
(3) is incorrect: Open-source software is still protected by copyright law; authors retain copyright and grant specific usage rights via licenses (e.g., GPL, MIT), unlike works dedicated to the public domain.

Therefore, only (1) is correct.

Marking scheme

A (1 mark)
Award 1 mark for (1) only.
Question 33 · Multiple Choice
1 marks
Which of the following additions of 5-bit two's complement numbers will result in an overflow error?
  1. A.\(01010 + 00111\)
  2. B.\(10101 + 00100\)
  3. C.\(11010 + 11100\)
  4. D.\(00110 + 00101\)
Show answer & marking scheme

Worked solution

In 5-bit two's complement representation, the representable range is from \(-2^{4}\) to \(2^{4}-1\), which is \(-16\) to \(+15\).
- In A: \(01010_2 = +10\) and \(00111_2 = +7\). Adding them gives \(+17\), which exceeds the maximum value \(+15\). Binary addition \(01010 + 00111 = 10001_2\) (which represents \(-15\)), indicating an overflow error (adding two positive numbers yielded a negative result).
- In B: \(10101_2 = -11\) and \(00100_2 = +4\); sum is \(-7\) (no overflow).
- In C: \(11010_2 = -6\) and \(11100_2 = -4\); sum is \(-10\) (no overflow).
- In D: \(00110_2 = +6\) and \(00101_2 = +5\); sum is \(+11\) (no overflow).

Marking scheme

A (1 mark)
Question 34 · Multiple Choice
1 marks
A company maintains a database table `STAFF` storing employee information with attributes `Name`, `Dept`, and `Salary`. Which of the following SQL statements retrieves the names of all employees in the 'Sales' department whose salary is strictly greater than 20000, ordered from the highest salary to the lowest?
  1. A.`SELECT Name FROM STAFF WHERE Dept = 'Sales' AND Salary > 20000 ORDER BY Salary DESC;`
  2. B.`SELECT Name FROM STAFF WHERE Dept = 'Sales' OR Salary > 20000 ORDER BY Salary ASC;`
  3. C.`SELECT Name FROM STAFF WHERE Dept = 'Sales' AND Salary > 20000 ORDER BY Salary ASC;`
  4. D.`SELECT Name FROM STAFF WHERE Dept = 'Sales' OR Salary > 20000 ORDER BY Salary DESC;`
Show answer & marking scheme

Worked solution

To select employees matching both criteria, the logical operator `AND` must be used in the `WHERE` clause (`Dept = 'Sales' AND Salary > 20000`). To sort from highest to lowest salary, the `ORDER BY Salary DESC` clause is required (`DESC` indicates descending order).

Marking scheme

A (1 mark)
Question 35 · Multiple Choice
1 marks
Which of the following statements about CPU cache memory is/are correct?

(1) It operates at a faster speed than main memory (RAM).
(2) It holds frequently accessed instructions and data to reduce access latency.
(3) It is non-volatile and retains stored data when the power is turned off.
  1. A.(1) only
  2. B.(1) and (2) only
  3. C.(2) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

Statement (1) is correct because cache memory is built using fast Static RAM (SRAM), which operates faster than standard DRAM main memory. Statement (2) is correct as the primary purpose of cache is to store recently and frequently accessed instructions/data. Statement (3) is incorrect because cache memory (SRAM) is volatile and loses all stored data when powered off.

Marking scheme

B (1 mark)
Question 36 · Multiple Choice
1 marks
Which of the following statements regarding IPv4 and IPv6 addressing are correct?

(1) An IPv4 address consists of 32 bits, whereas an IPv6 address consists of 128 bits.
(2) IPv6 was introduced primarily to resolve the problem of IPv4 address exhaustion.
(3) An IPv6 address is written as eight groups of decimal numbers separated by dots.
  1. A.(1) and (2) only
  2. B.(1) and (3) only
  3. C.(2) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

Statement (1) is correct (32 bits vs 128 bits). Statement (2) is correct because the 128-bit address space of IPv6 was designed to solve the depletion of IPv4 addresses. Statement (3) is incorrect because IPv6 addresses are expressed in hexadecimal numbers grouped in eight blocks separated by colons, not decimal separated by dots.

Marking scheme

A (1 mark)
Question 37 · Multiple Choice
1 marks
Consider the following algorithm:

```text
count ← 0
for i from 1 to 5 do
if (i MOD 2 <> 0) then
count ← count + i
output count
```

What is the output of the algorithm?
  1. A.6
  2. B.9
  3. C.12
  4. D.15
Show answer & marking scheme

Worked solution

Tracing the loop for \(i = 1\) to \(5\):
- \(i = 1\): \(1 \text{ MOD } 2 = 1 \neq 0\) (True), `count` becomes \(0 + 1 = 1\).
- \(i = 2\): \(2 \text{ MOD } 2 = 0 \neq 0\) (False).
- \(i = 3\): \(3 \text{ MOD } 2 = 1 \neq 0\) (True), `count` becomes \(1 + 3 = 4\).
- \(i = 4\): \(4 \text{ MOD } 2 = 0 \neq 0\) (False).
- \(i = 5\): \(5 \text{ MOD } 2 = 1 \neq 0\) (True), `count` becomes \(4 + 5 = 9\).
The final output is \(9\).

Marking scheme

B (1 mark)
Question 38 · Multiple Choice
1 marks
In spreadsheet software, cell `D5` contains the formula `=$B$1*C5`. If this formula is copied and pasted into cell `E7`, what will the resulting formula in cell `E7` be?
  1. A.`=$B$1*D7`
  2. B.`=$C$3*D7`
  3. C.`=$B$1*C7`
  4. D.`=$C$1*D7`
Show answer & marking scheme

Worked solution

In the formula `=$B$1*C5`:
- `$B$1` is an absolute cell reference, so it remains `$B$1` when copied to any cell.
- `C5` is a relative cell reference. Moving from `D5` to `E7` is a shift of \(+1\) column (D to E) and \(+2\) rows (5 to 7). Thus, `C5` shifts by \(+1\) column (C becomes D) and \(+2\) rows (5 becomes 7), resulting in `D7`.
Therefore, the formula in `E7` is `=$B$1*D7`.

Marking scheme

A (1 mark)
Question 39 · Multiple Choice
1 marks
Which of the following measures can effectively protect a user from falling victim to email phishing attacks?

(1) Verifying the domain name and SSL/TLS digital certificate of the login page before entering credentials.
(2) Avoiding opening hyperlinks or attachments in suspicious or unexpected emails.
(3) Using anti-phishing / web protection features provided by modern web browsers and security software.
  1. A.(1) and (2) only
  2. B.(1) and (3) only
  3. C.(2) and (3) only
  4. D.(1), (2) and (3)
Show answer & marking scheme

Worked solution

All three measures are effective defenses against phishing:
(1) Digital certificates and domain checks confirm whether the website is genuine.
(2) Avoiding direct links in unverified emails prevents redirection to fraudulent sites.
(3) Modern web security tools maintain real-time blacklists to block known phishing URLs.

Marking scheme

D (1 mark)
Question 40 · Multiple Choice
1 marks
A photographer distributes an original image under the Creative Commons license CC BY-NC-ND (Attribution - NonCommercial - NoDerivatives). Which of the following actions is permitted under this license without obtaining additional prior authorization?
  1. A.Using the image in a paid commercial magazine advertisement without mentioning the photographer's name.
  2. B.Distributing exact, unmodified copies of the image in a free school newsletter while providing proper attribution to the author.
  3. C.Cropping and applying color filters to the image to sell as a book cover.
  4. D.Remixing the image into a non-commercial digital collage without providing any attribution.
Show answer & marking scheme

Worked solution

Under CC BY-NC-ND:
- BY requires giving appropriate credit (attribution).
- NC restricts usage to non-commercial purposes only.
- ND prohibits distributing derivative works or modifications.
Option B strictly complies with all three conditions (unaltered copy, non-commercial educational use, proper credit given). Options A, C, and D violate at least one of these conditions.

Marking scheme

B (1 mark)

Ready to test yourself?

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

Practise This Topic

Paper 1 Section B (Structured Questions)

Answer all five compulsory questions in this section.
5 Question · 60 marks
Question 1 · structured
12 marks
David is setting up a high-performance workstation for video editing and 3D rendering in his design studio.

(a) David chooses a multi-core processor with a large L3 cache over a processor with fewer cores and a smaller cache.
(i) Explain one advantage of having a larger cache memory in the CPU during video processing. (1 mark)
(ii) State another CPU performance factor, other than core count and cache size, that David should consider. (1 mark)

(b) Besides the CPU, state two hardware components that David should upgrade to significantly reduce video rendering and export time. Give a brief justification for each. (2 marks)

(c) The workstation has an operating system installed.
(i) State two essential functions of an operating system other than memory management. (2 marks)
(ii) David considers using a solid-state drive (SSD) rather than a hard disk drive (HDD) as the system boot drive. State one technical advantage and one technical disadvantage of an SSD compared to an HDD. (2 marks)

(d) David uses open-source software for graphic editing and proprietary commercial software for video editing. State two differences between open-source software and proprietary commercial software regarding user rights and code access. (2 marks)

(e) When installing graphic design software, David is prompted to review an End-User License Agreement (EULA).
(i) State one common privacy concern related to the telemetry or data collection clause in such software agreements. (1 mark)
(ii) Suggest one measure David can take to protect studio data privacy while using connected software tools. (1 mark)
Show answer & marking scheme

Worked solution

(a) (i) A larger L3 cache allows frequently used instructions and multimedia data to be stored close to the execution cores, reducing the time CPU cores spend waiting for data from main memory (RAM).
(ii) Clock rate (clock frequency / gigahertz) or word size (instruction set architecture, e.g., 64-bit).

(b) 1. Dedicated GPU (Graphics Card): Provides massive parallel processing cores to accelerate graphic rendering, video encoding, and hardware decoding.
2. RAM (Main Memory): Provides high capacity and bandwidth to hold large raw video frames without paging to secondary storage.

(c) (i) Process management (CPU scheduling) / Device management (I/O device drivers) / File management / User interface.
(ii) Advantage: Higher data read/write transfer rates and near-zero seek time.
Disadvantage: Higher cost per gigabyte / Limited write cycle lifespan per flash memory cell compared to magnetic platters.

(d) 1. Source code availability: Open-source software provides access to the underlying source code for modification and inspection, whereas proprietary commercial software keeps source code closed/confidential.
2. Redistribution/Modification rights: Open-source licenses generally permit free redistribution and adaptation, whereas proprietary commercial licenses strictly restrict copying, modifying, and redistributing.

(e) (i) Software may collect usage analytics, file metadata, or project telemetry data and transmit them back to company servers without explicit real-time notification.
(ii) Opt out of telemetry/usage data collection in software settings / Configure firewall rules to block outbound telemetry traffic.

Marking scheme

(a) (i) 1 mark for valid explanation regarding reducing memory access latency / keeping frequent instructions and data in high-speed on-chip memory.
(ii) 1 mark for Clock rate / Bus width / Word size.

(b) 1 mark for each component with valid justification (max 2 marks):
- GPU / Graphics card: for parallel processing / hardware rendering acceleration.
- RAM: for storing large video frames in memory to prevent virtual memory swapping.
- SSD / High-speed NVMe storage: for rapid I/O transfer rates of raw footage.

(c) (i) 1 mark for each valid function (max 2 marks):
- Process/task management / CPU scheduling
- Device/I/O management
- File system management
- User interface / Security and user authentication
(ii) 1 mark for technical advantage (e.g., faster data access speed, shock resistant, lower power consumption, quiet operation).
1 mark for technical disadvantage (e.g., higher price per unit capacity, finite write cycles/wear-out).

(d) 1 mark each for two valid differences (max 2 marks):
- Source code accessibility (public vs. closed/proprietary).
- Licensing/Modification terms (freedom to modify and redistribute vs. restricted usage per license seat).

(e) (i) 1 mark for identifying telemetry / background analytics / user behavioral data collection.
(ii) 1 mark for disabling data sharing options / firewall blocking / using offline profile.
Question 2 · structured
12 marks
A school organizes an inter-class sports competition. The score records of participants are processed using a spreadsheet application and a relational database.

Table `INFO` in Sheet1:
| | A | B |
|---|---|---|
| 1 | CLASS_CODE | CLASS_NAME |
| 2 | C1 | Red Dragon |
| 3 | C2 | Blue Falcon |
| 4 | C3 | Green Viper |
| 5 | C4 | Gold Lion |

Table `SCORES` in Sheet2:
| | A | B | C | D | E | F | G |
|---|---|---|---|---|---|---|---|
| 1 | CLASS_CODE | CLASS_NAME | S_ID | Trial_1 | Trial_2 | Trial_3 | Final_Score |
| 2 | C1 | | S101 | 82 | 88 | 79 | |
| 3 | C2 | | S102 | 90 | 95 | 92 | |
| 4 | C1 | | S103 | 60 | 70 | 65 | |
| 5 | C4 | | S104 | 75 | 85 | 80 | |

(a) The `Final_Score` of each participant is calculated as the average of the two highest trial scores among `Trial_1`, `Trial_2`, and `Trial_3`. Write an Excel formula for cell `G2` such that it can be copied down to `G3:G5`. (2 marks)

(b) In `Sheet2`, the class name in column B should be retrieved automatically based on the `CLASS_CODE` in column A using table `INFO` in `Sheet1`. Write the formula in cell `B2` that can be copied down to `B3:B5`. (2 marks)

(c) A pivot table is created in the spreadsheet to summarize the total final score for each class.
(i) Identify the fields to place in 'Rows' and 'Values' to display the sum of `Final_Score` grouped by `CLASS_NAME`. (2 marks)
(ii) State one advantage of using a Pivot Chart compared to a standard static chart. (1 mark)

(d) The data is migrated into a relational database table `RESULT(ClassCode, SID, Trial1, Trial2, Trial3, FinalScore)`.
(i) State the primary key for the table `RESULT`. (1 mark)
(ii) Write an SQL query to display the `ClassCode` and the highest `FinalScore` in each class for classes whose highest score is at least 80. (3 marks)

(e) State one reason why the school might prefer a database management system over a spreadsheet when multiple teachers input scores at the same time. (1 mark)
Show answer & marking scheme

Worked solution

(a) `=(SUM(D2:F2) - MIN(D2:F2)) / 2`
(Alternative: `=(LARGE(D2:F2, 1) + LARGE(D2:F2, 2)) / 2` or `=AVERAGE(LARGE(D2:F2, 1), LARGE(D2:F2, 2))`)

(b) `=VLOOKUP(A2, Sheet1!$A$2:$B$5, 2, FALSE)`

(c) (i) Rows: `CLASS_NAME` (or `CLASS_CODE`)
Values: `Sum of Final_Score` (or `Final_Score` with `SUM` aggregation function)
(ii) A pivot chart updates dynamically and allows interactive filtering and drilling-down of grouped data directly from the pivot table.

(d) (i) `SID`
(ii) `SELECT ClassCode, MAX(FinalScore) FROM RESULT GROUP BY ClassCode HAVING MAX(FinalScore) >= 80;`

(e) A DBMS provides concurrent access control (multi-user record locking) to prevent data inconsistency when multiple users write data simultaneously, whereas basic spreadsheets often suffer from file-lock conflicts.

Marking scheme

(a) 1 mark for correct method to extract the top 2 scores (sum minus min, or sum of LARGE 1 and 2).
1 mark for correct range and formula syntax `=(SUM(D2:F2)-MIN(D2:F2))/2`.

(b) 1 mark for `=VLOOKUP(A2, ... , 2, FALSE)`.
1 mark for absolute referencing of the lookup table `Sheet1!$A$2:$B$5`.

(c) (i) 1 mark for Rows: `CLASS_NAME` / `CLASS_CODE`.
1 mark for Values: `Sum of Final_Score`.
(ii) 1 mark for dynamic update / interactive data filtering / multidimensional slicing.

(d) (i) 1 mark for `SID`.
(ii) 1 mark for `SELECT ClassCode, MAX(FinalScore) FROM RESULT`.
1 mark for `GROUP BY ClassCode`.
1 mark for `HAVING MAX(FinalScore) >= 80`.

(e) 1 mark for concurrency control / data locking / prevention of write conflicts during simultaneous multi-user access.
Question 3 · structured
12 marks
A logistics center has established a local computer network connecting desktop workstations, handheld barcode scanners, and internal inventory servers.

(a) Handheld barcode scanners communicate with the warehouse network via Wi-Fi, while fixed checkout computers connect via Cat 6 twisted-pair cables.
(i) State two advantages of using Cat 6 twisted-pair wired connections over Wi-Fi for fixed checkout computers. (2 marks)
(ii) State one measure to prevent unauthorized wireless devices in the warehouse perimeter from connecting to the Wi-Fi network. (1 mark)

(b) The company configures a router with NAT (Network Address Translation) and a firewall connecting the private network to the Internet.
(i) Explain why NAT is used in terms of IPv4 address conservation. (1 mark)
(ii) State two filtering criteria that a packet-filtering firewall can inspect to determine whether an incoming packet should be blocked. (2 marks)

(c) When an operator scans an item, the handheld device sends a request to the inventory server over the network using TCP/IP.
(i) State the function of the Domain Name System (DNS) in this network. (1 mark)
(ii) Give two differences between TCP and UDP, and explain why TCP is suitable for transmitting barcode transaction data. (3 marks)

(d) The logistics company provides an online tracking portal for customers.
(i) State the security protocol indicated by 'HTTPS' in the web address. (1 mark)
(ii) Explain how digital certificates verify the authenticity of the tracking portal. (1 mark)
Show answer & marking scheme

Worked solution

(a) (i) 1. More stable connection with less susceptibility to electromagnetic interference.
2. Typically higher reliable bandwidth and lower latency.
(ii) Enable WPA3/WPA2-Enterprise encryption with strong pre-shared keys / enable MAC address filtering / disable SSID broadcasting.

(b) (i) NAT allows multiple devices on a private LAN to share a single public IPv4 address to communicate on the Internet, conserving limited public IPv4 address space.
(ii) Source IP address / Destination IP address / Port number / Protocol type (TCP/UDP).

(c) (i) DNS translates human-readable domain names (such as inventory.logistics.local) into IP addresses that network devices can route.
(ii) TCP is connection-oriented and provides reliable data transfer with error checking, packet acknowledgment, and retransmission, whereas UDP is connectionless and does not guarantee packet delivery.
TCP is suitable for inventory transaction data because every barcode entry and stock quantity change must be transmitted completely and accurately without missing packets.

(d) (i) Hypertext Transfer Protocol Secure (using SSL/TLS encryption).
(ii) The digital certificate is issued and digitally signed by a trusted Certificate Authority (CA), verifying the domain owner's identity and binding the server's public key to that domain.

Marking scheme

(a) (i) 1 mark each for two valid advantages (max 2 marks):
- Higher transmission stability / immune to wireless radio interference.
- Higher transfer speed / lower latency.
- Better physical transmission security.
(ii) 1 mark for valid wireless security measure (e.g., WPA2/WPA3 enterprise encryption, MAC filtering, 802.1X authentication).

(b) (i) 1 mark for explaining sharing one public IP among many private internal IPs.
(ii) 1 mark each for two valid packet header criteria (max 2 marks): Source IP, Destination IP, Port number, Protocol.

(c) (i) 1 mark for translating domain name to IP address.
(ii) 1 mark for TCP connection-oriented/reliable vs UDP connectionless/unreliable.
1 mark for TCP features: error recovery / acknowledgment / ordered delivery.
1 mark for explaining importance of transaction accuracy (no lost records).

(d) (i) 1 mark for HTTPS (SSL/TLS encrypted HTTP).
(ii) 1 mark for verification by a trusted Certificate Authority (CA) / public key binding.
Question 4 · structured
12 marks
An online learning platform provides video lectures, downloadable handouts, and an AI tutor chatbot for high school students.

(a) The platform stores video lessons in MP4 format instead of uncompressed AVI format.
(i) State the main difference between lossy compression and lossless compression used in multimedia files. (1 mark)
(ii) An uncompressed audio track is sampled at 44.1 kHz, 16-bit resolution in stereo (2 channels). Calculate the data size of a 2-minute uncompressed audio recording in Megabytes (MB). (Show your calculation; take 1 MB = 1024 × 1024 bytes). (2 marks)

(b) The web designer designs the lecture page to meet web accessibility guidelines for visually impaired students.
(i) Suggest two web accessibility features that should be incorporated into the web page. (2 marks)
(ii) State one advantage of using Cascading Style Sheets (CSS) to format the appearance of all course web pages across the platform. (1 mark)

(c) The platform integrates an AI chatbot to automatically answer student queries.
(i) State two benefits of using an AI chatbot over human staff for student support. (2 marks)
(ii) State one ethical or data privacy concern regarding students submitting their questions and personal notes to an AI tutor system. (1 mark)

(d) The platform uses cookies when students log in.
(i) Give one example of useful information stored in a cookie for user convenience. (1 mark)
(ii) State one security risk associated with browser cookies. (1 mark)
(iii) To protect student accounts against automated brute-force login attempts, the system deploys a CAPTCHA. Explain briefly how CAPTCHA prevents automated attacks. (1 mark)
Show answer & marking scheme

Worked solution

(a) (i) Lossy compression permanently discards less noticeable data to achieve smaller file size, whereas lossless compression reduces file size while allowing exact reconstruction of original data.
(ii) Total bits = \(44100 \times 16 \times 2 \times 120 = 169,344,000\text{ bits}\)
Total bytes = \(169,344,000 / 8 = 21,168,000\text{ bytes}\)
Data size in MB = \(21,168,000 / (1024 \times 1024) \approx 20.19\text{ MB}\)

(b) (i) 1. Providing alternative text (`alt` attribute) for all instructional images and diagrams.
2. Enabling text resizability / high-contrast color scheme / screen-reader compatible semantic HTML tags.
(ii) Separation of content from presentation, ensuring consistent layout across all pages and allowing global style changes by updating a single file.

(c) (i) 1. 24/7 round-the-clock availability with instantaneous responses.
2. Ability to handle hundreds of student inquiries simultaneously without fatigue.
(ii) Students' submitted notes or queries may contain personally identifiable information (PII) that could be retained and used for model training without informed consent.

(d) (i) Session token / user login status / preferred theme (dark mode) / interface language.
(ii) Session hijacking / cross-site scripting (XSS) attacks stealing authentication cookies.
(iii) CAPTCHA presents challenges (such as distorted text, image recognition, or puzzle completion) that are simple for humans to solve but difficult for automated scripts/bots to process, blocking automated repetitive attempts.

Marking scheme

(a) (i) 1 mark for lossy discarding redundant data irreversibly vs. lossless retaining 100% original data.
(ii) 1 mark for correct formula setup \(44100 \times 16 \times 2 \times 120 / 8\).
1 mark for final calculated answer \(\approx 20.19\text{ MB}\) (accept 20.18 - 20.2 MB, or \(21.17\text{ MB}\) if 1 MB = \(10^6\) bytes is specified).

(b) (i) 1 mark each for two accessibility features (max 2 marks): `alt` tags, high contrast, screen reader compatibility, keyboard navigation, audio descriptions.
(ii) 1 mark for centralized styling / easier maintenance / consistent layout across pages.

(c) (i) 1 mark each for two benefits (max 2 marks): 24/7 service, instant feedback, handles large volume concurrently, reduces staff costs.
(ii) 1 mark for privacy leakage of student work / unauthorized data training / profiling.

(d) (i) 1 mark for valid cookie content (e.g., session ID, language preference, theme setting).
(ii) 1 mark for valid security risk (e.g., cookie theft / session hijacking / cross-site tracking).
(iii) 1 mark for distinguishing human vs automated bot through Turing-style challenges.
Question 5 · structured
12 marks
A programmer develops subprograms to process an array `A` of \(N\) integers indexed from 1 to \(N\).

Consider Algorithm `ALG1`:
```text
Line 1: count ← 0
Line 2: for i from 1 to N do
Line 3: if A[i] > 0 then
Line 4: count ← count + 1
Line 5: if count >= (N / 2) then
Line 6: flag ← TRUE
Line 7: else
Line 8: flag ← FALSE
```

(a) Suppose \(N = 5\) and array `A` contains `[3, -2, 4, 1, -5]`.
(i) Trace the algorithm and state the final values of `count` and `flag`. (2 marks)
(ii) How many times is Line 3 executed? (1 mark)

(b) Consider Algorithm `ALG2`:
```text
Line 1: i ← 1
Line 2: count ← 0
Line 3: while (i <= N) AND (count < N / 2) do
Line 4: if A[i] > 0 then
Line 5: count ← count + 1
Line 6: i ← i + 1
Line 7: if count >= (N / 2) then
Line 8: flag ← TRUE
Line 9: else
Line 10: flag ← FALSE
```
(i) Suppose \(N = 6\) and `A` contains `[5, 8, 2, 4, 1, 9]`. How many times will Line 4 be executed in `ALG2`? (1 mark)
(ii) Explain why `ALG2` can be more efficient than `ALG1` in the best-case scenario. (2 marks)

(c) The programmer writes `ALG3` to find the maximum value in an array `A` of \(N\) positive integers:
```text
Line 1: maxVal ← A[1]
Line 2: for i from 2 to N do
Line 3: if [ Expression 1 ] then
Line 4: [ Statement 2 ]
Line 5: return maxVal
```
Complete:
(i) `[ Expression 1 ]` (1 mark)
(ii) `[ Statement 2 ]` (1 mark)

(d) When searching for a target key in a sorted array `A` of 1000 items:
(i) State why Binary Search is more efficient than Linear Search. (1 mark)
(ii) Calculate the maximum number of comparisons required to find a key or determine it is absent using Binary Search on 1000 items. (1 mark)

(e) During the fetch-decode-execute cycle of a CPU executing these program instructions:
(i) State the register that holds the address of the next instruction to be fetched. (1 mark)
(ii) State the CPU component responsible for performing arithmetic comparisons like `A[i] > 0`. (1 mark)
Show answer & marking scheme

Worked solution

(a) (i) Array elements greater than 0 are `A[1]=3`, `A[3]=4`, `A[4]=1`. Thus, `count` = 3.
\(N/2 = 5/2 = 2.5\). Since \(3 \ge 2.5\), `flag` = TRUE.
(ii) 5 times.

(b) (i) For \(N = 6\), \(N/2 = 3\).
When \(i = 1\): `A[1] = 5 > 0` \(\rightarrow\) `count` = 1, `i` becomes 2.
When \(i = 2\): `A[2] = 8 > 0` \(\rightarrow\) `count` = 2, `i` becomes 3.
When \(i = 3\): `A[3] = 2 > 0` \(\rightarrow\) `count` = 3, `i` becomes 4.
At the start of loop iteration with \(i = 4\), condition `(count < N/2)` is `(3 < 3)` which evaluates to FALSE. The loop terminates.
Therefore, Line 4 is executed 3 times.
(ii) In `ALG1`, the loop always iterates \(N\) times regardless of array values. In `ALG2`, the `while` loop terminates early as soon as `count` reaches \(N/2\), performing fewer comparisons and saving execution time when positive numbers appear early in the array.

(c) (i) `A[i] > maxVal`
(ii) `maxVal ← A[i]`

(d) (i) Binary Search halves the remaining search space in each comparison (time complexity \(O(\log N)\)), whereas Linear Search checks elements one by one sequentially (time complexity \(O(N)\)).
(ii) \(\lceil \log_2(1000) \rceil = 10\) comparisons (since \(2^9 = 512 < 1000 \le 1024 = 2^{10}\)).

(e) (i) Program Counter (PC).
(ii) Arithmetic and Logic Unit (ALU).

Marking scheme

(a) (i) 1 mark for `count = 3`.
1 mark for `flag = TRUE`.
(ii) 1 mark for 5.

(b) (i) 1 mark for 3.
(ii) 1 mark for recognizing early termination / loop exit condition.
1 mark for explaining that fewer iterations/comparisons are executed when threshold is reached.

(c) (i) 1 mark for `A[i] > maxVal`.
(ii) 1 mark for `maxVal ← A[i]`.

(d) (i) 1 mark for explaining logarithmic reduction of search range / halving search space vs sequential search.
(ii) 1 mark for 10 comparisons.

(e) (i) 1 mark for Program Counter (PC).
(ii) 1 mark for Arithmetic Logic Unit (ALU).

Paper 2 (Elective Structured Questions)

Answer any three out of four questions in the chosen elective module paper.
3 Question · 45 marks
Question 1 · Elective Structured Case Study
15 marks
A health club chain operates multiple gym centres across Hong Kong and uses a relational database to manage fitness sessions and member reservations.

Database schema:

`MEMBER (MemID, MName, JoinDate, Tier)`
Primary key: `MemID`

`STUDIO (StudioID, CentreName, Capacity)`
Primary key: `StudioID`

`SESSION (SessionID, StudioID, CoachName, SDate, STime, Duration, Fee)`
Primary key: `SessionID`
Foreign key: `StudioID` references `STUDIO`

`BOOKING (MemID, SessionID, BDate, Status)`
Primary key: `MemID` + `SessionID`
Foreign key: `MemID` references `MEMBER`, `SessionID` references `SESSION`

(a) Write SQL statements for the following requests:
(i) List the names of all members (`MName`) who have made a booking with `Status = 'CONFIRMED'` for sessions held on `'15/10/2023'`. Avoid duplicate names in the output. (2 marks)

(ii) Find the total revenue generated from confirmed bookings for each studio in October 2023 (i.e. `SDate` between `'01/10/2023'` and `'31/10/2023'`). Display the `StudioID` and the total revenue aliased as `TOTAL_REVENUE`. Only include studios where the total revenue exceeds $5,000. (3 marks)

(b) The system administrator plans to construct a view to help reception staff check room availability.
(i) Describe how a VIEW named `STUDIO_UTIL` can be constructed to display each `StudioID`, `CentreName`, and the total number of sessions scheduled in that studio. (2 marks)
(ii) Give one advantage and one security limitation of using database views for staff reporting. (2 marks)

(c) The management initially recorded unnormalized class records in a single table `FITNESS_LOG`:
`FITNESS_LOG (MemID, MName, SessionID, StudioID, CentreName, Fee)`
where each member can book multiple sessions, and each session takes place in one studio with a fixed fee.
(i) State two functional dependencies that violate Second Normal Form (2NF) or Third Normal Form (3NF) in `FITNESS_LOG`. (2 marks)
(ii) Decompose `FITNESS_LOG` into a set of 3NF relations. For each relation, specify its name, attribute list, and primary key. (4 marks)
Show answer & marking scheme

Worked solution

(a) (i)
```sql
SELECT DISTINCT M.MName
FROM MEMBER M, BOOKING B, SESSION S
WHERE M.MemID = B.MemID
AND B.SessionID = S.SessionID
AND B.Status = 'CONFIRMED'
AND S.SDate = '15/10/2023';
```

(ii)
```sql
SELECT S.StudioID, SUM(S.Fee) AS TOTAL_REVENUE
FROM SESSION S, BOOKING B
WHERE S.SessionID = B.SessionID
AND B.Status = 'CONFIRMED'
AND S.SDate >= '01/10/2023' AND S.SDate <= '31/10/2023'
GROUP BY S.StudioID
HAVING SUM(S.Fee) > 5000;
```

(b) (i)
Create a view that joins `STUDIO` and `SESSION`, groups by `StudioID` and `CentreName`, and counts the occurrences of `SessionID` (e.g. `COUNT(S.SessionID)`).
```sql
CREATE VIEW STUDIO_UTIL AS
SELECT ST.StudioID, ST.CentreName, COUNT(SE.SessionID) AS SESSION_COUNT
FROM STUDIO ST LEFT JOIN SESSION SE ON ST.StudioID = SE.StudioID
GROUP BY ST.StudioID, ST.CentreName;
```

(ii)
- Advantage: Simplifies complex queries for reception staff by hiding intricate table joins / provides logical data independence.
- Security limitation / disadvantage: Views do not enforce row-level access control on their own without dedicated permission configurations, or complex nested views can cause performance overhead during high concurrency.

(c) (i) Functional dependencies violating normalization:
- `MemID` -> `MName` (Partial dependency on composite key `MemID` + `SessionID`, violating 2NF)
- `StudioID` -> `CentreName` (Transitive dependency via `SessionID` -> `StudioID` -> `CentreName`, violating 3NF)

(ii) Decomposed 3NF relations:
1. `MEMBER (MemID, MName)` — Primary key: `MemID`
2. `STUDIO (StudioID, CentreName)` — Primary key: `StudioID`
3. `SESSION (SessionID, StudioID, Fee)` — Primary key: `SessionID`, Foreign key: `StudioID`
4. `BOOKING (MemID, SessionID)` — Primary key: `MemID` + `SessionID`

Marking scheme

(a) (i) 2 marks:
- 1 mark for correct tables in `FROM` and join conditions (`M.MemID = B.MemID AND B.SessionID = S.SessionID`).
- 1 mark for correct selection criteria (`DISTINCT`, `Status = 'CONFIRMED'`, `SDate = '15/10/2023'`).

(ii) 3 marks:
- 1 mark for correct table joins and filtering (`Status = 'CONFIRMED'` and October 2023 date range).
- 1 mark for correct `GROUP BY S.StudioID` and `SUM(S.Fee) AS TOTAL_REVENUE`.
- 1 mark for correct `HAVING SUM(S.Fee) > 5000` clause.

(b) (i) 2 marks:
- 1 mark for `CREATE VIEW STUDIO_UTIL AS SELECT ...` structure.
- 1 mark for grouping by Studio and using `COUNT()` aggregation.

(ii) 2 marks:
- 1 mark for reasonable advantage (e.g. abstraction, simplified querying, data hiding).
- 1 mark for valid limitation/security consideration.

(c) (i) 2 marks:
- 1 mark for identifying partial key dependency (`MemID -> MName`).
- 1 mark for identifying transitive dependency (`StudioID -> CentreName` or `SessionID -> StudioID -> CentreName`).

(ii) 4 marks:
- 1 mark for each correctly decomposed relation with its primary key identified (4 relations total).
Question 2 · Elective Structured Case Study
15 marks
A private medical clinic designs its local computer network. The clinic is assigned the private network address block `192.168.16.0/22`.

The network is partitioned into four functional subnets:
- Subnet A (Consultation Rooms & Doctors' PCs): requires up to 100 host addresses.
- Subnet B (Medical Diagnostic Lab & Imaging Equipment): requires up to 55 host addresses.
- Subnet C (Administrative & Billing Computers): requires up to 30 host addresses.
- Subnet D (Guest Wi-Fi for Patients): requires up to 200 host addresses.

(a) Network Subnetting and Addressing:
(i) Determine the subnet mask in dotted-decimal notation for Subnet D that can accommodate at least 200 hosts with the minimal allocation of host bits. (1 mark)
(ii) Suppose Subnet B is allocated the subnet range `192.168.17.0/26`. State the usable host IP address range and the directed broadcast address for Subnet B. (2 marks)
(iii) State one advantage of using Variable Length Subnet Masking (VLSM) instead of Fixed Length Subnet Masking (FLSM) in this clinic setup. (1 mark)

(b) Network Services and Operation:
(i) Explain how a Dynamic Host Configuration Protocol (DHCP) server automatically allocates network parameters to a doctor's laptop connecting to Subnet A. State two parameters assigned besides the client IP address. (3 marks)
(ii) Explain why the clinic router must perform Network Address Translation (NAT) when internal devices communicate with external medical cloud repositories over the public Internet. (2 marks)

(c) Security and Traffic Segregation:
(i) Give two reasons why patient Wi-Fi traffic (Subnet D) must be isolated from the clinical and imaging subnets (Subnet A and Subnet B) using VLANs or firewall rules. (2 marks)
(ii) Explain the difference between a stateless packet filter and a stateful inspection firewall when protecting the clinic's internal database server from unauthorized incoming traffic. (2 marks)

(d) Transmission Protocol Selection:
During a consultation, two types of data are transferred:
- Type 1: Real-time high-definition video conferencing with an external specialist doctor.
- Type 2: Digital X-ray DICOM image files downloaded from the imaging server.
For each data type, state whether TCP or UDP is more appropriate and give a reason from a technical perspective. (2 marks)
Show answer & marking scheme

Worked solution

(a) (i) For 200 hosts, 8 host bits are needed ( $2^8 - 2 = 254 \ge 200 $).
Subnet mask = `/24` = `255.255.255.0`.

(ii) For `192.168.17.0/26`:
- Usable IP range: `192.168.17.1` to `192.168.17.62`
- Directed broadcast address: `192.168.17.63`

(iii) VLSM allows subnets of different sizes according to the exact needs of each department, preventing waste of IP addresses compared to FLSM where all subnets must be sized to the largest requirement.

(b) (i) The DHCP process uses the DORA exchange (Discover, Offer, Request, Acknowledge) where the client broadcasts a discovery message and the server leases an IP configuration.
Two additional parameters: Subnet mask, Default gateway (or DNS server address).

(ii) NAT translates internal private IP addresses (`192.168.x.x`, which are non-routable on the public Internet) into a globally unique public IP address provided by the ISP, while also conserving public IPv4 addresses and hiding internal network topology.

(c) (i)
1. Prevents unauthorized guests/patients from sniffing, intercepting, or tampering with sensitive patient medical and billing records.
2. Prevents malware or infected personal devices on the guest network from spreading to mission-critical clinic equipment and database servers.

(ii)
- Stateless packet filter inspects each packet in isolation based solely on static rules (e.g., source/destination IP, port number), without tracking connection state.
- Stateful inspection firewall keeps track of active transport connections in a state table; it dynamically permits inbound packets only if they belong to an established, valid session initiated from within the trusted internal network.

(d)
- Type 1 (Real-time video): UDP. It has low transmission latency and no retransmission delays; small packet loss causes minor visual glitches without stalling the real-time stream.
- Type 2 (X-ray DICOM files): TCP. It provides reliable, error-checked, in-order packet delivery to ensure that critical medical imaging data is transmitted completely without any corruption.

Marking scheme

(a) (i) 1 mark: `255.255.255.0` (or `/24`).
(ii) 2 marks:
- 1 mark for correct usable range (`192.168.17.1` - `192.168.17.62`).
- 1 mark for correct broadcast address (`192.168.17.63`).
(iii) 1 mark for explaining conservation of IP address space / flexible sizing.

(b) (i) 3 marks:
- 1 mark for explaining lease allocation / DORA broadcast mechanism.
- 1 mark each for two other parameters (e.g., Default gateway, Subnet mask, DNS server IP) (max 2 marks).
(ii) 2 marks:
- 1 mark for private IP non-routability on public Internet.
- 1 mark for translation to public IP / security benefit of hiding internal network topology.

(c) (i) 2 marks: 1 mark each for any two valid security/operational reasons (privacy of medical data, malware isolation, bandwidth management).
(ii) 2 marks:
- 1 mark for explaining stateless inspection based on individual packet headers.
- 1 mark for explaining stateful tracking of active connections and allowing return traffic dynamically.

(d) 2 marks:
- 1 mark for Type 1: UDP + latency/no retransmission overhead justification.
- 1 mark for Type 2: TCP + reliability/lossless/error checking justification.
Question 3 · Elective Structured Case Study
15 marks
A company operates a smart parcel delivery locker system. The locker cabinet has $N$ compartments numbered from $1$ to $N$. An integer array `Locker[1..N]` represents the status of the compartments, where:
- `Locker[i] = 0` indicates compartment `i` is empty.
- `Locker[i] > 0` indicates compartment `i` is occupied and stores the customer's 4-digit pickup passcode.

(a) Subprogram `FindEmpty(N)` searches for the first available empty compartment starting from compartment $1$.

```text
Line 1: pos ← -1
Line 2: i ← 1
Line 3: WHILE (i <= N) AND (pos = -1) DO
Line 4: IF Locker[i] = 0 THEN
Line 5: pos ← i
Line 6: i ← i + 1
Line 7: RETURN pos
```

(i) Trace the execution of `FindEmpty(5)` when `Locker = [4123, 8821, 0, 9302, 0]`. State the number of times Line 4 is executed and the return value. (2 marks)
(ii) What value is returned by `FindEmpty(N)` if all compartments are currently occupied? (1 mark)

(b) When a customer collects a parcel, they enter a passcode `code`. Subprogram `CollectParcel(N, code)` validates the passcode, clears the locker if found, and returns the compartment index, or returns $-1$ if not found.

```text
Subprogram CollectParcel(N, code)
k ← 1
target ← -1
WHILE (k <= N) AND (target = -1) DO
IF Locker[k] = code THEN
Locker[k] ← 0
target ← k
k ← k + 1
RETURN target
```

(i) State the best-case and worst-case number of comparisons executed in the `IF` statement of `CollectParcel(N, code)`. (2 marks)
(ii) A developer suggests sorting the array `Locker` in ascending order so that binary search can be used in `CollectParcel`. Explain why this suggestion is NOT practical in this application. (2 marks)

(c) The system uses a linear queue of capacity `MAX` implemented with an array `Queue[1..MAX]`, `head`, and `tail` to store incoming parcel registration numbers waiting for allocation. Initially, `head ← 1` and `tail ← 0`.

(i) Write the pseudocode for subprogram `Enqueue(parcelID)` to insert an element into the queue. The subprogram should output `'Queue Full'` if the queue has reached capacity `MAX`. (3 marks)
(ii) What is the advantage of using a circular queue over a linear array queue when elements are repeatedly enqueued and dequeued? (2 marks)

(d) During software testing, the development team conducts unit testing and user acceptance testing (UAT).
(i) State one distinct difference in purpose between unit testing and user acceptance testing. (2 marks);
(ii) Name one white-box testing technique used during the unit testing phase. (1 mark)
Show answer & marking scheme

Worked solution

(a) (i)
- Line 4 is executed 3 times (for `i = 1, 2, 3`). At `i = 3`, `Locker[3] = 0`, so `pos` becomes 3, terminating the loop after `i ← 4`.
- Return value: `3`.

(ii) Value returned: `-1`.

(b) (i)
- Best-case: 1 comparison (when the target passcode is located in `Locker[1]`).
- Worst-case: $N $ comparisons (when the target passcode is at `Locker[N]` or not present in the array).

(ii)
Sorting the `Locker` array would destroy the fixed mapping between the physical locker compartment index (1 to $N$) and the stored passcode. When a customer arrives, the system must open the exact physical locker where the parcel was deposited.

(c) (i)
```text
Subprogram Enqueue(parcelID)
IF tail >= MAX THEN
OUTPUT 'Queue Full'
ELSE
tail ← tail + 1
Queue[tail] ← parcelID
```

(ii)
In a simple linear array queue, dequeuing elements causes unused empty slots at the front of the array that cannot be reused without shifting all elements (false overflow). A circular queue wraps around using modulo arithmetic, reusing freed positions efficiently without moving data.

(d) (i)
- Unit testing tests individual modules/subprograms in isolation to ensure internal logic correctness and identify coding errors.
- User Acceptance Testing (UAT) is performed by end users or clients in a real/production-like environment to verify whether the system meets the actual business requirements and workflow needs.

(ii) Statement coverage / Branch coverage / Path coverage / Condition coverage.

Marking scheme

(a) (i) 2 marks:
- 1 mark for correct execution count (3 times).
- 1 mark for correct return value (3).
(ii) 1 mark for `-1`.

(b) (i) 2 marks:
- 1 mark for best case (1).
- 1 mark for worst case ( $N $).
(ii) 2 marks: Award 2 marks for clearly explaining that array index represents physical compartment position, and sorting changes the position mapping (award 1 mark if explanation is partial).

(c) (i) 3 marks:
- 1 mark for overflow condition check (`tail >= MAX`).
- 1 mark for updating pointer (`tail ← tail + 1`).
- 1 mark for assignment (`Queue[tail] ← parcelID`).
(ii) 2 marks for explaining reuse of deallocated space / eliminating false overflow without shifting elements.

(d) (i) 2 marks: 1 mark for focus of unit testing (component level / code correctness) and 1 mark for focus of UAT (business requirement / user satisfaction).
(ii) 1 mark for naming any valid white-box technique (Statement/Branch/Path coverage/Basis path testing).

Wondering how well you actually know this?

thinka is an AI practice app for DSE students: unlimited questions, instant auto-marking, and detailed step-by-step solutions. 100,000+ students use it to confirm they actually know it, not just think they do.

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

Start Practising Free