试题

试题 试卷

logo

题型:单选题 题类:常考题 难易度:困难

浙江省宁波市十校2019届高三上学期9月联考试卷

【加试题】数组a中依次存放6个有序数据“23 33 44 55 66 77”。

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

该程序段运行后,下列各变量的值不正确的是(  )

A、i=3 B、j=2 C、c=3 D、m=2
举一反三
返回首页

试题篮