2026年python期末考试试卷及答案.docVIP

  • 2
  • 0
  • 约3.45千字
  • 约 13页
  • 2026-04-15 发布于辽宁
  • 举报

2026年python期末考试试卷及答案

一、单项选择题(每题2分,共10题)

1.在Python中,用于定义一个类的关键字是:

A.function

B.class

C.def

D.struct

答案:B

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

A.list

B.tuple

C.dictionary

D.array

答案:D

3.在Python中,如何正确地注释一行代码?

A.//Thisisacomment

B.Thisisacomment

C./Thisisacomment/

D.--Thisisacomment

答案:B

4.下列哪个是Python中用于打开文件的函数?

A.open()

B.file()

C.open_file()

D.new_file()

答案:A

5.在Python中,如何从字符串中提取子字符串?

A.substring(str,start,end)

B.str[start:end]

C.extract(str,start,end)

D.str.substring(start,end)

答案:B

6.下列哪个是Python中用于循环的语句?

A.loop

B.while

C.for

D.repeat

答案:C

7.在Python中,如何正

文档评论(0)

1亿VIP精品文档

相关文档