Information and Communication Technology Paper 2 (Sample Paper)
Information and Communication Technology Paper 2 (Sample Paper)
ICT
PAPER 2 HONG KONG EXAMINATIONS AND ASSESSMENT AUTHORITY
HONG KONG DIPLOMA OF SECONDARY EDUCATION EXAMINATION
INSTRUCTIONS
(1) This paper consists of THREE sections, Section A, Section B and Section C. Attempt ALL
questions in any TWO sections.
(2) Write your answers in the DSE(D) Answer Book provided. Start each question (not part of a
question) on a new page.
(3) The last page of this Question Paper contains SQL commands and symbols used in entity-
relationship diagrams which you may find useful.
SP-DSE-ICT 2–1 1
Section A Databases
The company hires a lot of delivery riders to deliver food to customers. Each customer places one order or
multiple orders. Each delivery rider delivers zero or multiple orders. Each order must be delivered by one
delivery rider only.
Draw the ER diagram for this database with the given entities below. It is not necessary to draw attributes.
(4 marks)
Order
(a) Give the missing part in the above SQL command so that two records with the same transaction ID
cannot be input into TRAN. (1 mark)
(b) (i) Write an SQL command to input the following transaction record into TRAN. (2 marks)
(ii) After the SQL command in (i) was executed, the ordered shoes were found to be out of stock and
hence the transaction was cancelled. What action on the database should be taken? Briefly describe
the purpose of the action. (2 marks)
SP-DSE-ICT 2–2 2
[New question]
3. A database table STAFF stores the attributes DOB (Date of Birth) and AGE (age).
STUDENT
Field name Description Example
SID Student identity code S117001
NAME Name Chan Tai Man
SEX Sex ( M – Male, F – Female) M
CL Class name 3A
CLNO Class number (1 – 36) 20
Primary key: SID
Extra-curricular activities in the school are classified into different types. The first three types are:
1 Music
2 Sports
3 Visits
Students receive a summary report on the activities they have attended, as shown in the following sample
report:
Name: Chan Tai Man Sex: M Student ID: S117001 Class: 3A Class number: 20
Date: 22/09/2019
Date: 22/09/2019
Activity: Basketball practice
Activity: Volleyball team meeting
Type: 2
Type: 2
Date: 28/01/2020
Activity: Ocean Park visit
Type: 3
Based on STUDENT and the information in the sample report above, create a database schema in Third
Normal Form. Identify the corresponding primary keys and foreign keys, or write ‘N/A’ if not applicable.
(5 marks)
SP-DSE-ICT 2–3 3
[Modified from DSE 2019 ICT P2A Q.4]
5. A bus company uses three database tables BROUTE, EMPLOYEE and DRIVER to store information on
buses, employees and drivers. DRIVER stores information on the drivers and the bus routes they can drive.
BROUTE
Field name Type Description Example
BID Character The bus route 1A
BNO Integer Number of buses on this bus route 20
Primary Key: BID
EMPLOYEE
Field name Type Description Example
EID Character Identity code of the employee A00038
ENAME Character Name of the employee John Li
SALARY Integer Salary of the employee 20000
DSER Date First day of work 21/3/2010
Primary Key: EID
DRIVER
Field name Type Description Example
EID Character Identity code of the employee A00038
BID Character The bus route that the employee can drive 1A
Primary key: EID + BID
Foreign key: EID , BID
(a) List the names and identity codes of the employees who can drive bus route ‘1A’ in descending order
of their salary. (2 marks)
(b) List the names and identity codes of the employees who cannot drive any bus route. (2 marks)
(c) For some bus routes, the number of drivers is smaller than the number of buses. List those bus routes.
(3 marks)
SP-DSE-ICT 2–4 4
(d) Consider the following views:
CREATE VIEW V1 AS
SELECT AVG(SALARY) AS AVG1 FROM EMPLOYEE
WHERE EID IN
(SELECT DRIVER.EID FROM DRIVER
WHERE DSER < '1/1/2005')
CREATE VIEW V2 AS
SELECT AVG(SALARY) AS AVG2 FROM EMPLOYEE
WHERE EID IN
(SELECT DRIVER.EID FROM DRIVER
WHERE DSER >= '1/1/2005')
(e) A field BUSID is added to DRIVER to record the car plate number of the bus driven by an employee.
The car plate number contains at most 6 characters. Write a SQL command to add the field.
(2 marks)
END OF SECTION A
SP-DSE-ICT 2–5 5