Professional Documents
Culture Documents
2020 HKACE Mock ICT 2D Eng
2020 HKACE Mock ICT 2D Eng
2020 HKACE Mock ICT 2D Eng
PAPER 2D
Software Development
Total
(3) ANSWER ALL QUESTIONS. Write your answers in the
spaces provided in this Question-Answer Book. Do not
write in the margins.
© 香港電腦教育學會 保留版權
THE HONG KONG ASSOCIATION FOR COMPUTER EDUCATION
All Rights Reserved 2020
1. Peter is designing the new airport runway system. The tasks include Land Formation and Marine Works, Airfield
Facilities, Aprons Works, Runway Passenger Building, Automated People Mover System, Baggage Handling System,
Airport Support Facilities and Public Facilities. Peter uses Gantt Chart to organize and monitor the progress.
(a) (i) What do the two axes (x-axis and y-axis) of the Gantt Chart represent respectively?
________________________________________________________________________________________
________________________________________________________________________________________
(ii) Other than Gantt Chart, state TWO charts that can be found in the design phase of SDLC.
________________________________________________________________________________________
________________________________________________________________________________________
(3 marks)
Answers written in the margins will not be marked.
(c) In the implementation phase, Peter wants to store the dependency of the tasks into an array. Peter suggests to use 2D
Boolean Array. When task i is dependent on j,S[i,j] = T, otherwise S[i,j] = F.
(i) Complete the following table which shows the content of array S according to the information provided
in part (b).
j 1 2 3 4 5 6 7 8
i
1 F F F F F F F F
2
3 T F F F F F F F
Answers written in the margins will not be marked.
ID 1 2 3 4 5 6 7 8
No. 3 0 1 2 1 0 0 0
Suppose all elements in array C are already initialized to 0. Complete the following pseudocode for the
algorithm to generate the above result:
For i from 1 to 8
For j from 1 to 8
If then
(3 marks)
(a) LL1
Address UNIT NEXT
0 START 4
1 A -2
2 B 1
3 C 7
4 D 3
5 E -2
6 F 2
7 G 6
8 H 5
(i) Other than linked list, suggest another data structure and state the major difference while inserting a new
element.
Answers written in the margins will not be marked.
(iii) Other than -2, give other possible values that Mary can use?
(iv) Write down the content of next four nodes after START in order.
(v) How many nodes are there in this linked list excluding the first node START?
(7 marks)
LL2
Address UNIT NEXT
0 START 1
1 A
2 E
3 F
4 B
5 D
6 C
7 G
8 H
(2 marks)
(c) Mary designs another structure by adding another array PREV. In each node, PREV points to the previous
node, as shown in the following example.
LL3
Answers written in the margins will not be marked.
(1 mark)
LL3
Address UNIT PREV NEXT
0 START
1
2
3
4
5
6
7
8
(3 marks)
(iii) The LL3 is implemented by parallel arrays UNIT, PREV and NEXT.
For example, UNIT[8]stores H, Previous[8] stores 5 and NEXT[8] stores -2.
Assume that Z is NOT the start node or the end node of the linked list, complete the following
Answers written in the margins will not be marked.
Subprogram DELETE(Z):
(2 marks)
(a) Assume that n = 6 and ALG1 is executed with the following initial content of item.
1 2 3 4 5 6
item: 64 37 55 80 42 73
(i) Fill in the content of item after the first pass and the second pass in the loop in Line 1.
Answers written in the margins will not be marked.
(iv) During the third pass of the loop in Line 1, the content of each element in the array item do not change.
Do you agree? Explain your answer briefly.
(5 marks)
for i 2 to n do
if then
(3 marks)
(i) If the same content of item in (a) is used in ALG2. How many times will Line 5 be executed?
(ii) If n = 100 (i.e. 100 elements in the array item). What is the minimum possible number of execution of
Line 5 in ALG2?
(2 marks)
Subprogram check
Valid __________________
if ________________________________ then
_____________________________
Return ___________________
(5 marks)
Answers written in the margins will not be marked.
Element Value
sol[0][0] a
sol[6][4] b
sol[3][7] c
sol[8][8] d
(a) Lily creates a subprogram checkUniq(data[]) which return True if the elements in data are unique
Answers written in the margins will not be marked.
The following shows the pseudocode for checkUniq(data[]). Complete the subprogram.
checkUniq(data[])
f True
j 0
while j < 9 do
k j + 1
while k < 9 do
if data[j] = data[k] then
f False
k k + 1
if data[j] > 9 or data[j] < 1 then
f False
j j + 1
return f
(3 marks)
By making use of the subprogram checkUniq(data[]) , Lily has completed the subprograms
checkCol(I) and checkRow(I). The following shows the pseudocode for checkBox(I) .
for k 0 to 8 do
P X + remainder of k/3
Q Y + integral part of k/3
AR[k] = sol[P][Q]
return checkUniq(AR)
(3 marks)
checkSol():
Answers written in the margins will not be marked.
Hidden cell
Hints
Each hidden cell is represented by the integer value 0 in the global array sol. Lily wants to develop
another subprogram findHints(X, Y)which finds out all the possible choices for the empty cell at the
Xth row and Yth column. X and Y are both integer values and the first row and the first column are both
denoted by the integer value 1. The subprogram should output the possible choices of the cell. In case the
specified cell is invalid or not an empty cell, the subprogram should output the string value "NA".
For example, according to the above sudoku puzzle, the findHints(X, Y) should return the following
values.
Expression Output Remark
findHints(1, 8) "456" The 1st row, 8th column
findHints(9, 4) "257" The 9th row, 4th column
The 8th row, 4th column, contains
findHints(8, 4) "NA"
the value 8 already
findHints(10, 2) "NA" Invalid row
findHints(2, 10) "NA" Invalid column
Answers written in the margins will not be marked.
(6 marks)
END OF PAPER