Professional Documents
Culture Documents
Python
時限:60 分鐘
Time allowed: 60 minutes
試題
Paper
考生須知:
Instructions to Contestants:
1. 本卷包括 試題 乙份,試題紙不可取走。
Each contestant should have ONE Question-Answer Book which CANNOT be taken
away.
2. 本卷共 20 題,答對得 4 分,空題得 0 分,答錯倒扣 1 分。
There are a total of 20 questions in this Question-Answer Book. Four points for
correct answers. No points for incorrect answers. ONE penalty point will be
deducted for incorrect answers.
3. 請將答案寫在 答題紙 上。
All answers should be written on ANSWER SHEET.
4. 比賽期間,小學組不得使用計算工具,中學組可以使用計算工具。
During the contest, NO calculators can be used for PRIMARY GROUP but calculators can be
used for SECONDARY GROUP.
5. 本卷中所有圖形不一定依比例繪成。
All figures in the paper are not necessarily drawn to scale.
6. 比賽完畢時,本試題會被收回。
This Question-Answer Book will be collected at the end of the contest.
本試題不可取走。
THIS Question-Answer Book CANNOT BE TAKEN AWAY.
未得監考官同意,切勿翻閱試題,否則參賽者將有可能被取消資格。
DO NOT turn over this Question-Answer Book without approval of the examiner.
Otherwise, contestant may be DISQUALIFIED.
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
A. int
B. double
C. complex
D. list
E. All of the above
以上皆是內建類別
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
A. True
B. False
C. None
D. Runtime Error
運行錯誤
E. None of the above
以上皆不是
def main():
print(func(b = func()))
main()
A. 1
B. 2
C. 3
D. 4
E. None of the above (including runtime error)
以上皆不是 (包括運行錯誤)
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
import os
import pathlib
A. os.stat("a.py").st_ctime == pathlib.Path("a.py").stat().st_birthtime
B. pathlib.Path("a.py").stat().st_birthtime == os.path.getctime("a.py")
C. os.path.getbirthtime("a.py") == pathlib("a.py").stat().st_birthtime
D. os.stat("a.py").st_ctime == os.path.getctime("a.py")
E. None of the above
以上皆不是
@property
def a(self): return eval(self.__a)
@a.setter
def a(self, value): self.__a = value
a = A()
b = 2
c = 3
a.a = "b + c"
b = 5
print(a.a)
A. 2
B. 3
C. 5
D. 8
E. None of the above
以上皆不是
A. { 3: 2, 2: 1, 1: 2 }
B. [3, 2, 2, 1, 1, 2]
C. [3, 2, 1]
D. [(3, 2), (2, 1), (1, 2)]
E. None of the above
以上皆不是
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
a = 100,000,000
print(str(a)[1])
A. 0
B. 1
C. None
D. (
E. None of the above
以上皆不是
13. What is the output of the following code after user input "10" (without the quotes)?
以下程式在用戶輸入 "10" (不包括引號) 後的輸出是?
a = input()
b = a + 20
print(b[1])
A. 0
B. 1020
C. None
D. 30
E. None of the above
以上皆不是
class A:
def __enter__(self):
print(end="OK")
def __exit__(self, a, b, c):
print(end="HI")
with A():
print(end="BYE")
A. OKHIBYE
B. HIOKBYE
C. OKBYEHI
D. HIBYEOK
E. None of the above
以上皆不是
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
for i in range(13):
if i // -3 == -1:
break
print(i // -3)
else:
print("HI")
A. 0
B. 1
C. 0
-1
-1
-1
-2
-2
-2
-3
-3
-3
-4
-4
-4
HI
D. HI
E. None of the above
以上皆不是
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
import functools
a = [1, 2, 3, 4, 5]
print(functools.reduce(lambda x, y: x * y // 2, a))
A. 0
B. 5
C. 7.5
D. [1, 2, 3, 4, 5]
E. None of the above
以上皆不是
A. 3
B. 4
C. [0, 1, 4, 5, 7, 8]
D. [4, 5]
E. None of the above
以上皆不是
a = list(range(5), range(2))
a.reverse()
print(a[0][0])
A. range(0, 5)
B. range(0, 2)
C. 1
D. 4
E. None of the above
以上皆不是
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
a = 4
def func(a = 6):
print(end=str(a))
a = 2
a = 3
func(a = 1)
print(end=str(a))
A. 61
B. 42
C. 13
D. 11
E. None of the above
以上皆不是
~ 全卷完 ~
~ End of Paper ~