下载此文档

python测试题.doc


文档分类:IT计算机 | 页数:约55页 举报非法文档有奖
1/55
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/55 下载此文档
文档列表 文档介绍
does the following code do?(B)
def a(b, c, d): pass
a list and initializes it
a function, which does nothing
a function, which passes its parameters through
an empty class
gets printed? Assuming python version (A)
print type(1/2)
A.<type 'int'>
B.<type 'number'>
C.<type 'float'>
D.<type 'double'>
E.<type 'tuple'>
3. what is the output of the following code?(E)
print type([1,2])
A.<type 'tuple'>
B.<type 'int'>
C.<type 'set'>
D.<type 'complex'>
E.<type 'list'>
4. what gets printed?(C)
def f(): pass
print type(f())
A.<type 'function'>
B.<type 'tuple'>
C.<type 'NoneType'>
D.<type 'str'>
E.<type 'type'>
5. what should the below code print?(A)
print type(1J)
A.<type 'complex'>
B.<type 'unicode'>
C.<type 'int'>
D.<type 'float'>
E.<type 'dict'>
6. what is the output of the following code?(D)
print type(lambda:None)
A.<type 'NoneType'>
B.<type 'tuple'>
C.<type 'type'>
D.<type 'function'>
E.<type 'bool'>
7. what is the output of the below program?(D)
a = [1,2,3,None,(),[],]
print len(a)
error




gets printed? Assuming python version (C)
print (type(1/2))
A.<type 'int'>
B.<type 'number'>
C.<type 'float'>
D.<type 'double'>
E.<type 'tuple'>
9. What gets printed?(C)
d = lambda p: p * 2
t = lambda p: p * 3
x = 2
x = d(x)
x = t(x)
x = d(x)
print x





10. What gets printed?(A)
x =
y = 2
print x//y





11. What gets printed?(C)
nums = set([1,1,2,3,3,3,4])
print len(nums)





12. What gets printed?(A)
x = True
y = False
z = False
if x or y and z:
print "yes"
else:
print "no"


to compile
13. What gets printed?(C)
x = True
y = False
z = False
if not x or y:
print 1
elif not x or not y and z:
print 2
elif not x or y or not y and x:

python测试题 来自淘豆网m.daumloan.com转载请标明出处.

相关文档 更多>>
非法内容举报中心
文档信息
  • 页数55
  • 收藏数0 收藏
  • 顶次数0
  • 上传人tswng35
  • 文件大小72 KB
  • 时间2021-05-11