第10题
执行下面的程序,单击Command1,输出的变量i的值是 【1】 ,变量j的值是 【2】 ,变量k的值是 【3】 。
Option Explicit
Private Sub Command1_Click() Dim i As Integer,j As Integer Dim k As Integer i=10 j=4
k=Funk(i,j) Print i,j,k End Sub
Priate Function Funk(ByVal A As Integer,B As Integer) As Integer A=A+B B=B-2
If B=0 Or B=1 Then Funk=1 Else
Funk=A+Funk(A,B) End If
End Function 第11题
运行下面程序,如果连续三次单击命令按钮之后,A数组共有___【1】___个元素;数组元素A(2)的值是__【2】____,A(5)的值是__【3】______. Option Explicit Option Base 1
Private Sub Command1_Click()
Static a() As Integer, n As Integer Dim i As Integer, k As Integer k = n n = n + 2
ReDim Preserve a(n) For i = k + 1 To n a(i) = i * n + 1 Next i
For i = 1 To n Print a(i); Next i Print End Sub 第12题
执行下面的程序,单击Command1,在窗体界面上显示的第一行是 【1】 ,第二行是 【2】 ,第三行是 【3】 ,第四行是 【4】 。 Option Explicit
Private Sub Command1_Click()
Dim a As Integer,b As Integer,i As Integer i=1218 a=i\\100 b=i Mod 100 If b<>0 Then Print a Print b
. Print Lcd((a),(b));a;b Print Lcd(a,b);a;b End If End Sub
Private Function Lcd(x As Integer,Y As Integer) As Integer Dim d As Integer If x If x Mod y=0 Then Lcd=x Exit Do Else x=x+d End If Loop End Function 第13题 执行以下程序,单击Command1,则在Picturel上显示的第一行是 【1】 ,第二行是 【2】 ,第三行是 【3】 。 Option Explicit Private Sub Command1_Click() Dim A(3,3) As Integer,i As Integer,j As Integer Dim k As Integer i=3:j=2:A(i,j)=1:k=1 Do Until k>9 k=k+1 If i+1>3 And j+1<=3 Then i=1:j=j+1 ElseIf i+1<=3 And j+1>3 Then i=i+1:j=1 Elself i+1>3 And j+1>3 Then i=i-1 ElseIf i+1<=3 And j+1<=3 And A(i+1,j+1)<>0 Then i=i-1 Else i=i+1:j=j+1 End If A(i,j)=k Loop For i=1 To 3 For j=1 To 3 Picture1.Print A(i,j); Next j Picture1.Print Next i End Sub 第14题 执行下列程序,单击Command1,在窗体上显示的第一行内容是__【1】__,第二行的内容是__【2】__,第三行的内容是_【3】___。 Option Explicit Private Sub Command1_Click Dim n As Integer ,i As Integer n=2 For i=7 To 1 Step -1 Call sub2(i,n) Print i,n Next i End Sub Private Sub sub2(x As Integer,y As Integer) Static n As Integer Dim i As Integer For i =2 To 1 Step -1 n =n+x x =x-1 Next i y=y+n End Sub 第15题 执行下列的程序,单击Command1,在窗体上显示的变量b的值为__【1】__,变量c的值为___【2】_,变量z的值为__【3】__。 Private Sub Command1_Click() Dim b As Integer,c As Integer,z As Integer b=2 c=1 z=fun(b,fun(b+1,c))+b-c+1 Print b,c,z End Sub Private Function fun(x As Integer,ByVal y As Integer) As Integer x=x-y y=x+y+2 fun=y-x End Function 第16题 执行下面程序,单击Command1,窗体上显示的第一行是____【1】____,第二行是_____【2】____,第四行是__【3】______. Option Explicit Private Sub Command1_Click() Dim a As Integer, b As Integer, i As Integer a=2:b=5 For i=a To a*b Step a Call sub1(i,a,b) Print a,b Next i Print a,b,i End Sub Private Sub sub1(i As Integer, a As Integer, b As Integer) i=i+1 a=a+1 b=b+1 End Sub 第17题 执行下面程序,单击Command1,窗体上显示的第一行是__【1】__,第二行是__【2】__,第三行是_【3】___。 Option Explicit Option Base 1 Private Sub Command1_Click() Dim sa (3,3) As String*1,i As Integer,j As Integer,k as Integer k=1 For i=1 To 3 For j=1 To 3 sa(i,j)=Chr(Asc(\ Print sa(i,j);\ k=k+3 Next j Print Next i End Sub 第18题 执行下面程序,单击Command1,则数组元素a(1,2)的数值是____【1】_____,a(3,3)的数值是____【2】______,图片框中最后一行显示的是____【3】_____. Option Explicit Private Sub Command1_Click() Dim a(4,4) as Integer, i as Integer, j as Integer Dim k As Integer, num as Integer num=0 For k=1 To 4 For i=1 To k-1 num=num+1 a(i,k)=num next i For j=k To 1 Step -1 num=num+1 a(k,j)=num next j next k For i=1 To 4 For j=1 To 4 Picture1.Print Right(\ Next j Picture1.Print Next i End Sub 第19题 执行下面程序,单击Command1,则图片框中显示的第一行是___【1】___,显示的第二行是_____【2】___,最后一行显示的是___【3】_____. Private Sub Command1_Click() Dim a(3, 3) As Integer Dim i As Integer, j As Integer For i = 1 To 3 For j = 3 To 1 Step -1 If i >= j Then a(i, j) = i - j Else a(i, j) = j - i End If Next j Next i For i = 1 To 3 For j = 3 To 1 Step -1 Picture1.Print a(i, j); Next j Picture1.Print Next i End Sub 第20题 执行下面程序,单击Command1,则窗体上显示的第一行是 【1】 ,第二行是 【2】 ,第三行是 【3】 。 Option Explicit Private Sub Command1_Click() Dim a As String,i As Integer Dim x As String,z As String a=\ i=InStr(5,a,\ Do