每个python对象都具有布尔值、下列是true的是_python测试开发面试题

试卷时间 60分钟,请不要在试卷上作答,用A4纸做答题纸作答。

一,中文单项选择题(30分,每个3分)

1.下列哪个语句在Python中是非法的?

A、x = y = z = 1                 B、x = (y = z + 1)

C、x, y = y, x                        D、x  +=  y

2.关于Python内存管理,下列说法错误的是

A、变量不必事先声明          B、变量无须先创建和赋值而直接使用

C、变量无须指定类型         D、可以使用del释放资源

3、下面哪个不是Python合法的标识符

A、int32                 B、40XL         C、self                D、name

4、下列哪种说法是错误的

A、除字典类型外,所有标准对象均可以用于布尔测试

B、空字符串的布尔值是False

C、空列表对象的布尔值是False

D、值为0的任何数字对象的布尔值是False

5、下列表达式的值为True的是

A、5+4j > 2-3j                         B、3>2>2

C、(3,2) ‘xyz’

6、Python不支持的数据类型有

A、char                 B、int                  C、float                 D、list

7、关于Python中的复数,下列说法错误的是

A、表示复数的语法是real + image j   B、实部和虚部都是浮点数

C、虚部必须后缀j,且必须是小写   D、方法conjugate返回复数的共轭复数

8、关于字符串下列说法错误的是

A、字符应该视为长度为1的字符串                 B、字符串以标志字符串的结束

C、既可以用单引号,也可以用双引号创建字符串   D、在三引号字符串中可以包含换行回车等特殊字符

9、以下不能创建一个字典的语句是

A、dict1 = {}                        B、dict2 = { 3 : 5 }         C、dict3 = {[1,2,3]: “uestc”}         D、dict4 = {(1,2,3): “uestc”}

10、下列Python语句正确的是

A、min = x  if  x y ? x : y

C、if (x > y)        print x         D、while True : pass

二,英文单项选择题(30分)

1.what gets printed? Assuming python version 2.x()

print type(1/2)

A. B. C. D. E.

2. What gets printed?()

1

2

nums = set([1,1,2,3,3,3,4])

print len(nums)

A.1 B.2 C.4 D.5 E.7

3. What gets printed?()

1

2

3

4

5

6

7

8

9

10

11

12

counter = 1

def doLotsOfStuff():

global counter

for i in (1, 2, 3):

counter += 1

doLotsOfStuff()

print counter

A.1 B.3 C.4 D.7 E.none of the above

4. What gets printed?()

1

print r"nwoow"

A.new line then the string: woow

B.the text exactly like this: r”nwoow”

C.the text like exactly like this: nwoow

D.the letter r and then newline then the text: woow

E.the letter r then the text like this: nwoow

5. Which numbers are printed?()

1

2

3

4

5

for i in  range(2):

print i

for i in range(4,6):

print i

A.2, 4, 6 B.0, 1, 2, 4, 5, 6 C.0, 1, 4, 5 D.0, 1, 4, 5, 6, 7, 8, 9 E.1, 2, 4, 5, 6

6. What gets printed by the code snippet below?()

1

2

3

import math

print math.floor(5.5)

A.5 B.5.0 C.5.5 D.6 E.6.0

7. Assuming the filename for the code below is /usr/lib/python/person.py

and the program is run as: python /usr/lib/python/person.py

What gets printed?()

1

2

3

4

5

6

7

8

class Person:

def __init__(self):

pass

def getAge(self):

print __name__

p = Person()p.getAge()

A.Person B.getAge C.usr.lib.python.person D.main E.An exception is thrown

8. What gets printed?()

1

2

3

4

5

6

names1 = ['Amir', 'Barry', 'Chales', 'Dao']

if 'amir' in names1:

print 1

else:

print 2

A.1 B.2 C.An exception is thrown

9.  What gets printed?()

1

2

3

4

,用A4纸做答题纸作答。

一,中文单项选择题(30分,每个3分)

1.下列哪个语句在Python中是非法的?

A、x = y = z = 1                 B、x = (y = z + 1)

C、x, y = y, x                        D、x  +=  y

2.关于Python内存管理,下列说法错误的是

A、变量不必事先声明          B、变量无须先创建和赋值而直接使用

C、变量无须指定类型         D、可以使用del释放资源

3、下面哪个不是Python合法的标识符

A、int32                 B、40XL         C、self                D、name

4、下列哪种说法是错误的

A、除字典类型外,所有标准对象均可以用于布尔测试

B、空字符串的布尔值是False

C、空列表对象的布尔值是False

D、值为0的任何数字对象的布尔值是False

5、下列表达式的值为True的是

A、5+4j > 2-3j                         B、3>2>2

C、(3,2) ‘xyz’

6、Python不支持的数据类型有

A、char                 B、int                  C、float                 D、list

7、关于Python中的复数,下列说法错误的是

A、表示复数的语法是real + image j   B、实部和虚部都是浮点数

C、虚部必须后缀j,且必须是小写   D、方法conjugate返回复数的共轭复数

8、关于字符串下列说法错误的是

A、字符应该视为长度为1的字符串                 B、字符串以标志字符串的结束

C、既可以用单引号,也可以用双引号创建字符串   D、在三引号字符串中可以包含换行回车等特殊字符

9、以下不能创建一个字典的语句是

A、dict1 = {}                        B、dict2 = { 3 : 5 }         C、dict3 = {[1,2,3]: “uestc”}         D、dict4 = {(1,2,3): “uestc”}

10、下列Python语句正确的是

A、min = x  if  x y ? x : y

C、if (x > y)        print x         D、while True : pass

二,英文单项选择题(30分)

1.what gets printed? Assuming python version 2.x()

print type(1/2)

A. B. C. D. E.

2. What gets printed?()

1

2

nums = set([1,1,2,3,3,3,4])

print len(nums)

A.1 B.2 C.4 D.5 E.7

3. What gets printed?()

1

2

3

4

5

6

7

8

9

10

11

12

counter = 1

def doLotsOfStuff():

global counter

for i in (1, 2, 3):

counter += 1

doLotsOfStuff()

print counter

A.1 B.3 C.4 D.7 E.none of the above

4. What gets printed?()

1

print r"nwoow"

A.new line then the string: woow

B.the text exactly like this: r”nwoow”

C.the text like exactly like this: nwoow

D.the letter r and then newline then the text: woow

E.the letter r then the text like this: nwoow

5. Which numbers are printed?()

1

2

3

4

5

for i in  range(2):

print i

for i in range(4,6):

print i

A.2, 4, 6 B.0, 1, 2, 4, 5, 6 C.0, 1, 4, 5 D.0, 1, 4, 5, 6, 7, 8, 9 E.1, 2, 4, 5, 6

6. What gets printed by the code snippet below?()

1

2

3

import math

print math.floor(5.5)

A.5 B.5.0 C.5.5 D.6 E.6.0

7. Assuming the filename for the code below is /usr/lib/python/person.py

and the program is run as: python /usr/lib/python/person.py

What gets printed?()

1

2

3

4

5

6

7

8

class Person:

def __init__(self):

pass

def getAge(self):

print __name__

p = Person()p.getAge()

A.Person B.getAge C.usr.lib.python.person D.main E.An exception is thrown

8. What gets printed?()

1

2

3

4

5

6

names1 = ['Amir', 'Barry', 'Chales', 'Dao']

if 'amir' in names1:

print 1

else:

print 2

A.1 B.2 C.An exception is thrown

9.  What gets printed?()

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值