组卷题库 > 高中信息技术试卷库
试题详情
某对分查找算法的 VB 程序如下:

Private Sub Command1_Click()

    Dim d(1 To 10) As Integer, i As Integer, j As Integer

    Dim m As Integer, key As Integer, s As String

    key = Int(Rnd( ) * 50) *2+ 1

    s = "": i = 1: j = 10

    Do While i <= j

        m = (i + j) \ 2

        If key = d(m) Then Exit Do

        If key < d(m) Then

            j = m - 1: s = s + "L"

        Else

            i = m + 1: s = s + "R"

        End If

    Loop

    Label1.Caption = s

End Sub

若数组d(1)至d(10)的值依次为"11,13,20,48,51,67,70,73,80,91",若执行后 Label1 上显示2个“L”和1个“R”或2个“R”和1个“L”,则key的可取值个数为(   )

A、6
B、13
C、17
D、22
知识点
参考答案
采纳过本试题的试卷
教育网站链接