试题 试卷
题型:单选题 题类: 难易度:普通
浙江百校2023年9月高三信息技术起点调研测试卷
q=[0]*6
q[0]=1
head=0; tail=1
while tail<len(q)=1:
x=q[head]
if x%2==0:
q[tail]=x//2
tail+=1
else:
q[tail]=x*2
q[tail+1]=x*3
tail+=2
head+=1
程序运行后 , tail-head的值为( )
shifouzhaodao = False ‘shifouzhaodao:是否找到
szysxh = 0 ‘szysxh:数组元素序号
Do While szysxh < 5 And not shifouzhaodao
szysxh = szysxh + 1
if dczsz(szysxh) = Key then shifouzhaodao = true
Loop
if not shifouzhaodao then szysxh = 0
数组元素dczsz (1)到dczsz (5)的数据依次为“-1,3,7,10,7”,当变量key值为7时,运用该算法处理后,变量i的值是( )
Function search(key As Integer)As String
Dim pos As Integer,i As Integer,j As Integer
Dim nc As String
i=1:j=6:nc=“”
Do While i<=j
m=Int((i+j)/2)
nc=nc+Str(m)
If d(m)=key Then
Exit Do ‘Exit Do表示退出Do While循环
ElseIf key<d(m)Then
j=m-1
Else
i=m+1
End If
search=nc
End Function
数组元素d(1)到d(6)的值依次为“23,34,45,65,78,98”,则下列说法正确的是 ( )
n=0:i=1:j=8
Key=Val(Text1.Text)
m=(i+j)\2
If Key=d(m)Then Exit Do ‘Exit Do退出循环
If Key>d(m)Then
j=m-1:n=n-1
i=m+1:n=n+1
Label1.Caption=Str(n)
当输A不同的Key值,运行该程序段后,在标签Label1中显示的不同结果共有:( )
i=1 : j=8 : t=0
key=Int(Rnd()*7)+14
m = Int((i + j )/2)
t=t+1
if a(m)=key Then
Exit Do else
If a(m)>key Then j=m-1
End if
End if Loop
数组元素 a(1)到 a(8)的值依次为“2,11,14,15,18,19,20,22”,该程序段运行结束后,变量t的最大值可能是( )
a(1)=1:a(2)=2:a(3)=3:a(4)=3:a(5)=1
n=5:k=3
L=3:R=10 ‘L值可以为数组元素最大值,R可以为数组所有元素和
Do While L+1<R
m=(L+R)\2
t=0:s=0
For i=1 To n
If t+a(i)>=m Then
s=s+1
t =a(i)
t =t+a(i)
Next i
If t>0 then s=s+1
If s<=k Then① Else ②
Label1.Caption=“最小值为”&Str(L)
要使程序实现上述算法思想,则代码中①②处应为( )
试题篮