Professional Documents
Culture Documents
PAPER 2 (D)
MARKING SCHEME
©香 港 電 腦 教 育 學 會 保 留 版 權
The Hong Kong Association for Computer Education
All Rights Reserved 2021
3: System Test 1
iii) High-level programming language is similar to human language, which is easy to code, debug and
maintain 1
OR
No. The system may be unstable with insufficient time. 1
b) i) (A): Product ID
iii) No. User manual describe how the system is operated instead of how the system is created. 1
1
2. a) 57 1
b) i) z x z y
x y OR y x
y z x z 2
iii) N-2-i 1
T[N-k] 1
iv) Only array T will be sorted, and array A can keep the original content. 1
2
c) i) T[j] 1
(use of SWAP) 1
(All correct) 1
Possible alternative 1: Possible alternative 2:
Points to note:
A mistake is found in the question answer book. The indentation of the answer box on Line 7 is found to be
misplaced during the formatting process. Special arrangement is made accordingly. Sorry for any inconvenience
caused.
Original question:
Original marking:
T[j]
maxIndex j
(ii) 2
Index 0 1 2 3 4 5 6
Value 85 72 67 57 23 14 2
3
3. a) i) True 1
False 1
ii) Any case where the order of brackets are not correct. e.g. 1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
SEQ ) (
b) i)
(
(
( BOTTOM
S 1
f = True 1
ii) 16 1
iii) Any case where the number of opening brackets is larger than number of closing brackets. e.g. 1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
SEQ ( ( ( ) )
f 1
isEmpty(S) 1
t POP(S)
1 mark for POP
if C = ')' and t != '(' then 1 mark for handling of 1 type of
f False brackets correctly
if C = '}' and t != '{' then 1 mark for handling 3 types of
f False brackets
if C = ']' and t ≠ '[' then
f False
not isEmpty(S) 1
4
4. a) LaserOn()
1 mark for LaserOn and LaserOff
for i from x to x+length-1 do
1 mark for nested loop to MoveLH
for j from y to y+length-1 do 1 mark for correct looping parameter
MoveLH(i,j)
LaserOff()
b) Improve the readability / Reuse of codes / Encourage collaboration / Easy to detect programming errors
(Any two) 2x1
d) width - 1
1
height - 1
Image[i * width + j] 1
e) i) i index + 1
1 mark for looping through
result -1 index+1 to the next point
while i < width * height and result = -1 do 1 mark for checking for the
if image[i] = current + 1 then correct sequence number
ii) No. Since it is the worst case of Binary Search and best case scenario in linear search. 1