青少年软件编程(Python)等级考试试卷(五级)
一、单选题(共25题,共50分)
1.已知x=[3,5,7],那么执行语句x[len(x):]=[1,2]后,x的值?(A)
A. [3,5,7,1,2]
B. [1,2,3,5,7]
C. [3,5,7]
D. [1,2]
2.以下代码的输出结果是?(C)
x='C\0T\OP'
print(len(x))
A.3
B.4
C.5
D.7
3.字符串str1='victory',显示结果为'or'的选项是?(D)
A.print(str1[5:6])
B.print(str1 [4:5])
C.print(str1[5:7])
D.print(str1 [4:-1])
4.表达式str(18/3)的结果是?(C)
A. ValueError
B. '6'
C. '6.0'
D.'18/3'
5.执行下列程序段后输出结果?(A)
>>>str1='python world
>>>str1.title()
A. 'Python World'
B. 'PYTHON WORLD'
C. 'python world'
D. 'Python world'
6.执行下面程序段后,结果正确的选项是?(A)
dic1 ={1:'a',2:'b' 3:'c' 4:'d'}
str1=''
for i in range(1,3):
str1+=dic1[i]
print(str1)
A.'ab'
B.'abc'
C. 123
D. 12
7.书店现有字典书目dict1={1:平凡世界',2:'西游记’,3:'红楼梦’'水浒传’},当前红楼梦售出,需要删除字典书目中的红4:楼梦,正确的操作是?(D)
A. del dict1[2]
B.del dict1['红楼梦']
C.del dict1[红楼梦]
D.del dict1[3]
8.执行下列程序语句的结果是?(A)
>>>list1 =[i*i foni in range(1,9,2)]
>>>list1
A.[1,9,25,49]
B.[1,9,25,49,81]
C.[1,3,5,7]
D.[1,.3,5,7,9]
9.执行下列程序语句后tuple(t)和list(t)的结果为?(B)
>>>t=(i*i for i in range(4))
>>>tuple(t)
>>>list(t)
A.(0.1.4.9)
[0,1.4.9]
B.(0.1.4.9)
[]
C.()
[]
D.(0,1.49,16)
[0,1,4,9,16]
10.执行下列程序语句的返回结果为?(D)
>>>{i:str(i*i) for i in range(4)}
A.{0:0,1:1,2:4,3:9}
B. {0,1,4,9}
C.{0:'0',1:'1',2:'4',3:'9',4:16'}
D.{0:'0',1:'1',2:'4',3:'9'}
================================================
答案和更多内容请查看网站:【试卷中心 -- Python编程 其它】
网站链接
青少年软件编程历年真题模拟题实时更新
================================================