/en-s5-ict-data-representation-databases-algorithms-practice-paper/
/en-s5-ict-data-representation-databases-algorithms-practice-paper/
英文版
3
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

S5 ICT Practice Paper: Data Representation, Databases and Algorithms (12 Questions, 100 Marks, 75 Minutes, Answers Included) | Original Mock Paper

S5 ICT Practice Paper: Data Representation, Databases and Algorithms (12 Questions, 100 Marks, 75 Minutes, Answers Included) | Original Mock Paper

  • 2026-11-06

HKDSE ICT: Data Representation, Databases and Algorithms

S5 ICT practice paper, 12 questions, 100 marks, 75 minutes: two’s complement and hexadecimal, bitmap and audio file size, character encoding, binary search and bubble sort, SQL aggregate qu

Paper details Level: S5 | Subject: ICT | Time: 75 minutes | Marks: 100 | Questions: 12 | Answers included

Section A: Data Representation, Encoding and File Size (24 marks)

Each question carries 6 marks; show your working or reasoning.

# Question Answer and marking notes
1 A database stores integers as 8-bit two’s complement. (a) Convert the decimal number 173 to an 8-bit binary number and to hexadecimal. (b) State the range of integers that 8-bit two’s complement can represent and explain the role of the most significant bit. (a) 173 = 128 + 32 + 8 + 4 + 1 = 10101101 in binary = AD in hexadecimal. (b) The most significant bit is the sign bit: 0 for positive and 1 for negative; the other 7 bits hold the magnitude, giving 0 to 127 and -1 to -128. Marking points: correct binary, hexadecimal and sign-bit explanation.
2 An uncompressed bitmap is 1024 x 768 pixels with a colour depth of 24 bits. (a) Find the number of bits and bytes. (b) Express the file size in MiB. (c) If the colour depth becomes 8 bits, what fraction of the original size is the file? (a) Bits = 1024 x 768 x 24 = 18,874,368 bits; bytes = 18,874,368/8 = 2,359,296 B. (b) 2,359,296/1048576 = 2.25 MiB. (c) 8 bits is one third of 24 bits, so the file is one third of the original. Marking points: correct unit conversion (1 MiB = 2^20 B).
3 Audio is recorded at a sample rate of 44100 Hz with 16-bit resolution in stereo (2 channels) for 60 seconds. (a) Find the number of bytes of uncompressed audio. (b) Express it in MiB. (c) Explain how raising the sample rate affects file size and sound quality. (a) Bytes = 44100 x 2 x 2 x 60 = 10,584,000 B. (b) 10,584,000/1048576 = 10.09 MiB. (c) A higher sample rate records more samples per second, so the file grows proportionally, but higher frequencies can be captured and quality improves; beyond about 20 kHz the benefit is small. Marking points: formula, units, quality explanation.
4 A passage contains 500 ASCII characters and 300 Chinese characters. (a) Using UTF-8 (1 byte per ASCII character, 3 bytes per Chinese character), find the total number of bytes. (b) Using UTF-16 (2 bytes per character), find the total number of bytes. (c) Which encoding is more economical here? (a) UTF-8: 500 x 1 + 300 x 3 = 1,400 B. (b) UTF-16: (500 + 300) x 2 = 1,600 B. (c) UTF-8 is smaller here (1,400 B is less than 1,600 B); if the text were all Chinese, UTF-8 would use 3 bytes per character and be larger than UTF-16 at 2 bytes. Marking points: both calculations and the comparison.

Section B: Algorithms, Programming and SQL (36 marks)

Each question carries 9 marks; note the marks for each part.

