(24) 下列程序段的执行结果为
a=2
b=0
Select Case a
Case 1
Select Case b
Case 0
Print "**0**"
Case 1
Print "**1**"
End Select
Case 2
Print "**2**"
End Select
A) **0**
B) **1**
C) **2**
D) 0
正确答案: C
(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