VB试题库(9)

2020-02-20 13:55

Next i Print

For j = 1 To i - 2

Call sub1(a(j), j) Print a(j); j Next j End Sub

Public Sub sub1(x As Integer, p As Integer) If x - p <= 1 Then p = p + 1 Else

p = p + 2 End If End Sub

53.下列程序段运行后,单击窗体时输出的第一行是 (124) ,第二行是 (125) 。

Private Sub Form_Click()

Dim a As Integer, b As Integer a = 7:b = 11 Call Proc(a, b) Print a; b End Sub

Public Sub Proc(x As Integer, ByVal y As Integer) x = y + x y = x Mod y Print x ; y End Sub

54.下列程序段运行后,单击窗体时输出的第一行是 (126) ,第二行是 (127) 。

Public Sub Proc(x As Integer, ByVal y As Integer) x = y + x y = x Mod y Print x ; y End Sub

Private Sub Form_Click()

Dim a As Integer, b As Integer a = 7:b = 12 Call Proc(a, b) Print a; b End Sub

55.下列程序段运行后,单击窗体时输出的第一行是 (128) ,第二行是 (129) 。

Public Sub Proc(ByVal x As Integer, y As Integer) x = y + x y = x Mod y Print x ; y End Sub

Private Sub Form_Click()

Dim a As Integer, b As Integer a = 8:b = 12 Call Proc(a, b) Print a; b End Sub

56.下列程序段运行后,单击窗体时输出的第一行是 (130) ,第三行是 (131) 。

Private Sub pro1(a As Integer, ByVal b As Integer) a = a + b b = b + 1 End Sub

Private Sub Form_Click()

Dim m As Integer, n As Integer, k As Integer n = 3

For m = 1 To 8 Step n k = m + n

Call pro1(k, m) Print k; m Next m End Sub 57.执行下面程序,单击按钮Command1,窗体上显示的第一行是 (132) ,第二行是 (133) 。

Option Explicit Dim a As Single

Private Sub Command1_Click() Dim a As Single, b As Integer a=1.2: b=3 Print fun1(a, b) Print a End Sub

Private Function fun1(x As Single, y As Integer)As Integer Dim i As Integer For i=1 To y x = x * 2 a= a + 1 Next i Fun1 = a End Function

58. 运行下列程序,第1次单击command1在窗体显示 (134) ,第二次单击command1在窗体上显示 (135) ,第三次单击command1在窗体上显示 (136) 。

Private Sub Command1_Click()

Dim w As Integer, n As Integer Static m As Integer w = 1: n = w * 2 m = n + m

n = m + n Print w; m; n End Sub

59.下列程序执行后,第一行的内容是 (137) , 第二行的内容是 (138) ,第三行的内容是 (139) 。

Private Sub Command1_Click() Dim i As Integer, j As Integer i = 2: j = 3

Print fun(i, j) Print i; j

Print fun(i, j) + 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

60.下列程序执行后,第一行的内容是 (140) , 第二行的内容是 (141) Private Sub Command1_Click()

Dim m As Integer, n As Integer, k As Integer m = 6: n = 4: k = 16 Print fun1(m, n)

Print fun1(fun1(m, n), k) End Sub

Private Function fun1(a As Integer, b As Integer) As Long Dim x As Integer x = a Do

If x Mod b = 0 Then fun1 = x

Exit Function Else

x = x + a End If Loop End Function

61.下列程序段运行后,单击窗体时输出的第一行是 (142) ,第二行是 (143) 。

Public Sub Proc(x As Integer, y As Integer)

x = y + x

y = x Mod y

End Sub

Private Sub Form_Click() Dim a As Integer, b As Integer

a = 12: b = 8 Call Proc(a, b) Print a; b Call Proc(a, b) Print a; b

End Sub

62.执行下面的程序,单击Command1按钮后,窗体上的第一行内容是 (144) ,第二行内容是 (145) ,最后一行内容是 (146) 。

Private Sub Command1_Click()

Dim N As Integer, M As Integer, Lcm As Integer N = 2 M = 3

Lcm=Rec (N,M) Print \End Sub

Private Function Rec(A As Integer, B As Integer)As Integer Static k As Integer k=k+1

If A Mod B = 0 Then Rec = A

Else

Rec = Rec(A+A/k, B)

End If Print A, k k=0 End Function 63.执行下面的程序,在窗体上输出结果的I的值是 (147) , J的值是 (148) 。

Option Explicit

Private Sub Form_Click()

Dim i As Integer, j As Integer j = 10

For i = 1 To j i = i + 1 j = j - 1 Next i Print i, j End Sub

64.运行下面的程序,当单击Command1时,窗体上显示的第一行内容是 (149) ,第二行内容是 (150) , 第三行的内容是 (151) 。

Private Sub Command1_Click()

Dim a As Integer, b As Integer, k As Integer a = 2: b = 4

k = fun(fun((a), b), b) Print k

End Sub

Private Function fun(n As Integer, m As Integer) As Integer Dim k As Integer n = n + m k = k + n m = m + k fun = n + m Print fun; n; m End Function

65.执行下面的程序,在窗体上显示的输出结果的第一行是 (152) ,第二行是 (153) ,第三行是 (154) 。Option Explicit

Dim a As Integer, b As Integer Private Sub Form_Click() Dim c As Integer a = 1 b = 3 c = 5

Print fun(c) Print a; b; c Print fun(c) End Sub

Private Function fun(x As Integer) As Single fun = a + b + x / 2 a = a + b b = a + x x = b + a End Function

66.一个窗体上有一个命令按钮Command1,下列程序执行后,输出的第一行为 (155) ,第二行是 (156) 。

Private Sub Command1_Click() Dim x As Integer x = 1

Call sort(x) Print x

Call sort((x)) Print x End Sub

Private Sub sort(y As Integer) y = y + 1 End Sub

67.执行下面的程序,单击窗体,则在窗体上显示的第一行是 (157) ,第二行是 (158) ,第三行是 (159) 。 Private Sub Form_Click()

Dim i As Integer, j As Integer


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

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

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

马上注册会员

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