理论卷2023年5月青少年软件编程(Python) · 六级
YLT Python 6级 2023.05
满分 100 · 及格 60 · 时长 60 分钟 · 共 38 题 (单选25 / 判断10 / 填空3)
试卷阅览 · 免费预览前 10 题 · 交卷后可查看答案与解析
1
单选题号 #19638
分值 2明明每天坚持背英语单词,他建立了英语单词错题本文件“mistakes.txt”,将每天记错的单词增加到该文件中,下列打开文件的语句最合适的是?( )
2
单选题号 #19639
分值 2小张近阶段要学习的英文单词存储在“data.txt”文件,格式如图所示。

处理“data.txt”文件中英文单词的Python程序段如下:
file = open("data.txt")
for word in file:
if word[0:1] == "c":
continue
else:
print(word)
file.close()
3
单选题号 #19640
分值 2文件“score.csv”中存放了3位同学的成绩数据,小李编写程序读取数据内容,文件内容和程序成功读取界面如图所示。
import csv
csv_reader = csv.reader(open(______))
for row in csv_reader:
print(______)
上述程序中划线处应填入?( )
4
单选题号 #19641
分值 2有如下程序代码:
import csv # ①
headers = ['学号','姓名','分数']
rows = [['202001','张三','98'],
['202002','李四','95'],
['202003','王五','92']]
with open('score.csv','w',encoding='utf8',newline='') as f : # ②
writer = csv.writer(f) # ③
writer.writerow(headers)
writer.writerows(rows) # ④
关于上述语句的解释,不正确的是?( )
5
单选题号 #19642
分值 2关于matplotlib模块中函数的功能,下列描述正确的是?( )
6
单选题号 #19643
分值 2绘制sin(x)的图形如图所示,画线处的语句是?( )

import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 30)
___________
plt.show()
7
单选题号 #19644
分值 2下列关于类和对象的说法,正确的是?( )
8
单选题号 #19645
分值 2有如下程序段:
class Student:
count = 0
def __init__(self, name):
self.name = name
Student.count += 1
def study(self):
print(f'{self.name}在学习')
student1 = Student("小明")
student2 = Student("小红")
student2.study()
执行代码后,下列说法不正确的是?( )
9
单选题号 #19646
分值 2有下列语句命令:
import sqlite3
conn = sqlite3.connect("test.db") # ①
cursor = conn.cursor() # ②
cursor.close() # ③
conn.close() # ④
下列关于语句功能解释,正确的是?( )
10
单选题号 #19647
分值 2commit()函数是提交数据库操作的命令函数,下列不需要执行该函数的数据库操作的是?( )
🔒
已解锁前 10 题
第 11~38 题(共 28 题)注册用户即可作答(每题 1 积分)
本卷为普通试卷:注册用户每题扣 1 积分(每日登录送 30 体验积分),交卷后查看答案与解析
