1有如下VB程序段:For i = 1 To 6a(i)=Int(Rnd*10)+1Next iFor i = 1 To 5If i Mod 2=1 And a(i)>a(i+1) Thent=a(i):a(i)=a(i+1):a(i+1)=tElsea(i)=a(i)+1End IfNext i执行程序后,a数组各元素可能是( )
A.11,11,7,9,3,9
B.6,2,8,10,5,9
C.6,9,3,7,8,12
D.3,9,0,8,2,7
开始考试练习点击查看答案2有VB程序段如下:For i = 1 To 6a(i) = Int(Rnd * 20) + 1If a(i) Mod 2 = i Mod 2 Thena(i) = a(i) - 1Elsea(i) = a(i) + 2End IfNext i执行该程序段后,a(1)~a(6)各元素可能的是( )
A.13,2,7,12,5,18
B.22,7,0,15,4,19
C.20,9,18,23,4,7
D.6,0,4,21,18,17
开始考试练习点击查看答案3有如下所示VB程序段:str1 = ”ABCDEFGHIJKLMNOPQRSTUVWXYZ”s = ” ”For i = 1 To 4t = Int(Rnd * 10) + 1If t Mod 2 = i Mod 2 Thent = t + 1Elset = t + 2End Ifs = s + Mid(str1, t, 1)Next iList1.AddItem s执行该程序段后,列表框List1中可能显示的内容是( )
A.BADC
B.BCDY
C.DEFG
D.CDEF
开始考试练习点击查看答案4有如下VB程序段:i = 1: n = 5Do While i <= nx = Int(Rnd() * 9) + 1If x Mod 2 = 1 Thena(i) = xElsea(n)=xn=n-1End Ifi = i + 1Loop数组元素的初值均为0,执行该程序段后,在下列选项中a(1)至a(5)各元素值不可能的是( )
A.7 1 3 9 8
B.3 3 0 8 8
C.0 1 0 4 2
D.1 3 5 5 0
开始考试练习点击查看答案5有如下 VB 程序段:a(1) = 3: a(2) = 4: a(3) = 1: a(4) = 2: a(5) = 5k = Int(Rnd * 4) + 1For i = 1 To 5If i <> k ThenIf a(i)<a(k) Then t=a(i):a(i)=a(k):a(k)=tEnd IfNext i执行该程序段后,数组元素 a(1)到 a(5)中的值依次不可能为( )
A.5 4 3 2 1
B.3 4 1 2 5
C.3 4 2 1 5
D.1 4 3 2 5
开始考试练习点击查看答案6有以下VB程序段:a(1) = 2For i = 2 To 3a(i)=a(i-1)-Int(Rnd()*2)If i Mod 2 = 1 Thena(i) = a(i) + 1Elsea(i) = a(i) - 1End IfNext i执行程序后,a(2)和a(3)的值不可能的是( )
A.1,1
B.1,0
C.0,1
D.0,0
开始考试练习点击查看答案7有如下 VB 程序段:For i = 1 To 6a(i) = Int(Rnd() * 10) + 1If a(i) Mod 2 <> i Mod 2 Then i = i - 1Next iFor i = 1 To 5For j = 6 To i + 2 Step -1If a(j) < a(j - 2) Thent=a(j):a(j)=a(j-2):a(j-2)=tEnd IfNext jNext i执行程序后,a 数组各元素可能是 ( )
A.1,2,3,4,5,6
B.1,0,3,6,5,8
C.3,2,7,6,11,8
D.2,1,4,3,10,9
开始考试练习点击查看答案8有如下 VB 程序段:a(1)=6:a(2)=9:a(3)=3a(4)=7:a(5)=8:a(6)=1t = 2 * Int(Rnd * 3) + 1For i = t To 5k = iFor j = i + 1 To 6If a(j) < a(k) Then k = jNext jIf k <> i Thentemp = a(i): a(i) = a(k): a(k) = tempEnd IfNext i执行该程序段后,a(1)~a(6)各元素的值不可能是( )
A.6,1,3,7,8,9
B.6,9,1,3,7,8
C.6,9,3,7,1,8
D.1,3,6,7,8,9
开始考试练习点击查看答案9有如下 VB 程序段:n = 8For i = 1 To nd(i) = Int(Rnd * 10) + 1Next iFor i = 2 To n - 1k = 1For j = 1 To n - iIf d(j)*k>d(j+2)*k Thentemp=d(j):d(j)=d(j+2):d(j+2)=tempEnd Ifk = -kNext jNext i执行该程序段后,d 数组各元素可能是( )
A.3,10,3,5,4,4,10,1
B.0,3,4,5,6,6,7,8
C.2,1,3,4,5,6,8,7
D.6,4,5,6,5,7,1,10
开始考试练习点击查看答案10有如下 VB 程序段:Dim a(1 To 6) As Integer, i As IntegerRandomizeFor i = 1 To 6a(i) = Int(Rnd * 10) + 1If a(i) Mod 2 = 1 Theni = i - 1ElseIf i Mod 2 = 0 Thena(i)=a(i)+a(i-1)End IfNext i最终 a 数组各元素的值可能是( )
A.8,14,3,10,2,12
B.2,4,6,10,12,24
C.10,16,8,18,8,4
D.6,12,10,20,4,8
开始考试练习点击查看答案