【题解】【中国大学MOOC】(东北大学)大学计算机--Python算法实践测验——第四周:查找算法

1.下列表达式结果不是整数的是_____.

编号 选项
A 12%3
B 11//3
C 11%3
D 12/3

2.当输入是4321时,下面程序的输出结果是______。 num = input(“请输入一个整数:”) while num != 0:         print(num % 10)    num = num // 10

编号 选项
A 4321
B 1234
C 1234
D 4321

3.下列哪个是不合法的布尔表达式____。

编号 选项
A 3=x
B a>1 and a<0
C a>1 or a<0
D x in range(10)

4.下列语句的循环次数是:______。k=1000while k>1:    k=k//2

编号 选项
A 9
B 10
C 11
D 12

5.以下叙述正确的是:______.

编号 选项
A 从多层循环嵌套中退出时,只能使用goto语句
B 只能在循环体内使用break语句
C continue语句的作用是结束整个循环的执行
D 在循环体内使用break语句或continue语句的作用相同

6.a=[1,2,3,4,5]b=a[-4::2]则b为______.

编号 选项
A [-4,-2]
B [3,5]
C [1,3]
D [2,4]

7.下列语句会陷入死循环的是_____.

编号 选项
A while 1<10:    break
B while True:    if 1<10:        break
C while True:    break
D while 1<10:    print(“hello”)

8.下列语句错误的是_____。

编号 选项
A import sqrt
B from math import *
C import math
D from math import sqrt

9.a=[1,1,1,2,2,2,3,3,3]b=a.count(3)c=a.index(3)则b和c的值分别是_____.

编号 选项
A True,6
B 3,6
C 1,7
D 3,7

10.a=[]下列哪个语句不能为空列表a添加元素1____.

编号 选项
A a.append(1)
B a.insert(0,1)
C a.extend(1)
D a.extend([1])

你可能感兴趣的:(#,中国大学MOOC)