执行以下程序,在窗体上输出()。Private Sub Command1_Click()Dim a(20)As IntegerFor j = 1 T
执行以下程序,在窗体上输出()。
Private Sub Command1_Click()
Dim a(20)As Integer
For j = 1 To 20 Step 2
a(j)= j
Next j
Print a(1)+ a(2)+ a(3)AAAAAAAAa
End Sub
A. 4
B. 5
C. 6
D. 7
执行以下程序,在窗体上输出()。
Private Sub Command1_Click()
Dim a(20)As Integer
For j = 1 To 20 Step 2
a(j)= j
Next j
Print a(1)+ a(2)+ a(3)AAAAAAAAa
End Sub
A. 4
B. 5
C. 6
D. 7
窗体上命令按钮Commandl的事件过程如下:
Private Sub Command1_Click()
Dim total As Integer
total=s(1)+s(2)
Print total
End Sub
Private Function s(m As Integer)As Integer
Static x As Integer
For i=1 To m
x=x+1
Next i
s=x
End Function
运行程序,第3次单击命令按钮Command1时,输出结果为【 】。
阅读程序:
Private Sub Command1_Click()
Dim arr
Dim i As Integer
arr=Array(0,1,2,3,4,5,6,7,8,9,10)
For i=0 To 2
Print arr(7-i);
Next
End Sub
程序运行后,窗体上显示的是()。
A.8 7 6
B.7 6 5
C.6 5 4
D.5 4 3
在窗体中有一个命令按钮Commandl,编写事件代码如下:
Private Sub Command1_CliCk()
Dim s As Integer
s=P(1)+P(2)+e(3)+P(4)
debug.Print S
End SUb
Public Function P(N AS Integer)
Dim Sum As Integer
Sum=0
For i=1 To N
Sum=Sum+i
Next i
P=Sum
End Function
打开窗体运行后,单击命令按钮,输出结果是
A.15
B.20
C.25
D.35
A.7 9
B.34 0
C.9 7
D.死循环
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Option Base 1 Private Sub Command1_Click() Dim a a=Array(1,2,3,4,5) For i=1 To UBound(a) a(i)=a(i)+i-1 Next Print a(3) End Sub 程序运行后,单击命令按钮,则在窗体上显示的内容是()。
A.4
B.5
C.6
D.7
执行下面的程序,单击窗体后在窗体上显示的第一行结果是(),第三行结果是()。
Private Sub Command1_Click()
s1="B"
For i = 1 To 3
s2=LCase(s1)
s1=s1 & s2
s=s & s1
Print s
s1=Chr(Asc(s1)+i)
Next i
End Sub
写如下事件过程:
Private Sub Command1_Click()
Dim array1(10, 10) As Integer
Dim i As Integer, j As Integer
For i = 1 To 3
for j = 2 To 4
array1(i, j) = i + j
next j
next i
Text1.Text = arrry1(2, 3) + array(3, 4)
End Sub
程序运行后, 单击命令按钮, 在文本框中显示的值是______
A.12
B.13
C.14
D.15
在窗体上画一个命令按钮,然后编写如下代码: Private Sub Command1_Click() 0pen "d:\vb\test.txt "For Input As #1 Print LOF(1) Close #1 End Sub 假设文件d:\vb\test.txt的内容为I am a student.,那么程序运行后,单击命令按钮,其输出结果为______.
A.13
B.14
C.15
D.16
阅读程序: Function F(a As Integer) b=0 Static c b=b+1 c=c+1 F=a+b+c End Function Private Sub Command1_Click() Dim a As Integer a=2 For i=1 To 3 Print F(A)Next i End Sub 运行上面的程序,单击命令按钮,输出结果为 ______。
A.4 4 4
B.4 5 6
C.4 6 8
D.4 7 9
下列程序的执行结果为()。 Private Sub Command1_Click() Dim s1 As String,s2 As String s1="abcdef" Call Invert(s1,s2) Print s2 End Sub Private Sub Invert(ByVal xstr As String,ystr As String) Dim tempstr As String i=Len(xstr) Do While i>=1 tempstr=tempstr+Mid(xstr,i,1) i=i-1 Loop ystr=tempstr End Sub
A.fedcba
B.abcdef
C.afbecd
D.defabc