VB期末考试题库附答案

2026/1/22 19:38:38

第三行是【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 答案:

=======(答案1)======= 12

=======(答案2)======= 18

=======(答案3)======= 36 12 18

=======(答案4)======= 36 36 12

第13题

21

执行以下程序,单击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 答案:

=======(答案1)======= 4 9 2

=======(答案2)======= 3 5 7

=======(答案3)======= 8 1 6

第14题

执行下列程序,单击Command1,在窗体上显示的第一行内容是__【1】__, 第二行的内容是__【2】__,第三行的内容是_【3】___。 Option Explicit

Private Sub Command1_Click Dim n As Integer ,i As Integer

22

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 答案:

=======(答案1)======= 5 15

=======(答案2)======= 2 35

=======(答案3)======= -1 56

第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

23

End Function 答案:

=======(答案1)======= -1

=======(答案2)======= 1

=======(答案3)======= 4

第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 答案:

=======(答案1)======= 3 6

=======(答案2)======= 4 7

=======(答案3)======= 5 8 11

第17题

执行下面程序,单击Command1,窗体上显示的第一行是__【1】__, 第二行是__【2】__,第三行是_【3】___。 Option Explicit

24


VB期末考试题库附答案.doc 将本文的Word文档下载到电脑
搜索更多关于: VB期末考试题库附答案 的文档
相关推荐
相关阅读
× 游客快捷下载通道(下载后可以自由复制和排版)

下载本文档需要支付 10

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219