出自:国家开放大学Visual Basic6.0程序设计

Private Sub Command1_Click()
  Dim x As Integer
  Static s As Integer
  x = Val(InputBox("请输入一个正整数="))
  If x < 5 Then
    s = s * x
  Else
    s = s + x
  End If
    Text1.Text = "s=" & Str(s)
End Sub
程序运行后,连续3次单击Command按纽,且设输入的数据为5、4、3时,文本框Text1中显示的值为(   )。
A、12 B、20
C、60 D、s=60
Private Sub Command1_Click()
    Static x As Integer
    Static y As Integer
    Cls
    y = 1
    y = y + 5
    x = 5 + x
    Print x, y
End Sub
程序运行后,单击命令按钮Command1三次后,窗体上显示的结果为(      )。
A、15  16 B、15  6
C、15  15 D、5  6
Private Sub Command1_Click()
    n = Text1.Text
    Select Case n
        Case 1 To 20
            x = 10
        Case 2, 4, 6
            x = 20
        Case Is < 10
            x = 30
        Case 10
            x = 40
    End Select
        Text2.Text = x
End Sub
程序运行后,如果在文本框Text1中输入10,然后单击命令按钮,则在Text2中显示的内容是(    )。
A、10 B、20
C、30 D、40
Private Sub Command1_Click()
   Static y As Integer
   Cls
   For i = 0 To 2
      x = x + y
      y = y + 3
   Next i
   Print x, y
End Sub
程序运行后,连续二次单击Command1按钮后,窗体上显示的值是( )。
A、9  9 B、30  12
C、36  18 D、63  27
Private Sub Command1_Click()
  Dim s As Double
  Dim i As Integer
  s = 5
  i = 1
  Do While i < 6
    i = i + 2
    s = s + i
  Loop
  Text1.Text = s
End Sub
程序运行后,单击命令按钮,在文件框Text1中的输出结果是(   )。
A、13 B、20
C、11 D、18
Private Sub Command1_Click()
    x = 0
    Do While x < 60
        x = (x + 2) * (x + 3)
        n = n + 1
    Loop
    Text1.Text = Str(n)
    Text2.Text = Str(x)
    Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub
程序运行后,单击命令按钮在文件框Text3中显示的结果是(   )。
A、72 B、74
C、7 D、16
Private Sub Command1_Click()
    Static Sum As Integer
    Dim I As Integer
    I = 1
    Do
      Sum = Sum + I
      I = I + 1
    Loop While I <= 5
    Text1.Text = Sum
    Text2.Text = I
End Sub
程序运行后,两次单击Command1按纽后,文本框Text1、Text2上的输出结果是(    )。
A、10  5 B、15  6
C、25  5 D、30  6
Private Sub Command1_Click()
    Static x As Integer
    Cls
    For I = 1 To 2
        y = y + x
        x = x + 2
    Next I
    Print x, y
End Sub
程序运行后,连续三次单击Command1按钮后,窗体上显示的是(    )。
A、4   2 B、12  18
C、12  30 D、4   6
Private Sub Command1_Click()
  n = 0
  j = 1
  Do Until n > 2
     n = n + 1
     j = j + n * (n + 1)
  Loop
  Print n; j
End Sub
程序运行后,单击命令按钮,在窗体上显示的值是(    )。
A、0   1 B、3   7
C、3   21 D、3   13
Private Sub Command1_Click()
  P = 0
  s = 0
  Do
     P = P + 2
     s = s + P
  Loop While P < 11
  Print "S="; s
End Sub
程序运行后,单击命令按钮,在窗体上显示的值是(    )。
A、S=42 B、S=30
C、S=46 D、S=20
Private Sub Command1_Click()
  x = 0
  Do While x < 50
    x = (x + 2) * (x + 3)
    n = n + 1
  Loop
  Text1.Text = Str(n)
  Text2.Text = Str(x)
