奧冠教育 中心
OLYMPIAD CHAMPION EDUCATION CENTRE
Room 309-310, 8 Jordan Road, Yau Ma Tei, Kowloon, Hong Kong SAR, CHINA
Tel (852) 3153 2028 / 9310 1240 Fax (852) 3153 2074
Website: [Link] Email: olympiadchampion@[Link]
香港國際編程競賽初賽 2019 – 2020(香港賽區)
HONG KONG INTERNATIONAL
COMPUTATIONAL OLYMPIAD
HEAT ROUND 2019 - 2020 (HONG KONG REGION)
Python
時限:60 分鐘
Time allowed: 60 minutes
模擬試題
Mock Paper
考生須知:
Instructions to Contestants:
1. 本卷包括 試題 乙份,試題紙不可取走。
Each contestant should have ONE Question-Answer Book which CANNOT be taken away.
2. 本卷共 20 題,答對得 2 分,空題得 0 分,答錯倒扣 1 分。
There are a total of 20 questions in this Question-Answer Book. Two 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.
未得監考官同意,切勿翻閱試題,否則參賽者將有可能被取消資格。
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
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.
選擇題(第 1 至 20 題)(答對得 2 分,空題得 0 分,答錯倒扣 1 分)
Multiple Choice Questions (1st ~20th) (Two points for correct answers. No points for incorrect answers. ONE
penalty point will be deducted for incorrect answers.)
1. What is the purpose of in codes like
A. It is a programming convention as main() is also presented in other languages like C/C++ or Java
B. Prevent main() from being executed when imported as module
C. The code would not execute without this definition
D. It is meaningless
E. None of the above
2. What is the value of ?
A. 72 B. 72, 101, 108, 108, 111 C. 108 D. 111 E. None of the above
3. What is the output of the program?
A. 0 B. 244 C. 422 D. 10 E. None of the above
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
4. Which of the following options could be filled in line 4 of the following code (as indicated with
comments) to print the key and value of the dictionary line-by-line?
A. B. C. D. All of the above E. None of the above
5. Following is a definition of a recursive function, what is the value of ?
A. The recursive function never terminates
B. -1
C. 5
D. 0
E. None of the above
6. What is the output of the following program?
A. 5 B. 0 C. None D. <__main__.C object at 0x7ff2ac534190>
E. None of the above
7. What is the value of ?
A. 1.5 B. 0 C. “12.03-4.5” D. Runtime Error E. None of the above
8. Which of the following is a valid module import statement?
A. from * import sys
B. import sys from io
C. import sys as sys
D. import * from sys
E. None of the above
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
Refer to the following code for question 9 to 11
9. Tommy executed the code with the python interpreter, but there is no output, why?
A. There are some errors in the code so the output goes to error stream
B. The program is still waiting for user input
C. main() is not invoked
D. No module is imported yet
E. None of the above
10. After fixing the problem as indicated in question 9, the code runs into error after printing “I have your
number!”, which line would the interpreter be telling?
A. Line 2 B. Line 3 C. Line 4 D. Line 5 E. Line 7
11. What is the error?
A. str cannot be used as a variable name
B. Input is invalid
C. Input cannot be converted to int
D. str is not callable
E. None of the above
12. What is the value of ?
A. “Hey”
B. “hey”
C. “HEY”
D. Runtime Error
E. None of the above
13. Consider the following code,
Is ?
A. True
B. False
C. Undetermined
D. Runtime Error
E. None of the above
14. Which of the following is not a built-in function?
A. ord() B. hasattr() C. callable() D. nullable() E. None of the above
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
15. What is the value of arr after executing this code
A. 0 B. [1, 2, 3] C. [1, 3, 5] D. [1, 0, 5] E. None of the above
16. Which of the following is False?
A.
B.
C.
D.
E. None of the above
17. Given the code
Which of the following(s) is/are true?
A.
B.
C.
D. All of the above
E. None of the above
18. What is the output of the program?
A. 7 B. [1, 2, 3] C. [1, 2, 3, None, None, None, 7] D. [1, 2, 3, 7]
E. None of the above
請將答案寫在 答題紙 上。
All answers should be written on the ANSWER SHEET.
19. What is the value of ?
A. [0, 1, 4, 9, 16]
B. [4, 1, 0]
C. [16, 9, 4]
D. [16, 9, 4, 1, 0]
E. None of the above
20. What is the expected output of the program?
A. None B. a C. C D. 2 E. None of the above
~ 全卷完 ~
~ End of Paper ~