位置:首页 > 题库频道 > 其它分类 > 计算机其它 > 二级二级VB2005年4月全国计算机等级考试二级VB考试题

在窗体上画一个名称为Command1的命令按钮和一个名称为Text1的文本框,在文本框中输入以下字符串:Microsoft Visual Basic Programming然后编写如下事件过程:Private Sub Command1_Click()Open "d:tempoutf.txt" For Output As #1For i = 1 To Len(Text1.Text)c = Mid(Text1.Text, i, 1)If c >= "A" And c <= "Z" ThenPrint #1, LCase(End IfNext iCloseEnd Sub程序运行后,单击命令按钮,文件outf.txt中的内容是(  )。

发布时间:2024-07-09

A.MVBP

B.mvbp

C.MVBP

D.mvbp

试卷相关题目

  • 1设有如下程序:Private Sub Command1_Click()Dim c As Integer, d As Integerc = 4d = InputBox("请输入一个整数")Do While d > 0If d > c Thenc = c + 1End Ifd = InputBox("请输入一个整数")LoopPrint c + dEnd Sub程序运行后,单击命令按钮,如果在输入对话框中依次输入1、2、3、4、5、6、7、8、9、0,则输出结果是(  )。

    A.12

    B.11

    C.10

    D.9

    开始考试点击查看答案
  • 2在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:Option Base 1Private Sub Command1_Click()Dim c As Integer, d As Integerd = 0c = 6x = Array(2, 4, 6, 8, 10, 12)For i = 1 To 6If x(i) > c Thend = d + x(i)c = x(i)Elsed = d - cEnd IfNextPrint dEnd Sub程序运行后,如果单击命令按钮,则在窗体上输出的内容为(  )。

    A.10

    B.16

    C.12

    D.20

    开始考试点击查看答案
  • 3阅读程序:Option Base 1Dim arr() As IntegerPrivate Sub Form_Click()Dim i As Integer, j As IntegerReDim arr(3, 2)For i = 1 To 3For j = 1 To 2arr(i, j) = i * 2 + jNext jNext iReDim Preserve arr(3, 4)For j = 3 To 4arr(3, j) = j + 9Next jPrint arr(3, 2) + arr(3, 4)End Sub程序运行后,单击窗体,输入结果为(  )。

    A.21

    B.13

    C.8

    D.25

    开始考试点击查看答案
  • 4在窗体上画一个名称为Command1的命令按钮,然后编写如下通用过程和命令按钮的事件过程:Private Function fun(ByVal m As Integer)If m Mod 2 = 0 Thenfun = 2Elsefun = 1End IfEnd FunctionPrivate Sub Command1_Click()Dim i As Integer, s As Integers = 0For i = 1 To 5s = s + fun(i)NextPrint sEnd Sub程序运行后,单击命令按钮,在窗体上显示的是(  )。

    A.6

    B.7

    C.8

    D.9

    开始考试点击查看答案
  • 5在窗体上画一个名称为Label1的标签,然后编写如下事件过程:Private Sub Form_Click()Dim arr(10, 10) As IntegerDim i As Integer, j As IntegerFor i = 2 To 4For j = 2 To 4arr(i, j) = i * jNext jNext iLabel1.Caption = Str(arr(2, 2) + arr(3, 3))End Sub程序运行后,单击窗体,在标签中显示的内容是(  )。

    A.12

    B.13

    C.14

    D.15

    开始考试点击查看答案
  • 6在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:Dim SW As BooleanFunction func(X As Integer) As IntegerIf X < 20 ThenY = XElseY = 20 + XEnd Iffunc = YEnd FunctionPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)SW = FalseEnd SubPrivate Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)SW = TrueEnd SubPrivate Sub Command1_Click()Dim intNum As IntegerintNum = InputBox("")If SW ThenPrint func(intNum)End IfEnd Sub程序运行后,单击命令按钮,将显示一个输入对话框,如果在输入对话框中输入25,则程序的执行结果为(  )。

    A.输出0

    B.输出25

    C.输出45

    D.无任何输出

    开始考试点击查看答案
  • 7设有如下通用过程:Public Sub Fun(a() As Integer, x As Integer)For i = 1 To 5x = x + a(i)NextEnd Sub在窗体上画一个名称为Text1的文本框和一个名称为Command1的命令按钮。然后编写如下的事件过程:Private Sub Command1_Click()Dim arr(5) As Integer, n As IntegerFor i = 1 To 5arr(i) = i + iNextFun arr, nText1.Text = Str(n)End Sub程序运行后,单击命令按钮,则在文本框中显示的内容是(  )。

    A.30

    B.25

    C.20

    D.15

    开始考试点击查看答案
返回顶部