2007年9月全国计算机等级考试二级VB模拟试题(13)及答案

出处:Examlink 作者:无风浪 日期:2007年09月20日 13时15分

(25) 在窗体上画一个名称为Drive1的驱动器列表框,一个名称为Dir1的目录列表框,一个名称为File1的文件列表框,两个名称分虽为Label1、Label2,标题分别为空白和"共有文件"的标签。编写程序,使得驱动器列表框与目录列表框、目录列表框与文件列表框同步变化,并且在标签Label1中显示当前文件夹中文件的数量。如图所示。
                        
能够正确实现上述功能的程序是
A) Private Sub Dir1_Change()
     File1.Path=Dir1.Path
  End Sub
  Private Sub Dive1_Change()
     Dir1.Path=Drive1.Drive
     Label1.Caption=File1.ListCount
  End Sub
B) Private Sub Dir1_Change()
     File.Path=Dir1.Path
  End Sub
  Private Sub Dive1_Change()
     Dir1.Path=Drive1.Drive
     Label1.Caption=File1.List
  End Sub
C) Private Sub Dir1_Change()
     File1.Path = Dir1.Path
     Label1.Caption = File1.ListCount
  End Sub
  Private Sub Drive1_Change()
     Dir1.Path = Drive1.Drive
     Label1.Caption = File1.ListCount
  End Sub
(D) Private Sub Dir1_Change()
      File1.Path=Dir1.Path
      Label1.Caption=File1.ListCount
  End Sub
  Private Sub Dive1_Change()
     Dir1.Path=Drive1.Drive
     Label1.Caption= File1.List
  End Sub
正确答案:  C

(26) 设有声明语句
Option Base 1
Dim b(-1 To 10, 2 To 9, 20) As Integer
则数组b中全部元素的个数
A) 2310       
B) 1920
C) 1500       
D) 1658
正确答案:  B

(27) 单击命令按钮,下列事件过程的执行结果为
Private Sub Command1_Click()
   Dim x As Integer, y As Integer
   x=40: y=72
   Call PtoP(x, y)
   Print x; y
End Sub
Public Sub PtoP(Byval n As Integer, ByVal m As Integer)
   n=n \ 10+2
   m=m \ 10+2
End Sub
A) 0  8       
B) 40  72
C) 4  50       
D) 78  50
正确答案:  B

(28) 下列程序的执行结果为
Private Sub Command1_Click()
   Dim p As Integer, q As Integer
   p=12: q=20
   Call Value(p, q)
   Print p; q
End Sub
Private Sub Value(ByVal m As Integer, ByVal n As Integer)
   m=m * 2: n=n - 5
   Print m; n
End Sub
A)20  12
   20  15
B)12  20
   12  25
C)24  15 
   12  20
 D)24  12
    12  15
考生答案:      正确答案:  C

(29) 在窗体上画一个命令按钮,然后编写如下程序:
Private Sub Command3_Click()
   Cop 2
   Cop 3
   Cop 4
End Sub
Sub Cop (a As Integer)
   Static x As Integer
   x=x + a
   Print x;
End Sub
程序运行后,单击命令按钮,输出结果为
A) 2 3 4       
B) 2 5 9
C) 3 5 4       
D) 2 4 3
正确答案:  B

(30) 有如下事件过程,单击命令按钮扣,输出结果为
Private Sub Command1_Click()
   Dim b%(1 To 4) , j%, t#
   For j=1 To 4
      b(j) =j
   Next j
   t=Tax(b() )
   Print "t="; t,
End Sub
Function Tax (a() As Integer)
   Dim t#, i%
   t=1
   For i=2 To UBound(A)
      t=t * a(i)
      Next i
      Tax=t
End Function
A) t=18       
B) t=24
C) t=30       
D) t=32
正确答案:  B

最后更新时间:2008-05-28 12:17:15
文章评论
共有 0 位网友发表了评论
用户名: 新注册) 密码: 匿名评论 [查看所有评论]

评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
您可以用以下几种方式找到此文章

考试全流程