End Sub
程序运行后,单击Command1按钮,在两个文本框中显示的值分别为(  )。
A、1   0 B、2   72
C、3   50 D、4   168
Private Sub Command1_Click()
  x = 1: n = 0
  Do While x < 100
    x = x * 10
    n = n + 1
  Loop
  Text1.Text = Str(n)
  Text2.Text = Str(x)
End Sub
程序运行后,单击命令按钮,在两个文本框中显示的值分别为(  )。
A、10   0 B、2   100
C、3   50 D、4   168
Private Sub Form_Click()
  For i = 1 To 10 Step 2
      y = y + i
  Next i
  Print i
End Sub
程序运行后,单击窗体,在窗体上显示的值是(    )。
A、25 B、10
C、11 D、9
Private Sub Form_Click()
  I = 0
  For G = 10 To 19 Step 3
     I = I + 1
  Next G
  Print I
End Sub
程序运行后,单击窗体,在窗体上显示的值是(    )。
A、4 B、5
C、3 D、6
Private Sub Form_Click()
    Dim c As Integer, j As Integer, k As Integer
    k = 1
    c = 2
    For j = 1 To 5
      If j > 3 Then
        c = c + 5
        Exit For
      Else
        k = k + 1
      End If
    Next j
    Print c, k
End Sub      
程序运行后,单击窗体,在窗体上显示的c,k的值分别是(    )。
A、7   3 B、7   4
C、2   4 D、7   5
Private Sub Form_Click()
  Dim I As Integer, j As Integer
  Dim c As Integer
  c = 0
  For I = 1 To 3
    For j = 1 To 2
      c = c + 3
    Next j
  Next I
  Print c
End Sub
程序运行后,单击窗体,在窗体上显示的结果是(    )。
A、18 B、15
C、12 D、9
Private Sub Form_Click()
  Dim i As Integer, k As Integer, c As Integer
  For i = 1 To 5
     If i Mod 2 = 0 Then
         k = k + 2
     Else
        c = c + 3
     End If
  Next i
  Print k, c
End Sub
程序运行后单击窗体,Form1上的输出结果是(   )。
A、2   12 B、4    9
C、4    6 D、2    9
Private Sub Command1_Click()
  Dim i As Integer, n As Integer
  For i = 0 To 50
      i = i + 3
      n = n + 1
      If i > 10 Then Exit For
  Next i
  Text1.Text = Str(n)
End Sub
程序运行后,单击命令按钮,在文本框中显示的值是(    )。
A、2 B、3
C、4 D、5
Private Sub Form_Click()
  Dim i As Integer, k As Integer, c As Integer
  For i = 1 To 10
     If i Mod 2 = 0 Then
         k = k + 3
     Else
         c = c + 4
     End If
  Next i
  Print k, c
End Sub
程序运行后,单击窗体,在窗体上显示的值是(    )。
A、10   20 B、20   15
C、15   20 D、10   30
Private Sub Form_Click()
   Dim c As Integer, j As Integer, k As Integer
   k = 1
   c = 2
   For j = 1 To 5
      If j > 3 Then
         c = c + 6
         Exit For
      Else
         k = k + 3
      End If
   Next j
   Print c, k
End Sub
程序运行后,单击窗体,在窗体上显示的值是(    )。
A、10   8 B、8   10
C、8   7 D、8   4
Private Sub Form_Click()
  Dim i As Integer, k As Integer
  Static c As Integer
  For i = 1 To 6
     If i Mod 2 = 0 Then
         k = k + 2
     Else
        c = c + 3
     End If
  Next i
  Print k, c
End Sub
程序运行后,连续两次单击窗体,在窗体上显示的值是(    )。
A、6   12 B、6   24
C、6   9 D、6   18
Private Sub Form_click()
  b = 1
  Do While b < 40
    b = b * (b + 1)
  Loop
  Print b
End Sub
程序运行后,单击窗体,在窗体上显示的值为(  )。
A、42 B、39
C、6 D、1
Private Sub Form_Click()
  Dim A(1 To 3) As String
  Dim c As Integer
  Dim j As Integer
  A(1) = "3"
  A(2) = "6"
  A(3) = "9"
  c = 1
  For j = 1 To 3
    c = c + Val(A(j))
  Next j
  Print c
