题型:单选题 题类:常考题 难易度:困难
浙江省嘉兴市2018-2019学年高三信息技术3月嘉丽联考试卷
Dim a(1 To 10)As Integer
Dim i As Integer,j As Integer,m As Integer,flag As Boolean
Dim key As Integer,n As Integer,C As Integer,d As Integer
i=1:J=10:m=0:flag=False
key=Val(Text1.Text)
Do While i<=J And Not flag
If key<a(i)Or key>a(j)Then n=-1:Exit Do 未找到退出
If a(i) <>a(j) Then
c=key-a(i):d=a(j)一a(i)
m=i+Int(c*(j-i)/d)
Else
m=i
End If
If key=a(m)Then flag=True:n=m
If key>a(m)Then i=m+1
If key<a(m)Then j=m-1
Loop
If flag=False Then n=-1
其中数组元素a(1)到a(10)分别为“15,25,37,40,63,70,87,90,92,96”,下列说法错误的是( )
1 | 5 | 7 | 9 |
4 | 6 | 10 | 15 |
8 | 11 | 12 | 19 |
14 | 16 | 18 | 21 |
已知数据逐行存储在数组a中,在杨氏矩阵数组中查找某数字是否存在的VB程序段如下:
cz = False : i = 1 : j = n
Do While j >= 1 And i <= n
If key < a(s) Then
⑵
ElseIf key > a(s) Then
⑶
Else
cz = True:Exit Do
End If
Loop
方框中的代码由以下三部分组成:
①j = j - 1
②s = (i - 1) * n + j
③i = i + 1
代码顺序正确的选项是( )
试题篮