当前位置: 高中信息技术 / 单选题
  • 1. (2020·东阳模拟) 有如下VB程序段:

    Dim d(1 to 5) As Integer, i As Integer

    For i= 1 To 8

      a(i) =Int(Rnd*10) + 1

    Next i

    For i=1 To 5 Step 2

      k=i

      For j=i+2 To 7 Step 2

        If a(j) <a(k) Or a(j) =a(k) And a(j+1) <a(k+1)

      Next j

      Then k=j

      If i<>k Then

        t=a(i):a(i)=a(k):a(k)=t

        t=a(i+1):a(i+1)=a(k+1):a(k+1)=t

      EndIf

    Next i

    运行该程序段后,数组a各元素的值可能为(  )

    A . 1,2,1,1,4,3,6,5 B . 1,1,1,2,3,4,5,6 C . 0,1,5,2,7,4,5,6 D . 3,4,5,2,6,4,7,11

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