PYTHONPYTHONPYTHONPYTHON ---- QCMQCMQCMQCM
1111 ---- ExplainExplainExplainExplain thethethethe followingfollowingfollowingfollowing code:code:code:code:
>>> l = range(3)
>>> l[3] = 3
[ ] It creates a tuple of integers named "l"
[ ] It creates an iterator
[ ] It raises an IndexError exception
[ ] It raises a TypeError exception
2222 ---- ExplainExplainExplainExplain thethethethe followingfollowingfollowingfollowing code:code:code:code:
>>> l = (1, 2, 3)
>>> l[2] = 3
[ ] It creates a list of integers named "l"
[ ] It creates an iterator
[ ] It raises an IndexError exception
[ ] It raises a TypeError exception
3333 –––– ExplainExplainExplainExplain thisthisthisthis code:code:code:code:
>>> l = xrange(3)
[ ] It creates a list of integers
[ ] It creates a list of empty elements
[ ] It creates an iterator over empty elements
[ ] It creates an iterator over integer elements
4444 ––––WhatWhatWhatWhat isisisis thethethethe outputoutputoutputoutput ofofofof thisthisthisthis program:program:program:program:
>>> classA(object):
>>> def foo(self):
>>> print "A"
>>>
>>> class B(object):
>>> def foo(self):
>>> print "B"
>>>
>>> class C(A, B): pass
>>>
>>> c = C()
>>> c.foo()
[ ] Nothing
[ ] "A"
[ ] "B"
[ ] "A" and "B"
5555 ---- WhatWhatWhatWhat isisisis thethethethe valuevaluevaluevalue "dir(foo)""dir(foo)""dir(foo)""dir(foo)" ????
[ ] True if the string pointed by "foo" is a folder
[ ] Lists all files contained in the "foo" folder
[ ] Lists all properties of the "foo" object
[ ] This is not a valid expression
6666 ---- AAAA lambdalambdalambdalambda functionfunctionfunctionfunction isisisis
[ ] An expression pointing any function
[ ] An anonymous function
[ ] A reserved class attribute
[ ] A way to execute code bound to a function
7777 ---- WhatWhatWhatWhat areareareare thethethethe validvalidvalidvalid expressionsexpressionsexpressionsexpressions ????
[ ] int('5') / 10.0
[ ] '5' / 2
[ ] "5".toInt() / 1.0
[ ] `5` + "5"
8888 ---- WhatWhatWhatWhat answeransweransweranswer isisisis bestbestbestbest describingdescribingdescribingdescribing "iterators":"iterators":"iterators":"iterators":
[ ] Low memory consumption
[ ] Fast
[ ] Slow
[ ] Memory hog
9999 ---- TheTheTheThe getitemgetitemgetitemgetitem methodmethodmethodmethod allowallowallowallow totototo (single(single(single(single answeransweransweranswer
allowed)allowed)allowed)allowed) ::::
[ ] obtain the list of some object's properties
[ ] acquire a an attribute from its name
[ ] to use an object like a dictionary
[ ] to use an object like a list
10)10)10)10)WhichWhichWhichWhich oneoneoneone ofofofof thethethethe followingfollowingfollowingfollowing modulesmodulesmodulesmodules doesn'tdoesn'tdoesn'tdoesn't
existexistexistexist inininin pythonpythonpythonpython ????
[ ] os
[ ] sys
[ ] std
[ ] re
本文档为【03_python_qcm】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。