第一章测试
1.Which is NOT the main part of computer ( )
A:I/O equipment
B:Cache
C:CPU
D:memory
答案:B
2.Which symbol can be used for comments in Python ( )
A:#
B:“
C://
D:!
答案:AB
3.The integrated development tool built into Python is ( ).
A:Jupyter
B:Pycharm
C:IDLE
D:Vs code
答案:C
4.Which is the correct operator for power(Xy)? ( )
A:X^y
B:None of the mentioned
C:Xy
D:X^^y
答案:C**
5.Which of the following is incorrect? ( )
A:float(“3+5”)
B:float(“3”)
C:float(4.2)
D:float(3)
答案:A
第二章测试
6.Which of the following is an invalid variable? ( )
A:1st_string
B:my_string_1
C:_
D:foo
答案:A
7.What will be the output of the following Python code ? not(10<20) and not(10>30) ( )
A:Error
B:True
C:False
D:No output
答案:C
8.Which one will return error when accessing the list ‘l’ with 10 elements. ( )
A:l[0]
B:l[-10]
C:l[10]
D:l[-1]
答案:C
9.What will be the output of the following Python code? lst=[3,4,6,1,2]lst[1:2]=[7,8]print(lst) ( )
A:Syntax error
B:[3,4,6,7,8]
C:[3, 7, 8, 6, 1, 2]
D:[3,[7,8],6,1,2]
答案:C
10.Which of the following operations will rightly modify the value of the element? ( )
答案:D
11.The following program input data: 95, the output result is?  (    )
A:none of the mentioned
B:Please enter your score: 95Your ability exceeds 85% of people!
C:Please enter your score: 95Awesome!
D:Please enter your score: 95Awesome!Your ability exceeds 85% of people!
答案:D
第三章测试
12.Which one description of condition in the followings is correct? ( )
A:The condition 24<=28<25 is legal, and the output is False
B:The condition 35<=45<75 is legal, and the output is False
C:The condition 24<=28<25 is illegal
D:The condition 24<=28<25 is legal, and the output is True
答案:A
13.The output of the following program is? (   )
A:Python
B:None
C:python
D:t
答案:B
14. for var in ___: (   ) 
A:range(0,10)
B:13.5
C:[1,2,3]
D:“Hello”
答案:B
15.After the following program is executed, the value of s is?(   )
A:19
B:47
C:46
D:9
答案:D
16.Which is the output of the following code?a = 30b = 1if a >=10:a = 20elif a>=20:a = 30elif a>=30:b = aelse:b = 0print(“a=”,a,“b=”,b) ( )
A:a=20, b=20
B:a=30, b=30
C:a=20, b=1
D:a=30, b=1
答案:C
第四章测试
17.Which keyword is used to define a function in Python? ( )
A:fun
B:define
C:def
D:function
答案:C
18.What will be the output of the following Python code?  (  )
A:  x is 50Changed local x to 2x is now 50
B:x is 50Changed local x to 2x is now 100
C:None of the mentioned
D:x is 50Changed local x to 2x is now 2
答案:A
19.Which are the advantages of functions in Python? ( )
A:Improving clarity of the code
B:Reducing duplication of code
C:Easier to manage the code
D:Decomposing complex problems into simpler pieces
答案:ABCD
variable used in lambda20.How does the variable length argument specified in the function heading? ( )
A:one star followed by a valid identifier
B:two stars followed by a valid identifier
C:one underscore followed by a valid identifier
D:two underscores followed by a valid identifier
答案:A
21.What will be the output of the following Python code? list(map((lambda x:x2), filter((lambda x:x%2==0), range(10)))) ( )
A:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
B:Error
C:[0, 4, 16, 36, 64]
D:No output
答案:C**
第五章测试
22.Which of the following statements cannot create file? ( )
A:f = open(“”, “w”)
B:f = open(“”, “r”)
C:f = open(“”, “x”)
D:f = open(“”, “a”)
答案:B
23.After executing the following procedure, what content will be saved in the file?file=open(‘’, ‘wt+’)file.write(‘hello SCUT’)file.close()file=open(‘’, ‘at+’)file.write(‘hello world’)file.close() ( )
A:hello SCUThello world
B:hello SCUT hello world
C:hello SCUT world
D:hello world
答案:A
24.Which function is not the way Python reads files. ( )
A:readlines()
B:readline()
C:read()
D:readtext()
答案:D
25.How to rename a file in Python? ( )
ame(fp, new_name)
B:os.set_name(existing_name, new_name)
ame(existing_name, new_name)
D:fp.name = ‘’
答案:C
26.What is the usage of tell() function in Python? ( )
A:tells you the current position within the file
B:tells you the end position within the file
C:none of the mentioned
D:tells you the file is opened or not
答案:A
第六章测试
27.What will be the output of the following Python code? (   )
A:Reports error as one argument is required while creating the object
B:Runs normally, doesn’t display anything
C:Reports error as display function requires additional argument
D:Displays 0, which is the automatic default value
答案:A
28.What will be the output of the following Python code?  (  )
A:Error
B:‘Old’
C:Nothing is printed
D:‘New’
答案:B
29.What will be the output of the following Python code?  (   )
A:main
B:Exception is thrown
C:Demo
D:test
答案:A
30.Which one of the followings is not correct about Class hierarchy? ( )
A:Subclass can not add more behavior/methods
B:Subclass can override the methods inherited from superclass
C:Subclass can have methods with same name as superclass
D:Subclass can inherit all attributes from superclass
答案:A

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。