题库 高中信息

题干

有如下程序段:
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都不可能
上一题 下一题 0.99难度 选择题 更新时间:2019-04-11 09:39:32

答案(点此获取答案解析)