1.what does the following code do?(B)
def a(b, c, d): pass
A.defines a list and initializes it
B.defines a function, which does nothing
D.defines an empty class
2.what gets printed? Assuming python version 2.x(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())
starwarA.<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)
A.syntax error
B.4
C.5
D.6
E.7
8.what gets printed? Assuming python version 3.x(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
A.7
B.12
C.24
D.36
E.48
10. What gets printed?(A)
x = 4.5
y = 2
print x//y
A.2.0
B.2.25
C.9.0
D.20.25
E.21
11. What gets printed?(C)
nums = set([1,1,2,3,3,3,4])
print len(nums)
A.1
B.2
C.4
D.5
E.7
12. What gets printed?(A)
x = True
y = False
z = False
if x or y and z:
print "yes"
else:
print "no"
A.yes
B.no
C.fails 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:
else:
print 4
李尚恩A.1
B.2
京韵大鼓mp3下载C.3
D.4
14. If PYTHONPATH is set in the environment, which directories are searched for modules?(D)
A) PYTHONPATH directory
B) current directory
C) home directory
D) installation dependent default path
A.A only
B.A and D
C.A, B, and C
D.A, B, and D
E.A, B, C, and D
15. In python 2.6 or earlier, the code will print error type 1 if accessSecureSystem raises an exception of either AccessError type or SecurityError type(B)
try:
accessSecureSystem()
except AccessError, SecurityError:
print "error type 1"
continueWork()
A.true
B.false
16. The following code will successfully print the days and then the months(B)
daysOfWeek = ['Monday',
'Tuesday',
'Wednesday',
发布评论