/en-s5-ict-programming-modular-oop-databases-practice-paper/
/en-s5-ict-programming-modular-oop-databases-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 Paper: Programming, Object-Oriented Design and Database Applications (100 marks)

S5 ICT Paper: Programming, Object-Oriented Design and Database Applications (100 marks)

  • 2026-11-12

ICT – Programming and Databases

S5 ICT: 6 questions, 24 parts, 100 marks, 75 minutes. Binary and two complement conversion, linear and binary search, bubble sort, recursion, OOP, SQL joins and normalisation.

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

Question 1 Data Representation: Binary, Two Complement and Bitmaps (16 marks)

Answer each part independently. Show the conversion steps or the calculation.

# Question Answer and marking notes
1 Convert the binary number 10110110 to a decimal number. Answer: 10110110 = 128 + 32 + 16 + 4 + 2 = 182. (4 marks)
2 Convert the decimal number 200 into an 8-bit binary number and a hexadecimal number. Answer: 200 = 11001000 in binary and C8 in hexadecimal. (4 marks)
3 Using 8-bit two complement representation for negative numbers, write the 8-bit code of -90. Answer: 256 – 90 = 166, which is 10100110 in binary. (4 marks)
4 An uncompressed bitmap is 1024 by 768 pixels with 24-bit colour per pixel. Find its file size in bytes and in MiB (1 MiB = 1048576 bytes). Answer: 786432 x 3 = 2359296 bytes, which is 2.25 MiB. (4 marks)

Question 2 Algorithms and Code Tracing (18 marks)

Give the final values only. Do not copy the code.

# Question Answer and marking notes
5 A loop adds the integers from 1 to 10 inclusive. Find the final value of the accumulator and the number of iterations. Answer: the sum is 55 and the loop runs 10 times. (4 marks)
6 A linear search looks for 12 in the list [3, 8, 5, 12, 7]. How many comparisons are needed? Answer: 4 comparisons are needed (3, 8, 5 and 12). (4 marks)
7 For sorted data of 16 items and of 100 items, what is the maximum number of comparisons in a binary search in the worst case? Answer: 16 items need at most 4 comparisons; 100 items need at most 7 comparisons. (5 marks)
8 Bubble sort is applied to 6 items and to 10 items. How many comparisons are needed in the worst case for each? State the relation between the number of comparisons and the number of items. Answer: 6 items need 15 comparisons and 10 items need 45 comparisons; the relation is n(n – 1) / 2. (5 marks)

Question 3 Functions, Recursion and Modularity (18 marks)

State the computed value or give the explanation, and name the scope of each variable.

# Question Answer and marking notes
9 A function fact(n) returns the factorial of n. Find the value returned by fact(5) and the number of times fact is called (counting the first call). Answer: fact(5) = 120 and fact is called once (implemented with a loop). (4 marks)
10 A recursive function has fib(1) = 1, fib(2) = 1 and fib(n) = fib(n – 1) + fib(n – 2). Find fib(7). Answer: the sequence is 1, 1, 2, 3, 5, 8, 13, so fib(7) = 13. (5 marks)
11 The main program sets x = 12, and a function declares its own local variable x = 30. After the call, the main program prints x. Give the printed value and explain why. Answer: it prints 12; the x inside the function is a local variable that exists only inside the function and does not change the x of the main program. (4 marks)
12 State two advantages of dividing a program into modules, with one example for each. Answer: (1) easier debugging and maintenance, for example only the module that computes scores is changed; (2) reuse, for example one input validation module is used by several programs. (5 marks)

Question 4 Object-Oriented Design (16 marks)

Use the terms class, attribute, method and object in your answers.

# Question Answer and marking notes
13 Class Student has 3 attributes and 2 methods. If 4 Student objects are created, how many attribute values are there in total? Answer: each object holds 3 attribute values, so 4 objects hold 12 in total. (4 marks)
14 Parent class Person has 3 methods. Child class Teacher adds 2 methods and overrides 1 parent method. How many different methods can a Teacher object call? Answer: 5 methods (3 from the parent, one of which is overridden and still counts once, plus 2 new ones). (4 marks)
15 Explain encapsulation and why attributes should be declared private. Answer: encapsulation keeps data and the methods that operate on it inside one class, so data is reached only through public methods; private attributes stop outside code from changing data directly, so values are updated only after validation. (4 marks)
16 A program has 3 classes with 2 public methods each, and a main program calls these methods. If every public method is called twice, find the total number of method calls. Answer: 3 x 2 x 2 = 12 calls. (4 marks)

Question 5 Databases and SQL (18 marks)

Table Student(SID, Name) has 4 rows and table Score(SID, Mark) has 7 rows. Every score belongs to one student in Student.

# Question Answer and marking notes
17 Identify the primary key of table Student, and state what the column SID in table Score is. Answer: the primary key of Student is SID; SID in Score is a foreign key that references the primary key of Student. (4 marks)
18 How many rows result from joining the two tables on SID? Explain. Answer: 7 rows, because each score matches exactly one student, so the one-to-many join keeps the number of rows in Score. (5 marks)
19 The query SELECT COUNT(*) FROM Score WHERE Mark is greater than or equal to 60 is run. The marks are 82, 57, 65, 48, 90, 73 and 60. Find the result. Answer: the result is 5 (the qualifying marks are 82, 65, 90, 73 and 60). (5 marks)
20 An unnormalised results table stores student names, subject names and marks, and contains repeating groups. Normalising it to third normal form needs at least how many tables? Name them. Answer: at least 3 tables, namely Student, Subject and Score (Score holds SID, SubjectID and the mark). (4 marks)

Question 6 System Development, Testing and Efficiency (14 marks)

Show the calculation or give the reason for each comparison.

# Question Answer and marking notes
21 A program has 3 valid equivalence classes and 2 invalid ones. Two boundary values (upper and lower) are tested for each class. Find the minimum number of test cases. Answer: (3 + 2) x 2 = 10 test cases. (4 marks)
22 Compare black-box testing with white-box testing and give one use of each. Answer: black-box testing looks only at inputs and outputs and is used to check that functions meet requirements; white-box testing examines internal paths and branches to ensure every path is executed. (4 marks)
23 State one practice that reduces future maintenance difficulty and explain how it helps testing. Answer: adding comments at key steps and using meaningful variable names lets testers see what each part does, so faults are located more easily. (3 marks)
24 Algorithm A has time complexity n squared and algorithm B has n log2 n. When n = 1000, find the number of operations of each and how many times A is slower than B. Answer: A performs 1000000 operations and B performs 10000 operations, so A is 100 times slower. (3 marks)

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 →