信息
You have already completed the 测验 before. Hence you can not start it again.
You must sign in or sign up to start the 测验.
测验 complete. Results are being recorded.
0 of 20 问题 answered correctly
Your time:
时间已经过去了
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
-
题 1 of 20
1:
运行下列程序,输出结果正确的是?( )
def demo(lst, k):
if k<len(lst):
return lst[k:]+lst[:k]
lst=[1,2,3,4,5,6]
print(demo(lst,4))
-
-
-
-
-
题 2 of 20
2:
在解决问题过程中,常用的“二分法”是一种什么算法?( )
-
题 3 of 20
3:
在Python Shell提示符下输入以下哪个选项,回车后,再输入pi,回车,能得到数值3.141592653589793?( )
-
题 4 of 20
4;
下列程序段中自定义函数do(n)的作用是?( )
def do(n):
s=0
f=1
for i in range(1,n+1,2):
s=s+1/i*f
f=-f
return s
print(do(10))
-
题 5 of 20
5:
下列几个选项中,不是Python定义函数规则的是?( )
-
题 6 of 20
6:
以下哪项不是使用分治法解决问题的步骤?( )
-
题 7 of 20
7:
在Python中,调用下面函数的返回值为?( )
def fun():
x=101
-
题 8 of 20
-
题 9 of 20
-
题 10 of 20
10;
以下函数的返回值是?( )
def pic(a:int,b:str)->str:
c=a*b
print(c)
return c
pic(5,’*#*’)
-
题 11 of 20
11:
不超过100个元素的有序数列,使用二分查找能找到指定的元素,可能的查找次数不
包括?( )
-
题 12 of 20
12:
运行以下代码,正确的打印结果是?( )
def f():
c=0
for i in range(4,51,4):
if i%6==0:
c=c+1
return c
print(f())
-
题 13 of 20
13:
0个人站一列,分苹果,问第10个人分到多少个苹果,他说比前面一个人多分到2个
,依次往前,都说比前面一个人多分到2个,最后问第一个人,他说分到10个苹果。
用以下函数求第10个人分到的苹果数,则应补充选项为?( )
def apple(n):
if n == 1:
return 10
else:
return
print(apple(10))
-
题 14 of 20
14:
观察程序段,以下说法错误的是?( )
def fib(n):
if n==1 or n==2:
s=1
else:
s=fib(n-1)+fib(n-2)
return s
m=int(input(“请输入m的值(m>2):”))
print(fib(m))
-
题 15 of 20
15:
关于python函数参数的说法正确的是?( )
-
题 16 of 20
16:
关于递归与递推方法的比较,错误的观点是?( )
-
题 17 of 20
17:
运行以下代码,输出结果正确的是?( )
a=1
b=c=[]
def fun(a,c):
a=2
c.append(a)
fun(a,c)
print(a,b,c)
-
题 18 of 20
18:
关于Turtle库的表述中,错误的是?( )
-
题 19 of 20
19:
有100枚金币,其中有1枚轻1克的假金币,现在要找出这枚假金币,但身边只有1个
没有刻度的天秤。小明先是将金币分成50枚一堆,共两堆称重,在轻的那一堆中又分
成两堆,接着在轻的25枚中分成12,12,1三堆称重,若两堆12枚的重量相同,则假币
为单独剩下的那一枚,否则在轻的那一堆中继续按照之前的办法称下去,直到找到假金
币。请问小明采用的办法与哪个算法有着相似之处?( )
-
题 20 of 20
20:
运行以下代码,正确的打印结果是?( )
def f(s):
t=0
max=0
for i in s:
if i>=”0″ and i<=”9″:
t=t+1
else:
if t>max:
max=t
t=0
print(max)
list=”123ab45cd6d”
f(list)