专本试题及答案.docVIP

  • 2
  • 0
  • 约2.23千字
  • 约 9页
  • 2026-07-13 发布于新疆
  • 举报

专本试题及答案

单项选择题(每题2分,共20分)

1.下列哪个是Python的内置数据类型?

A.数组

B.字典

C.集合

D.栈

答案:B

2.在Python中,如何表示一个列表?

A.(1,2,3)

B.[1,2,3]

C.{1,2,3}

D.{1:a,2:b}

答案:B

3.函数在Python中如何定义?

A.deffunction_name():

B.functionfunction_name():

C.function_name():

D.voidfunction_name():

答案:A

4.下列哪个是Python中的循环语句?

A.for

B.while

C.if

D.alloftheabove

答案:D

5.在Python中,如何获取字符串的长度?

A.len(str)

B.str.length()

C.len(str)

D.str.size()

答案:C

6.下列哪个是Python中的比较运算符?

A.=

B.==

C.===

D.

答案:B

7.在Python中,如何打开一个文件?

A.open(file.txt)

B.open(file.txt,r)

C.file(file.txt)

D.bothAandB

答案:D

8.下列哪个是Python中的异常处理语句?

A.try

B.catch

C.exception

D.bothAandC

答案:D

9.在Pyt

文档评论(0)

1亿VIP精品文档

相关文档