# Question Answer and marking notes
5 A binary search is performed on 1000 records already sorted by key. (a) Find the worst-case number of comparisons and show your reasoning. (b) Explain why binary search has time complexity O(log n). (c) Can binary search be used on an unsorted singly linked list? Explain. (a) Each comparison halves the search range, so we need 2^k >= 1000; 2^9 = 512 is below 1000, and 1,024 = 2^10, so at most 10 comparisons. (b) The number of comparisons is about log2 n, hence O(log n), far better than linear search O(n). (c) No: a linked list has no O(1) random access, so reaching the middle element costs O(n) each time and the advantage is lost. Marking points: power-of-two reasoning, complexity, list limitation.
6 Bubble sort is used to sort 8 elements. (a) Find the worst-case number of comparisons. (b) If each comparison takes 2 microseconds, find the total comparison time. (c) Compare bubble sort with merge sort for large data sets. (a) Worst case comparisons = n(n-1)/2 = 8 x 7/2 = 28. (b) 28 x 2 microseconds = 56 microseconds. (c) Bubble sort is O(n^2) while merge sort is O(n log n); for large n merge sort is much faster (about 500,000 versus 10,000 comparisons at n = 1,000). Marking points: formula, time, complexity comparison.
7 The table Student(SID, Name, Class, Score) contains: S1 5A 78, S2 5A 65, S3 5B 88, S4 5B 91, S5 5A 55. Give the result of SELECT Class, COUNT(*) FROM Student WHERE Score >= 70 GROUP BY Class; and explain the order in which WHERE and GROUP BY are evaluated. (a) Result: 5A has 1 row (78) and 5B has 2 rows (88, 91); S2 (65) and S5 (55) fall below 70 and are removed. (b) The logical order is FROM, then WHERE (filter), then GROUP BY (grouping), then the aggregate COUNT. Marking points: both counts and the evaluation order.
8 A system uses even parity to check the 7-bit data 1011001. (a) Find the parity bit. (b) If two bits are corrupted during transmission, can parity checking detect this? Explain. (c) Suggest a method that can correct a single-bit error. (a) The data 1011001 contains 4 ones, an even number, so the even parity bit is 0 and the total number of ones stays even. (b) Two simultaneous bit errors change the number of ones by 0 or 2, which is still even, so parity checking cannot detect them. (c) A Hamming code adds several check bits and can locate and correct a single-bit error. Marking points: parity value, double-error analysis, Hamming code.

Section C: Networks, Compression and Systems Evaluation (40 marks)

Each question carries 10 marks; give full explanations or evaluations.

# Question Answer and marking notes
9 A 20 MiB file is transferred over a 8 Mbps link, ignoring protocol overhead (1 MiB = 2^20 bytes). (a) Find the transfer time in seconds. (b) Express it in minutes and seconds. (c) If the throughput doubles, by what percentage does the time fall? (a) Bits = 20 x 2^20 x 8 = 167,772,160 bits; time = 167,772,160/8,000,000 = 20.97 s. (b) About 0 minutes 21 seconds. (c) Doubling the throughput halves the time, a 50% reduction. Marking points: bit and byte conversion, consistent units, percentage.
10 The 2.25 MiB image above is compressed to 620,000 bytes. (a) Find the compression ratio (original to compressed). (b) Find the percentage of bytes saved. (c) Explain the effect of image compression on the first-load time of a teaching website, and name one lossless and one lossy format. (a) Compression ratio = 2,359,296/620,000 = 3.81 to 1. (b) Saving = (1 – 620,000/2,359,296) x 100 = 73.7%. (c) A smaller file shortens download and first paint, improving user experience and data usage; lossless formats include PNG and GIF, lossy formats include JPEG and WebP in lossy mode. Marking points: ratio, percentage, one format of each kind.
11 A circuit outputs Y = (A AND NOT B) OR C. (a) Draw the truth table for inputs A, B and C (8 rows). (b) Find the number of input combinations with Y = 1. (c) Outline an implementation using NAND gates only. (a) Truth table A B C to Y: 000:0, 001:1, 010:0, 011:1, 100:1, 101:1, 110:1, 111:1 (eight rows). (b) Y = 1 for 5 combinations: A=1 with B=0 gives 100 and 101, and C=1 gives 001, 011, 101 and 111; 101 is counted once, so the total is 5. (c) With NAND gates: NOT B = B NAND B, A AND NOT B = (A NAND (B NAND B)), then two NAND gates form the OR, and a final NAND gives Y. Marking points: eight-row table, combination count, NAND structure.
12 A table Student(SID, Name, Class, Teacher, TeacherPhone) has one row per SID, and each Teacher has exactly one phone number. (a) Identify the primary key (primary key). (b) Explain why the table is not in Third Normal Form (3NF) and identify the transitive dependency. (c) Write the decomposed tables and state the benefits. (a) The primary key is SID, since each student is unique. (b) SID determines Teacher and Teacher determines TeacherPhone, so TeacherPhone depends transitively on the key through Teacher rather than directly; this violates 3NF, which forbids dependencies between non-key attributes. (c) Decompose into Student(SID, Name, Class, Teacher) and Teacher(Teacher, TeacherPhone); this removes duplication and update anomalies, saves space and keeps data consistent. Marking points: primary key, transitive dependency, two-table decomposition.

Find a tutor — freeTutor Registration →

A TutorZone practice paper; original questions and passages, not publisher material.

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →