信息技术python 测试题
一.单项选择题:(每题3分)
1.在Python中常用的输入输出语句分别是( )
A. input( ),output( ) B. input( ),print( )
C. input( ),printf( ) D. scandf( ),printf( )
2.以下Python中变量的命名正确的是( )
A. 1a=4 B. print=5 C. _A=2 D. a+b=3
3.如果要使变量b存储整数5,下列赋值语句正确的是( )
A. b='5' B. b="5" C. 5=b D. b=5
4.小程同学分别给a,b,c,d 四个变量赋值,具体如下:
a=100
b=3.14
c="xyz"
d="uvw"
请分析print(a+b,c+d)的运行结果( )
A. 100+3.14 "xyz"+”uvw" B. 103.14 xyzuvw
C. 103.14 "xyzuvw" D.100+3.14 xyzuvw
5. 小程同学先后给变量a赋值情况如下:
a=100
a=a+1
a="abc"
你能告诉小程同学变量a到底存储的是哪个量吗?( )
A. 100 B. abc C. 111 D.都有可能
6. 程序:
a=int(input())
b=int(input())
c=a+b
print(a,"+",b,"=",c)
通过键盘分别输入23和3,运算结果是( )
A. 26 B. 23 + 3 = 26 C. "23"+"3"=26 D.24+4=28
7. 运行下列Python程序,结果正确的是( )
a=32
b=14
c=a%b
print(c)
A. 2 B. 4 C. 32 D.14
8. 运行下列Python程序,输出结果为True,则空白处应为( )
a=15
b=46
if ________:
print("True")
else:
print("False")
A. a=b B. a>b C. a<b D.a==b
9. 运行下列Python程序,输出结果为0,则空白处应为( )
a=14
b=7
c=_______
print(c )
A. a-b B. a+b C. a/b D.a%b
for I in range(1,6):
print("*",end=" ")
10. 在Python中,运行下列程序,输出结果是( )
A. * * * * * B. ****** C. * * * * * * D.****
11. 下列哪个语句在Python中是非法的?( )
A.x=y=z=1 B. x=(y=z+1)
C. x,y=y,x D. x+=y
12. 执行下列语句后的显示结果是什么?( )
>>>world=”world”
>>>print(“hello”+world)
A. helloworld B. “hello”world
C. hello world D. 语法错误
13. 下列表达式的值为True的是( )
A.5+4j>2-3j B. 3>2>2
C. (3,2)<(3,2,5) D. ‘abc’>’xyz’
14. Python不支持的数据类型有( )
A.char B. int C. float D. list
15. type(1+2*3.14)的结果是:( )
A.<type ‘int’> B.<type ‘long’>
C.<type ‘float’> D.<type ‘str’>
二.填空题:(每空3分)
16. Python使用符号( )标示注释。
17. 表达式 1/4+2.75的值是( )。
18. 请给出计算 231-1的Python表达式( )。
19. 给出range(1,10,3)的值( )。(用逗号分隔)
20. Python的数据类型分为整型,( ),( ),( ),( )。
21. Python 的除法运算符是( ),取余运算符是( )。
22. 设s=’abcdefg’,则s[3]值是( ),s[3:5]值是( ),s[:5]值是( ),s[3:]值是( ),s[::-1]值是( )。
23.编写一个python程序,输入两个数,输出它们的大小。
a=float(input(“请输入一个数a:”))
b=float(input(“请输入一个数b:”))
if _________
print(a,”>=”,b)
else:
________
请填空:
①_________________
②_________________
24. 存在字符串“I,love,python”,取出love,并输出。
a=“I,love,python”
print(________)
填空:________________
25. 存在字符串“ab2b3n5n2n67mm4n2”,编程统计字符串中字母n出现的次数。
a="ab2b3n5n2n67mm4n2"
__________
for i in a:
if i_____"n":
count+=1
print("n出现的次数是:",______)
完成填空:
①_________________
②_________________
③_________________