Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

THE HONG KONG ASSOCIATION FOR COMPUTER EDUCATION

INFORMATION AND COMMUNICATION TECHNOLOGY

MOCK EXAMINATION 2020 – PAPER 2D Marking Scheme (中文版)

1. (a) (i) x 軸: 時間 y 軸: 項目 1

(ii) 系統流程圖 / 數據流程圖 (DFD) /結構圖 (任選兩個) 2

(b) (i)

ID 項目 取決於 所需時間 (x50 日)


1 拓地及海事工程 / 6
2 飛行區設施 3 5
3 停機坪工程 1 2
4 跑道客運大樓 5 5
5 旅客捷運系統 1 4
6 行李處理系統 1 6
7 機場輔助基礎設施 4 4
8 公用設施 4 3
其中一個正確 - 1 分 或
全對 – 2 分

所需時間 ( x50 日)
ID 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
1
2
3
4
5
6
7
8
項目 3 – 1 分, 項目 5 – 1 分
任何 1 個相關性 – 1 分 或 全部相關性 – 2 分
(ii) 950 日 1

(c) (i)

2 F F T F F F F F
1

6 T F F F F F F F
1

(ii) S[i,j] = T 1
C[j]  C[j] + 1 2
1
2. (a) (i) 堆疊. 新節點只能夠在堆疊的最上方加入,而新節點能夠在連接表的任何地方加入。 1+1

OR

隊列. 新節點只能夠在堆疊的最後方加入,而新節點能夠在連接表的任何地方加入。 1+1

(ii) 它表示連接表的完結 1

(iii) 除了-2 外的任何負數 1

(iv) D, C, G , F 2
(v) 6 1
(b) 地址 UNIT NEXT
0 START 1
1 A 3
2 E 4
3 F 7
4 B 5
5 D 8
6 C 2
7 G 6
8 H -2
全部正確 2 或

4 行正確 1

(c) (i) 連接表能夠從兩個方向移動。 1

地址 UNIT PREV NEXT


(ii)
0 START -1 4
1 A 2 5
2 E 7 1 1
3 F 4 7
4 B 0 3
5 D 1 8
6
7 G 3 2 1
8 H 5 -2

All Correct 1

(iii) NEXT[Z] 1
PREV[Z] 1

2
3. (a) (i)

第一次後
1 2 3 4 5 6
item: 37 64 55 80 42 73
1
第二次後
1 2 3 4 5 6
item: 37 55 64 80 42 73
1
(ii) 15 1

(iii) 將陣列中的數字排成順序 1

(iv) 同意,頭四個數字已經處於正確位置。 1

(b) (i) item[j] > item[j+1] 1

swap(item[j], item[j+1]) 2

(c) (i) 6 1
(ii) 0 1

(d) True 1
1 to n-1 1
item[i] > item[i+1] 1

Valid  False 1
Valid 1

4. (a) True 1
data[j] = data[k] 1
Or 1

(b) (I / 3 的整數部份)*3 1

X + k/3 的餘數 1

checkUniq(AR) 1

(c) checkSol():
result  true;
設i  0 至 8
如果 not checkCol(i) 或 not checkRow(i) 或 not checkBox(i)
result  false
傳回 result

1 正確運用子程式 checkCol(), checkRow() and checkBox()


1 傳回布爾數值
1 考慮所有行/欄/宮

3
(d) 評分參考
驗証 1分
欄和行的由 1-9 至 0-8 的轉換 1 分
找出及輸出正確的提示 3 分
全部正確 (包括編程語法) 1 分
{C Version}
void findHints(int row, int col) {
int r[9];
int t;
int i, j;
for (t = 0; t < 9; t++) //Initialize the result array
r[t] = 1;
i = row - 1;
j = col - 1;
if (i > 8 || i < 0 || j > 8 || j < 0 || sol[i][j] != 0) { //Validation
printf("NA");
} else {
for (t = 0; t < 9; t++) {
/* Check Row */
if (sol[i][t] != 0)
r[sol[i][t]-1] = 0;
/* Check Col */
if (sol[t][j] != 0)
r[sol[t][j]-1] = 0;
/* Check Box */
if ( sol[ (i/3)*3+(t/3) ][ (j/3)*3+t%3 ] != 0)
r[ sol[ (i/3)*3+(t/3) ][ (j/3)*3+t%3 ] - 1 ] = 0;
}
for (t = 0; t < 9; t++) { //Output
if (r[t] == 1)
printf("%d", t+1);
}
}
}

{Pascal Version}
procedure findHints(row, col : integer);
var
t, i, j : integer;
r : array[0..8] of integer;
begin
for t := 0 to 8 do
r[t] := 1;
i := row - 1;
j := col - 1;
{ Validation }
if (i > 8) or (i < 0) or (j > 8) or (j < 0) or (sol[i, j] <> 0) then
writeln('NA')
else
begin
for t := 0 to 8 do
begin
{ Check Row }
if (sol[i, t] <> 0) then
r[sol[i, t]-1] := 0;
{ Check Col }
if (sol[t, j] <> 0) then
r[sol[t, j]-1] := 0;
{ Check Box }
if ( sol[(i div 3)*3+(t div 3),(j div 3)*3 + t mod 3] <> 0) then
r[ sol[(i div 3)*3+(t div 3),(j div 3)*3 + t mod 3]-1] := 0;
end;
{ Output }
for t := 0 to 8 do
if (r[t] = 1) then
Write(t+1);
end;
end;

4
{Java Version}

public static void findHints(int row, int col) {


int[] r = new int[9];
int t;
int i, j;
for (t = 0; t < 9; t++) //Initialize the result array
r[t] = 1;
i = row - 1;
j = col - 1;
if (i > 8 || i < 0 || j > 8 || j < 0 || sol[i][j] != 0) { //Validation
System.out.printf("NA");
} else {
for (t = 0; t < 9; t++) {
/* Check Row */
if (sol[i][t] != 0)
r[sol[i][t]-1] = 0;
/* Check Col */
if (sol[t][j] != 0)
r[sol[t][j]-1] = 0;
/* Check Box */
if ( sol[ (i/3)*3+(t/3) ][ (j/3)*3+t%3 ] != 0)
r[ sol[ (i/3)*3+(t/3) ][ (j/3)*3+t%3 ] - 1 ] = 0;
}
for (t = 0; t < 9; t++) { //Output
if (r[t] == 1)
System.out.printf("%d", t+1);
}
}
}

{Visual Basic Version}

Sub findHints(row as integer , col as integer)


Dim t, i, j as integer
Dim r(9) as integer

for t = 0 to 8
r(t) = 1
Next

i = row - 1
j = col - 1
'Validation
if (i > 8) or (i < 0) or (j > 8) or (j < 0) or (sol(i, j) <> 0) then
Console.Write("NA")
else
for t = 0 to 8
' Check Row
if (sol(i, t) <> 0) then
r(sol(i, t)-1) = 0
End if
' Check Col
if (sol(t, j) <> 0) then
r(sol(t, j)-1) = 0
End If
' Check Box
if ( sol( (i \ 3)*3+(t \ 3) , (j \ 3)*3 + (t mod 3) ) <> 0) then
r( sol( (i \ 3)*3+(t \ 3) , (j \ 3)*3 + t mod 3 ) - 1 ) = 0
End If
Next
End If
' Output
for t = 0 to 8
if (r(t) = 1) then
Console.Write(t+1)
End if
Next

end Sub

You might also like