Web前端最全Python面试题整理(选择题及其答案)_python面试选择题,我总结了24家大厂100份面试题

最后

除了简历做到位,面试题也必不可少,整理了些题目,前面有117道汇总的面试到的题目,后面包括了HTML、CSS、JS、ES6、vue、微信小程序、项目类问题、笔试编程类题等专题。

单选题

7、Python 中,以下哪个赋值操作符是错误的?

A、+=
B、-=
C、*=
D、X=
正确答案:D

单选题

8、下面哪一个不是 Python 的数据类型?

A、列表(List)
B、字典(Dictionary)
C、元组(Tuples)
D、类(Class)
正确答案:D

单选题

9、代码 L = [1, 23, “nowcoder”, 1] 输出的数据类型是?

A、List
B、Dictionary
C、Tuple
D、Array
正确答案:A

单选题

10、代码 a = [ 1,2,3,4,5 ],以下输出结果正确的是?

A、print(a[:]) => [1,2,3,4]
B、print(a[0:]) => [2,3,4,5]
C、print(a[:100]) => [1,2,3,4,5]
D、print(a[-1:]) => [1,2]
正确答案:C

单选题

11、以下哪个代码是将字符串转换为浮点数?

A、int(x [,base])
B、long(x [,base])
C、float(x)
D、str(x)
正确答案:C

多选题

12、以下哪个 if 语句是正确的?

A、if a >= 22:
B、if (a >= 22):
C、if (a => 22)
D、if a >= 22
正确答案:AB

单选题

13、以下哪个关键字是用于给 if 语句添加其他条件语句的?

A、else if
B、elseif
C、elif
D、其他都不对
正确答案:C

单选题

14、以下代码中哪个是定义函数的语句是正确的?

A、def someFunction():
B、function someFunction()
C、def someFunction()
D、function someFunction():
正确答案:A

单选题

15、以下代码中哪个是正确的 for 循环语句是?

A、for(a = 0; a < 3; a++)
B、for a in range(3)
C、for a loop 3:
D、for a in range(1,3):
正确答案:D
单选题

16、以下python代码中哪个是正确的 while 循环语句是?

A、while loop a < 10
B、while a <10:
C、while(a < 10)
D、while loop a < 10:
正确答案:B
单选题

17、假设你有一个变量 “example”,如何判断它的类型?

A、getType(example)
B、Type(example)
C、type(example)
D、example、type:
正确答案:C

单选题

18、将字符串 “example” 中的字母 a 替换为字母 b,以下代码正确的是?

A、example、swap(‘b’, ‘a’)
B、example、replace(‘a’,‘b’)
C、example、match(‘b’,‘a’)
D、example、replace(‘b’,‘a’)
正确答案:B

单选题

19、Python 中,以下哪个代码是正确的列表?

A、sampleList = {1,2,3,4,5}
B、sampleList = (1,2,3,4,5)
C、sampleList = /1,2,3,4,5/
D、sampleList = [1,2,3,4,5]
正确答案:D

单选题

20、Python 中,以下哪个代码是正确的元组?

A、sampleTuple = (1,2,3,4,5)
B、sampleTuple = {1,2,3,4,5}
C、sampleTuple = [1,2,3,4,5]
D、sampleList = /1,2,3,4,5/
正确答案:A

单选题

21、Python 中,以下哪个代码是正确的字典?

A、myExample = {‘someItem’=>2, ‘otherItem’=>20}
B、myExample = {‘someItem’: 2, ‘otherItem’: 20}
C、myExample = (‘someItem’=>2, ‘otherItem’=>20)
D、myExample = (‘someItem’: 2, ‘otherItem’: 20)
正确答案:B

单选题

22、代码 print(type([1,2])) 输出结果为:

A、<class ‘tuple’>
B、<class ‘int’>
C、<class ‘set’>
D、<class ‘list’>
E、<class ‘complex’>
正确答案:D

单选题

23、下面代码输出结果为?

def f(): pass
print(type(f()))

A、<class ‘function’>
B、<class ‘tuple’>
C、<class ‘NoneType’>
D、<class ‘str’>
E、<class ‘type’>
正确答案:C
官方解析: type() 的参数是函数的返回值,该返回值为 None。

单选题

24、下面代码输出结果为?

a = [1,2,3,None,(),[],]
print(len(a))

A、syntax error
B、4
C、5
D、6
E、7
正确答案:D

单选题

25、Python 中,如何输出列表中的第二个元素?

A、print(example[2])
B、echo(example[2])
C、print(example[1])
D、print(example(2))
正确答案:C

单选题

26、print(‘%、2f’ % 123、444) 输出结果为?

A、123、44
B、12
C、123、444
D、44
正确答案:A

单选题

27、代码 def a(b, c, d): pass 含义是?

A、定义一个列表,并初始化它。
B、定义一个函数,但什么都不做。

最后

除了简历做到位,面试题也必不可少,整理了些题目,前面有117道汇总的面试到的题目,后面包括了HTML、CSS、JS、ES6、vue、微信小程序、项目类问题、笔试编程类题等专题。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值