
2024年6月青少年软件编程Python等级考试试卷六级真题(含答案)
14页1、2024年6月青少年软件编程Python等级考试试卷六级真题(含答案)分数:100 题数:38一、单选题(共25题,共50分)。1.运行下面代码的正确结果是()。with open(example.txt, a) as file: file.write(I see you.)其中example.txt文件内容如下: This is an example.A.This is an example.B.I see you.C.This is an example.I see you.D.I see you.This is an example.标准答案:C。2.在Python中,以下哪个函数可以用于创建一个新的文件()。A.write( )B.create( )C.new( )D.open( )标准答案:D。3.运行下面代码的正确结果是()。filename = example.txtline_count = 0with open(filename, r) as file: for line in file: line_count += 1print(fThe file example h
2、as line_count lines.)其中example.txt文件内容如下: My Favorite AnimalOnce upon a time, I had a pet dog named Max.Max was the most obedient dog I knew.We played fetch in the park, went on long walks in the woods, and even took naps together on lazy afternoons.A.4B.3C.2D.1标准答案:A。4.运行下面代码的正确结果是()。with open(myfile.txt, w) as out_file: out_file.write(This is my first Python program.)with open(myfile.txt, r) as in_file: myfile = in_file.read()print(myfile)其中myfile.txt文件内容如下: Hello World!A.Hello World!B.This is
3、 my first Python program.C.Hello World!This is my first Python program.D.Hello World!This is my first Python program.标准答案:B。5.编写程序绘制如下图所示的直线,程序空白处应填()。import matplotlib.pyplot as pimport numpy as npx= np.array(0,1,2,_,4,5)p.plot(x,o:r)p.show()A.1B.2C.3D.4标准答案:C。6.已知程序1绘制的图形如下图所示,要绘制相同的图形,请补全程序2空白()。程序1:import matplotlib.pyplot as pimport numpy as npx= np.array(0,1,0,1,0,1,0)p.plot(x,o:r)p.show()程序2:import matplotlib.pyplot as pimport numpy as npx= np.array(3,4,3,_,3,4,3)p.plot(x,o:r)p.show()A.1B
4、.2C.3D.4标准答案:D。7.在命令行窗口分别运行以下代码,输出结果是()。import numpy as npnp.full(6,6)A.array(6, 6, 6, 6, 6, 6B.array(6, 6, 6, 6, 6, 6C.6, 6, 6, 6, 6, 6D.6, 6, 6, 6, 6, 6标准答案:A。8.运行以下关于二维数组读取的程序,输出结果是()。a=1,2,3,4,5,6,7,8,9print(a12)A.2B.4C.5D.6标准答案:D。9.运行以下代码,绘制出来的第六个柱形图颜色是()。import matplotlib.pyplot as pimport numpy as npx=np.array(a,b,c,d,e,f)h=np.array(1,4,5,6,4,3)c=np.array(red,blue,green)p.bar(x=x,height=h,color=c)p.show()A.redB.blueC.greenD.black标准答案:C。10.关于JSON格式数据转为Python数据格式,运行以下程序,输出结果是()。import jsona
《2024年6月青少年软件编程Python等级考试试卷六级真题(含答案)》由会员g***分享,可在线阅读,更多相关《2024年6月青少年软件编程Python等级考试试卷六级真题(含答案)》请在金锄头文库上搜索。