第四章测试1.Which keyword is used to define a function in Python? ( )
A:fun
B:define
C:function
D:def
答案:D
2.
What will be the output of the following Python code? ( )
A:
x is 50
Changed local x to 2
x is now 2
B:
x is 50
Changed local x to 2
x is now 50
C:
x is 50
Changed local x to 2
x is now 100
D:None of the mentioned
3.Which are the advantages of functions in Python? ( )
A:Improving clarity of the code
B:Easier to manage the code
C:Reducing duplication of code
D:Decomposing complex problems into simpler pieces
4.How does the variable length argument specified in the function heading? ( )
A:two stars followed by a valid identifier
B:two underscores followed by a valid identifier
C:one underscore followed by a valid identifier
D:one star followed by a valid identifier
5.What will be the output of the following Python code?
list(map((lambda x:x**2), filter((lambda x:x%2==0), range(10)))) ( )
A:Error
B:[0, 4, 16, 36, 64]
C:No output
D:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!