香港中學文憑資訊及通訊科技 模擬試卷及多項選擇題

Please tick the appropriate box to indicate the programming language used in Question 9. Python □ C++ □ Pascal □ 9. Students in HK School vote for their favourite teacher in a paper-based ballot. After the voting, student union will enter the vote details in a computer program. These data are stored in an array VT[1] , VT[2] ,…, VT[931] . There are 931 students and 80 teachers in the school. (a) The values in the array VT stored integers from 1 to 80 which represent the teachers’ number rather than storing the real name of teachers. Another array TN[1] ,…, TN[80] , which stores teachers’ name, will be used in the program. (i) Apart from prevent typing error and simplifying the data entry process, what is the benefit of storing integer in VT ? (1 mark) ___________________________________________________ (ii) Before voting start, the values in VT will be initialized to 0. Some students will cast an abstain vote. Suggest the value should be store for abstain vote. (1 mark) ___________________________________________________ The following variables are used in the program: Variable Description C Total count for the vote of a teacher in ALG1 I Counter for the iteration FTN Teacher number enter from input for ALG1 V Teacher number enter from input for ALG2 (b) Complete the following program segment ALG1 to calculate the total vote for a teacher with his teacher number entered at the beginning of ALG1 . (5 marks) [Python version] FTN = int(input("Enter a teacher number:")) C = for I in range( , ): if == FTN: C =

RkJQdWJsaXNoZXIy ODY0MTQz