下面程序运行时,单击窗体后,窗体上显示的结果是( )。 Private Sub Form_Click Dim I As Integer Dim sum As Long Dim t1 As Long t1=1:sum=0 For 1=1 To 3 t1=t1*I sum=sum+t1 Next I Print sum End Sub
A.3
B.9
C.5
D.6
第1题:
运行下列程序:
Private Sub Form_Click( )
For i = 1 To 20
If fun1(i) Then
s = s + 1
End If
Next i
Print s
End Sub
Private Function fun1(y) As Boolean
If y Mod 2 <> 0 Then
fun1 = False
Else
fun1 = True
End If
End Function
单击窗体后,则在窗体上显示的结果是( )。
A.110
B.10
C.0
D.20
第2题:
'下面的程序运行时,单击窗体后,窗体上显示的结果是(B )。
Private Sub Form_Click(B )
Dim a(1 To 5)As Integer
a(1)= 2: a(2)= 3: a(3)= 1: a(4)= 5: a(5)= 4
n = 5
For i = 1 To n - 1
Min = i
For j = i + 1 To n
If a(j)< a(Min)Then Min = j
Next j
t = a(i): a(i)= a(Min): a(Min)= t
Next i
For i = 1 To n
Print a(i);
Next i
End Sub
A. 2 3 1 5 4
B. 1 2 3 4 5
C. 9 8 7 6 5
D. 5 5 5 5 5
第3题:
编写一个程序。要求设置窗体的标题是“这是我的第一个练习”;程序运行时,单击窗体,在窗体上显示文字:“我可以用Visual Basic语言编写程序了!”
第4题:
'下面的程序运行时,单击窗体后,窗体上显示的结果是( )。
Private Sub Form_Click(B )
Dim a(1 To 5)As Integer
a(1)= 2: a(2)= 3: a(3)= 1: a(4)= 5: a(5)= 4
n = 5
For i = 1 To n - 1
Min = i
For j = i + 1 To n
If a(j)< a(Min)Then Min = j
Next j
t = a(i): a(i)= a(Min): a(Min)= t
Next i
For i = 1 To n
Print a(i);
Next i
End Sub
A. 2 3 1 5 4
B. 1 2 3 4 5
C. 9 8 7 6 5
D. 5 5 5 5 5
第5题:
设有如下程序
该程序运行后,单击窗体,则在窗体上显示的内容是:a=( )和b=( )。