Max=0:s=0
For i=1 to 6
If a(i)>Max Then Max=a(i)
s=s+Max
i=i+1
Next i
数组元素a(1)到a(6)的值依次为“5,7,4,8,6,9”,执行该程序段后,变量s的值为( )
a(1)=4:a(2)=5a(3)=1
a(4)=2:a(5)=3:a(6)=6
k=1
For i=1 to 5000
k=(k+a(k)-1)Mod 6+1
Next i
执行该程序段后,变量k的值为( )
s=Text1.Text
For i=1 To Len(s)
t=Asc(Mid(s,i,1))-64
If t>32 Then t=t-32
s1=Chr((t+2)Mod 26+65)+s1
Next i
Text1.Text=s1
在文本框Text1中输入“wWxY”( )已知“a”的ASCⅡ值为97,“A”的ASCⅡ值为65),执行该程序段后,则变量s1的值为( )
flag=True: i=1
Do While i<=6
k=Int(Rnd*99)+1
If k mod 2=1 Or flag Then
a(i)=k
i=i+1
flag=Not flag
End If
Loop
执行该程序段后,在下列选项中,a(1)~a(6)各元素的值可能的是( )
图a
图b
Private Sub Comand1_Click( )
Dim s As String, c As String
Dim t As Integer, I As Integer
Dim a(1 To 26)As Integer
s=Text1.Text
For i=1 to 26
a(i)=0
Next i
i=1
Do While i<=Len(s)
c=Mid(s, i, 1)
If ① Then
t=Asc(c)-96
Else
t=Asc(c)-64
End If
If a(t)=0 Then
a(t)=1
Else
②
End If
i=i+1
Loop
Label1.Caption=s
End Sub
① ②
实现上述功能的VB程序如下,请回答下列问题:
Const k=5
Dim a(1 To k * k)As Integer
Private Sub Form_Load( )
‘生成数组a并以矩阵形式显示在列表框list1中
End Sub
Private Sub Command1_Click()
Dim b(1 To k, k * k)As Integer
Dim n As Integer
Dim row As Integer, col As Integer
Dim s As String
s=“”
n=Val(Text1. Text)
For i=1 To k * k
row=(i-1)\k+1
①
If row=n Then
b(i)=a((col-1)*k+n)
ElseIf col=n Then
②
Else
b(i)=a(i)
End If
s=s+Str(b(i))
If ③ Then
List2. AddItem s
s=“”
End If
Next i
End Sub
① ② ③