题型:单选题 题类:常考题 难易度:困难
浙江省宁波市十校2019届高三上学期9月联考试卷
Dim a(1 To 10) As Integer
Dim s As String, n, key As Integer
a(1) = 23: a(2) = 33: a(3) = 44: a(4) = 55: a(5) = 66: a(6) = 77
i = 1: j = 6: c = 0: key = 35
Do While i <= j
c = c + 1
m = (i + j) \ 2
If (j - i + 1) Mod 2 = 0 Then m = m + 1
If a(m) = key Then Exit Do
If key < a(m) Then j = m - 1 Else i = m + 1
Loop
该程序段运行后,下列各变量的值不正确的是( )
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
代码顺序正确的选项是( )
试题篮