
代號:
頁次:
-
二、請說明下列程式設計重要名詞的差異。(25 分)
執行期錯誤(Runtime Error),語意錯誤(Semantic Error),語法錯誤
(Syntax Error)
動態記憶體配置(Dynamic memory allocation),靜態記憶體配置(Static
memory allocation)
三、下列用 Python 所寫的遞迴程式,會產生一系列的指令,用以把下圖在 A
柱子上的 5個圓盤全部移到 C柱子上,且移動過程中能確保不會有圓盤
疊在更小的圓盤上。
請說明 MoveDisk 函式總共會被呼叫幾次?(5分)
請說明總共會輸出幾個移動圓盤的指令?(10 分)
請說明第三大的圓盤(也是第三小的圓盤)總共會移動幾次?(10 分)
def MoveDisk (n , from_pole, to_pole, aux_pole):
if n == 1:
print ("Move top disk from pole ",from_pole,"to pole",to_pole)
return
MoveDisk (n-1, from_pole, aux_pole, to_pole)
Print ("Move top disk from pole ",from_pole,"to pole",to_pole)
MoveDisk (n-1, aux_pole, to_pole, from_pole)
MoveDisk(5, 'A', 'C', 'B')
四、請說明下列常見 html tag 的用途為何並顯示結果?(20 分)
This is difficult. u>
This test is easy.
isthis?method=post action="/cgibin/example.cgi">
Select an option:
type="radio" name="option"> A
type="radio" name="option" checked> B
type="radio" name="option"> C
CBA