/en-s4-ict-binary-two-complement-image-file-size-bubble-sort-linear-binary-search-recursion-debugging-sql-query-subnetting-sdlc-practice-paper/
/en-s4-ict-binary-two-complement-image-file-size-bubble-sort-linear-binary-search-recursion-debugging-sql-query-subnetting-sdlc-practice-paper/
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

S4 Information and Communication Technology Practice Paper 4: Binary and Two’s Complement, Image File Size, Bubble Sort and Searching, Recursion and Debugging, SQL Queries, Subnetting and System Development (100 marks)

S4 Information and Communication Technology Practice Paper 4: Binary and Two’s Complement, Image File Size, Bubble Sort and Searching, Recursion and Debugging, SQL Queries, Subnetting and System Development (100 marks)

  • 2026-11-20

ICT | S4 | Practice Paper

S4 ICT practice paper 4: 24 questions with answers on binary, two’s complement, image file size, sorting and search, Python debugging, SQL, subnetting and SDLC.

Paper details Level: S4 | Subject: ICT | 24 questions with worked answers | 100 marks | 60 minutes

Part A: Data Representation and Binary (16 marks)

Show all working; write binary answers with all 8 bits.

# Question Answer and marking notes
1 Convert the binary number 10110110 to a denary number. Add the place values from left to right: 128 + 32 + 16 + 4 + 2 = 182.
2 Convert the denary number 205 to an 8-bit binary number. 205 = 128 + 64 + 8 + 4 + 1, so the binary is 11001101.
3 Write the 8-bit two’s complement representation of -46. Take 46 as 00101110, invert to 11010001 and add 1 to get 11010010; equivalently 2^8 – 46 = 210 in binary is 11010010.
4 An uncompressed 24-bit true colour image is 1920 x 1080 pixels. What is its file size in MB? (1 MB = 2^20 bytes, 2 decimal places) Number of pixels = 1920 x 1080 = 2073600; at 3 bytes per pixel the total is 6220800 bytes; dividing by 2^20 gives 5.93 MB.

Part B: Algorithms and Trace Tables (16 marks)

Show the trace; answers must match the trace table.

# Question Answer and marking notes
5 A bubble sort in ascending order is applied to [5, 2, 9, 1]. Write the array after the first pass. The first pass compares adjacent items: swap 5 and 2 to get [2, 5, 9, 1]; 5 and 9 stay; swap 9 and 1, giving [2, 5, 1, 9], with the largest value 9 bubbled to the end.
6 A linear search is performed on an unsorted array of 100 elements. How many comparisons are needed in the worst case? In the worst case every element must be checked before concluding the item is absent, so 100 comparisons are needed; on average about 50.
7 A binary search is performed on 1,000 sorted elements. How many comparisons are needed in the worst case? (whole number) Each comparison halves the search range, so ceil(log2(1001)) = 10 comparisons are needed.
8 A recursive function is defined by f(0) = 0, f(1) = 1 and f(n) = f(n-1) + f(n-2). Find f(6). Working term by term: 0, 1, 1, 2, 3, 5, 8, so f(6) = 8.

Part C: Programming and Debugging (17 marks)

Answer in Python syntax; for the debugging question state the fault and the correction.

# Question Answer and marking notes
9 In Python, what are the values of 7 // 2 and 7 % 2? 7 // 2 is integer division giving 3; 7 % 2 is the remainder giving 1.
10 What is the value of total after this code runs? total = 0; for i in range(1, 5): total += i range(1, 5) yields 1, 2, 3 and 4 (5 is excluded), and their sum is 1 + 2 + 3 + 4 = 10.
11 Given s = “TutorZone”, what is the value of the slice s[:5]? The slice takes indexes 0 to 4 inclusive, five characters, giving “Tutor”.
12 A program should test whether a score is a pass (from 50 to 100) with if score > 50 or score < 100. With score = 120 it wrongly reports a pass. State the cause and write the correct condition. The fault is using or: the whole condition is true if either part is true, and 120 > 50 is true, so it is reported as a pass even though 120 exceeds the upper limit. Use if score >= 50 and score <= 100: so that both the lower and upper bounds must hold.

Part D: Databases and SQL Queries (17 marks)

Write SQL keywords in capitals; use the record counts given in each question.

# Question Answer and marking notes
13 A student table holds 12 records, 5 of which have form = “S4”. How many rows are returned by SELECT * FROM students WHERE form = “S4”? The WHERE clause keeps only records whose form is S4, of which there are 5, so 5 rows are returned and the other 7 do not satisfy the condition.
14 An orders table has 10 records with amount values 200, 650, 700, 450, 900, 300, 550, 120, 800 and 1000. What does SELECT COUNT(*) FROM orders WHERE amount > 500 return? The values greater than 500 are 650, 700, 900, 550, 800 and 1000, that is 6 records; the test is greater than, not greater than or equal to, so 500 itself is excluded.
15 What order does SELECT mark FROM results ORDER BY mark DESC output for the mark values 45, 88 and 72? DESC sorts from the largest to the smallest, so the output is 88, 72, 45.
16 Explain the difference between a primary key and a foreign key, giving one example of each. A primary key uniquely identifies each record in a table; its values are unique and cannot be null, for example student_id in a student table. A foreign key is a field that references the primary key of another table to link the two tables; its values may repeat, for example student_id in a results table pointing to the student table.

Part E: Computer Networks and the Internet (17 marks)

Show the working; write IP addresses in full four-part form.

# Question Answer and marking notes
17 What is the CIDR prefix length of the subnet mask 255.255.255.192? 255.255.255 accounts for 24 bits and 192 (128 + 64) adds the remaining 2, giving /26 in total.
18 How many usable host addresses does a subnet with a /26 mask provide? Host bits = 32 – 26 = 6, so there are 2^6 = 64 addresses; after removing the network and broadcast addresses, 62 are usable.
19 An IP address 192.168.10.130 uses a /26 mask. What is its network address? Each /26 subnet holds 64 addresses; 130 falls in the 128 to 191 block, so the network address is 192.168.10.128 and the broadcast address is 192.168.10.191.
20 A computer can ping 127.0.0.1 successfully but cannot ping another computer on the same subnet. Give two possible reasons. Possible reasons include: (1) the firewall on the other computer blocks ICMP echo requests; (2) that computer is switched off or its cable is loose or the switch port is faulty; (3) the IP address or subnet mask of one machine is misconfigured so they are not on the same subnet; (4) the switch link or VLAN setting is wrong. Any two acceptable reasons score full marks.

Part F: System Development and Project Management (17 marks)

Answer in full sentences; show the calculation where required.

# Question Answer and marking notes
21 List the five stages of the system development life cycle (SDLC). The five stages are system analysis, system design, system implementation (coding), system testing, and system conversion and maintenance (evaluation).
22 A project has four tasks taking 3, 5, 2 and 4 days; tasks 2 and 3 can run in parallel while the rest must run in sequence. What is the shortest total duration in days? When tasks 2 and 3 run in parallel the longer one governs, that is 5 days, so the total is 3 + 5 + 4 = 12 days.
23 What is the purpose of user acceptance testing (UAT)? UAT is carried out by real users working through actual business scenarios to confirm that the system meets the requirements and is fit for live use; the system is only released after UAT passes, so gaps in functions or workflow are found early.
24 A system has 3 modules with 40 test cases each, and 96 cases have passed. Find the pass rate as a percentage. Total test cases = 3 x 40 = 120; pass rate = 96 / 120 x 100% = 80%.

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 →