试题 试卷
题型:单选题 题类:常考题 难易度:普通
浙江省高中信息技术 排序算法及程序实现同步练习
t=0
For i=1 To 4
flag=False
For j=5 To i+1 Step-1
If a(j)>a(i) Then flag=True
t=t+1
temp=a(j):a(j)=a(i):a(i)=temp
End If
Next j
If flag=False Then Exit For
Next i
For i = 1 To 3
For j = 5 To i Step -1
If a(j) < a(j + 1) Then
k = a(j): a(j) = a(j + 1): a(j + 1) = k
List1.AddItem Str(a(i))
数组元素a(1)到a(6)的数据依次为“1,5,7,6,9,3”,经过该程序段加工后,列表框list1中显示的内容是:( )
For i=1 to 3
For j=1 to 5-i
If a(j)>a(j+1) Then
t=a(j) : a(j)=a(j+1) : a(j+1)=t
Text1.Text = Text1.Text + Str(a(i))
数组元素a(1)到a(5)的值依次为“3,9,6,8,4”。若该程序段执行后,文本框Text1显示的内容是( )
Dim a(1 T0 5)As Integer
Dim c As Integer
a(1)=44:a(2)=36:a(3)=58:a(4)=65:a(5)=12
b=0:c=0
k=i
For j=i+1 To 5
If a(j)<a(k) Then
k=j
b=b+1
If k<>I Then
t=a(i):a(i)=a(k):a(k)=t
c=c+1
Text1.Text=Str(b)+Str(c)
运行该程序段后,文本框Text1的内容是 ( )
i = 1
Do While i <= 6
t = Int(Rnd * 10) + 1
If t Mod 2 = i Mod 2 Then a(i) = t : i = i + 1
Loop
For i = 1 To 2
k = 1
For j = 1 To 6 - i * 2
If a(j) * k > a(j + 2) * k Then
t = a(j) : a(j) = a(j + 2) : a(j + 2) = t
k = -k
执行该程序段后,数组元素a(1)到a(6)的值可能是( )
实现上述功能的VB程序如下:
请回答下列问题:
试题篮