第四章测试
1.Which keyword is used to define a function in Python? ( )
A:fun
B:define
C:def
D:function

答案:C
2.

What will be the output of the following Python code?  (  )


A:  
x is 50
Changed local x to 2
x is now 50
B:
x is 50
Changed local x to 2
x is now 100
C:None of the mentioned
D:
x is 50
Changed local x to 2
x is now 2
3.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
4.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
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:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
B:Error
C:[0, 4, 16, 36, 64]
D:No output

温馨提示支付 ¥3.00 元后可查看付费内容,请先翻页预览!
点赞(106) dxwkbang
返回
顶部