End Sub
程序运行后,单击窗体,在窗体上显示的值是(    )。
A、10 B、19
C、16 D、17
Private Sub Command1_Click()
    Dim A(1 To 5) As Integer
    Dim x As Integer
    For i = 1 To 5
     A(i) = i
    Next i
      i = 1
    Do While x < 6
     A(i) = A(i) + x
     x = x + 2
     i = i + 2
    Loop
    Text1.Text = A(3)
    Text2.Text = A(5)
End Sub
程序运行后,单击命令按钮,在两个文本框中显示的值是(    )。
A、5   9 B、5   4
C、9   5 D、4   5
Private Sub Command1_Click()
  Dim A(1 To 5) As Integer
  Dim x As Integer
  For i = 1 To 5
    A(i) = i
  Next i
  i = 1
  Do While x < 2
    A(i) = A(i) * x
    x = x + 1
    i = i + 1
  Loop
  Text1.Text = A(1)
  Text2.Text = A(2)
End Sub
程序运行后,单击Command1后按钮,文件框Text1、Text2中的结果是(   )。
A、2   0 B、0   2
C、2   4 D、2   5
Private Sub Command1_Click()
  Dim M(5)
  For I = 1 To 5
     M(I) = I * I
  Next I
  Print M(I - 1)
End Sub
程序运行后,单击命令按钮,在窗体上显示的值是(    )。
A、5 B、25
C、05 D、16
Sub Change(x As Integer, y As Integer)
   Dim t As Integer
   t = x
   x = y
   y = t
   Print x, y
End Sub
Private Sub Form_Click()
  Dim a As Integer, b As Integer
  a = 30: b = 40
  Change a, b
  Print a, b
End Sub
程序运行后,单击窗体,在窗体上显示的值是(    )。
A、
30   40
30   40
B、
30   40
40   30
C、
40   30
40   30
D、
40   30
30   40
Sub test(i As Integer)
    i = i + 4
End Sub
Private Sub Form_Click()
    Dim x As Integer
    x = 5
    Print "x="; x
    Call test(x)
    Print "x="; x
End Sub
程序运行后,单击窗体,在窗体上显示的值是(   )。
A、x= 5  x= 9
B、x= 9  x= 5
C、
x= 5
x= 9
D、9  5
Function F(a As Integer)
   Dim b As Integer
   Static c As Integer
   b = b + 2
   c = c + 3
   F = a + b + c
End Function
Private Sub Command1_Click()
   Dim a As Integer
   a = 4
   For i = 1 To 3
    Print F(a);
   Next i
End Sub
程序运行后,单击窗体,在窗体上显示的值是(   )。
A、9  9  9
B、9  12 15
C、9  14 19
D、9  11 13
Private Sub Form_Click()
    Dim x, y As Integer
    x = 5: y = 10
    nc x, y
    Print x, y
End Sub
Private Sub nc(ByVal a%, b%)
    a = a + b
    b = a
    a = a * b
End Sub
程序运行后,单击窗体,在窗体上显示的值是(   )。
A、5   15
B、15   15
C、225  15
D、5   10
Sub abcd(ByVal n As Integer)
    n = n + 5
End Sub

Private Sub Form_click()
    nx% = 3
    Call abcd(nx%)
    Print nx%
End Sub
程序运行后,单击窗体,在窗体上显示的值是(   )。
A、5
B、3
C、9
D、10
Dim y As Integer
Private Sub form_click()
    Dim x As Integer
    x = 1
    y = 2
    Call AA(y + 1)
    z = BB(x)
    Print x, y, z
End Sub
Public Sub AA(ByVal z As Integer)
    y = z + x
    z = x + y
End Sub
Public Function BB(ByRef y As Integer)
    y = y + 1
    BB = x + y
End Function
程序运行后,单击窗体,在窗体上显示的值是(   )。
A、2   2   2
B、2   3   2
C、3   2   3
D、2   3   3
Web(World Wide Web)即全球广域网,也称为万维网