当前位置: 高中信息技术 / 单选题
  • 1. (2020高二上·诸暨期末) 数组a为一组已按降序排序的正整数,依据对分查找思想:设计一个在数组a中查找数据Key的程序。实现该功能的VB程序段如下:

    Dim a(1 To 6) As Integer

    Const n = 6

    a(1) = 98: a(2) = 96: a(3) = 95

    a(4) = 90: a(5) = 87: a(6) = 81

    i = 1: j = n

    Key = Val(Text1.Text)

    f = False

    Do While  And f = False

        m = (i + j) \ 2

        If a(m) = Key Then

            Text1.Text = "已找到": f = True

        ElseIf a(m) > Key Then

           

        Else

           

        End If

    Loop

    上述程序中方框处语句依次为(    )

    A . i <= j   i = m + 1      j = m - 1 B . i <= j     j = m - 1       i = m + 1 C . i < j            j = m - 1       i = m + 1 D . i < j            i = m + 1      j = m - 1

微信扫码预览、分享更方便