当前位置: 高中信息技术 / 单选题
  • 1. (2019高三上·浙江月考) 【加试题】有如下程序段:

       Const n = 6

       Dim a(1 To n) As Integer

       Dim i As Integer, j As Integer, t As Integer

       Do While True

    For i=1 to n-1

          If a(i)>a(i+1) then Exit For

    Next i

         If i < n Then

           For i = 1 To n

            j = Int(Rnd * 6) + 1

            t = a(j): a(j) = a(i): a(i) = t

           Next i

         Else

           Exit Do

         End If

       Loop

    数组中a(1)到a(6)的值依次为“56,34,48,87,65,96”,经上述程序段执行后a(1)到a(6)的值依次为(  )

    A . 96 87 65 56 48 34 B . 34 48 56 65 87 96  C . 选项A和B都有可能 D . 选项A和B都不可能

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