VB试题库(10)

2020-02-20 13:55

i = 1: j = 2 Print \

Print \

Print i + j + fun(i, fun(i, j)) End Sub

Private Function fun(ByVal a As Integer, b As Integer) As Integer a = a + b b = a + b fun = a + b End Function

68.执行下面的程序,单击窗体,则输出的第一行是 (160) ,第二行是 (161) ,第三行是 (162) 。

Private Sub form_click()

Dim a As Integer, i As Integer a = 2

For i = 1 To 9

Call Sub1(i, a) Print i;a Next i End Sub

Private Sub Sub1(x As Integer, y As Integer) Static n As Integer Dim i As Integer For i = 3 To 1 Step -1 n = n + x x = x + 1 Next i y = y + n End Sub

69.执行下面的程序,单击窗体,则输出的第一行是 (163) ,第二行是 (164) 。 Private Sub form_click()

Dim i As Integer, j As Integer i = 1: j = 2 Call test((i), j) Print i, j Call test(i, j) Print i, j End Sub

Private Sub test(m As Integer, n As Integer) Static t As Integer m = m + n n = n + m + t t = t + m End Sub

70.执行下面的程序,单击命令按钮Command1,则窗体上显示的第一行是 (165) ,第二行是 (166) ,第三行是 (167) 。 Private Sub Command1_Click() Dim s As String, t As String Dim k As Integer, m As Integer s = \ k = 1: m = k

For k = 1 To Len(s) Step m + 1

t = t & Chr(Asc(Mid(s, m, 1)) + k) k = k + 1

If Mid(s, k, 1) = \ m = m + k Print t Next k Print m End Sub

71.执行下面的程序,单击命令按钮1输出的第一行是 (168) ,第二行是 (169) 。 Private Sub Command1_Click() Dim n As Integer, i As Integer n = 2

For i = 7 To 1 Step -2 Call sub2(i, n) Print i; n Next i End Sub

Private Sub sub2(x As Integer, ByVal y As Integer) Static n As Integer Dim i As Integer n = n + x x = x - 2 y = y + n End Sub

72.执行下面的程序,单击命令按钮1输出的第一行是 (170) ,第二行是 (171) ,第三行是 (172) 。

Private Sub Form_Click()

Dim a As Integer, b As Integer, c As Integer a = 1: b = 2

c = fun(a, b) + fun(b, a) Print c End Sub

Private Function fun(k As Integer, ByVal n As Integer) As Integer Static m As Integer k = k + n n = n + k

m = m + k + n fun = m Print fun End Function

73.执行下面的Command1_Click事件过程后,Text1中显示的内容是 (173) ,Text2中显示的内容是 (174) 。

Private Sub Command1_Click() Dim S As String, i As Integer

Const Ch As String = \ S = \.11\ For i = 1 To Len(S)

If InStr(Ch, Mid(S, i, 1)) = 0 Then Text1 = Mid(S, i, 1) & Text1 Else

Text2 = Text2 & Mid(S, i, 1) End If Next i End Sub

74.执行下面的程序,单击窗体,则在窗体上显示的第一行是 (175) ,第二行是 (176) ,第三行是 (177) 。

Private Sub Command1_Click() Dim i As Integer, s As Integer s = 5

For i =1 To 6

Call Subl(i, s) Print i, s Next I

Print i End Sub

Private Sub Subl(a As Integer, b As Integer) Static c As Integer Dim i As Integer

For i = 3 To 1 Step - 1 c = c + a a = a + 1 Next i b = b + c End Sub 75.执行下面程序,单击窗体时输出的第一行是 (178) ,第二行是 (179) ,第四行是 (180) 。 Private Sub form_click()

Dim i As Integer, j As Integer i = 1: j = 2 Call test(i, j) Print i, j

Call test(i, j) Print i, j End Sub

Private Sub test(m As Integer, ByVal n As Integer) Static t As Integer m = m + n n = n + m + t t = t + m Print m, n, t End Sub

76.执行下面的程序,单击窗体,则在窗体上显示的第一行是 (181) ,第二行是 (182) ,第三行是 (183) 。

Private Sub Form_Click() Dim x As Integer, y As Integer, z As Integer x = 1: y = 2: z = 3 Print x + y + z + test(x, y, test(x, y, z))

End Sub

Private Function test(a As Integer, b As Integer, c As Integer) As Integer a = 3 * c b = 2 * c c = a + b test = a + b + c Print a, b, c

End Function

77.执行下面的程序,单击命令按钮1输出的第一行是 (184) ,第二行是 (185) ,第三行是 (186) 。

Private Sub pro1(x As Integer, ByVal y As Integer) Static n As Integer Dim k As Integer For k = 3 To 1 Step -1 n = n + x x = x + 1 Next k y = y + n End Sub

Private Sub Command1_Click() Dim m As Integer, k As Integer m = 2

For k = 1 To 9

Call pro1(k, m) Print k; m Next k End Sub

78.下面程序执行后,输出的第一行是 (187) ,第二行是 (188) ,第三行是 (189) 。

Private Sub Form_Click()

Dim a As Integer, b As Integer a = 10: b = 15 Call test(a, b) Print a; b Call test(b, a) End Sub

Private Sub test(ByVal x As Integer, y As Integer) Static k As Integer k = k + 1 x = x + k y = y - k Print x; y End Sub

79.执行下面程序,单击Command1后,在InputBox函数对话框中输入4(或直接单击“确定”按钮),在窗体上显示的第一行内容是 (190) ;第三行显示的内容是 (191) ,第四行显示的内容是 (192) 。

Option Explicit

Private Sub Command1_Click() Dim days As Integer

days = InputBox(\输入正整数\ Print fun(days) End Sub

Private Function fun(d As Integer) As Integer If d = 1 Then fun = 1 Else

fun = 2 * fun(d - 1) + 1 Print d; fun End If End Function 80.执行下面的程序,单击窗体,则输出的第一行是 (193) ,第二行是 (194) 。

Private Sub Form_Click()

Dim a As Integer, b As Integer, c As Integer a = 1: b = 3: c = 2 Call P1(a, b) Print a; b; c Call P1(b, a) Print a; b; c End Sub

Private Sub P1(x As Integer, ByVal y As Integer) Static z As Integer


VB试题库(10).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:水力学 各章专题浓缩(附详解)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

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