、
Private Sub Textl_Click()
Labell.Caption=Textl.Text
End Sub
、
Private Sub Text1_Change()
Labell.Caption=Textl.Text
End Sub
、
Private Sub Labell_Ctrange()
Labell. Caption=Textl.Text
End Sub
、
Private Sub Labell_Click()
Labell.Caption=Textl.Text
End Sub
答案:
18、【
单选题
】 在窗体上面画一个命令按钮和一个标签,其名称分别为 Commandl 和 Labell ,然后编写如下事件过程:
Private Sub Commandl_Click()
Counter=0
For i=1 To 4
For j=6 To 1 Step -2
Counter=Counter+1
Nextj
Nexti
Labell.Caption=Str(Counter)
End Sub
程序运行后,单击命令按钮,标签中显示的内容是
[2分]
、
11
、
12
、
16
、
20
答案:
19、【
单选题
】 在窗体上画一个名称为 Text1 的文本框和一个名称为 Commandl 的命令按钮,然后编写如下事件过程:
Private Commandl_Click()
Dim i As Integer, n As Integer
For i=0 To 50
i = i+3
n = n+1
If i>10Then Exit For
Next
Textl.Text=Str(n)
End Sub
程序运行后,单击命命令按钮,在文本框中显示的值是 ( ) 。
[2分]
、
5
、
4
、
3
、
2
答案:
20、【
单选题
】 在窗体上画一个命令按钮和两个标签,真名和分别为 Commandl 、 Labell 和 Labe12 ,然后编写如下事件过程:
Private Sub Commandl_Chick.
a=0
For i=1 To 10
a=a+1
b=0
Forj=1 To 10
a=a+1
b=b+2
Nextj
Next i
Labell. Caption=Str(a)
Labe12.Caption=Str(b)
End Sub
程序运行后,单击命令按钮,在标签 Labell 和 Labe12 中显示的内容分别为 ( ) 。
[2分]
、
Privale Sub Listl_Click()
Labell. Caption=Listl. ListIndex
Listl. Removeltem Listl.Text
End Sub
、
Private Sub Listl_Click()
Labell.Name=Listl. ListIndex
Listl.RemoveItem Listl.Text
End Sub
、
Private Sub Listl_Click()
Labell. Caption=Listl.Text
Listl. RemovItem Listl. ListIndex
End Sub
、
Private Sub Listl_Click()
Labell. Name=Listl. Text
Listl. RemoveItem Listl. ListIndex
End Sub
答案:
22、【
单选题
】 在窗体上画一个名称为 Commandl 的命令按钮,然后编写如下程序:
Private Sub Commandl Click()
Dim i As Integer, j As Integer
Dim a (10,10)As Integer
For i=1 To 3
For j= i To 3
a(i,j)=(i-1)*3+j
Print a (i,j);
Next j
Print
Next i
End Sub
程序运行后,单击命令按钮,窗体上显示的是 ( ) 。
[2分]
、
123
246
369
、
234
345
456
、
147
258
369
、
123
456
789
答案:
23、【
单选题
】 在窗体上画一个命令按钮,名称为 Command1, 然后编写如下代码:
Option Base 0
Private Sub Command1_Click()
Dim A (4)As Integer,B(4) As Integer
For k=0 To 2
A(k+1)=InputBox(“ 请输入一个整数 ”)
B(3-k)=A(k+1)
Next k
Print B(k)
End Sub
程序运行后,单击命令按钮,在输入对话框中分别输入 2 、 4 、 6 ,输入结果为 ( ) 。
[2分]
、
0
、
2
、
3
、
4
答案:
24、【
单选题
】 有以下程序:
Option Base 1
Dim arr() As Integer
Private Sub Form_Click()
Dim i As Integer,j As Integer
ReDim arr(3,2)
For i=1 To 3
For j=1 To 2
arr (i,j)=i*2+j
Next j
Next i
ReDim Preserve arr(1,4)
For j=3 To 4
arr(3,j)=j+9
Next j
Print arr(3,2);arr(3,4)
End Sub
程序运行后,单击窗体,输出结果为 ( ) 。
[2分]
、
8 13
、
0 13
、
7 12
、
0 0
答案:
25、【
单选题
】 以下叙述中正确的是 ( ) 。
[2分]
、
一个 Sub 过程至少要一个 Exit Sub 语句
、
一个 Sub 过程必须有一个 End Sub 语句
、
可以在 Sub 过程中定义一个 Function 过程,但不能定义 Sub 过程
、
调用一个 Function 过程可以获得多个返回值
答案:
26、【
单选题
】 有以下程序:
Sub subp(b()As Integer)
For i=1To4
b(i)=2-i
Nexti
End Sub
Private Sub Command1_Click()
Dim a (1 To 4)As Integer
a(1)=5
a(2)=6
a(3)=7
a(4)=8
subpa()
For i=1 To4
Print a (i)
Next i
End Sub
运行上面的程序,单击命令按钮,输出结果为 ( ) 。
[2分]
、
2
4
6
8
、
5
6
7
8
、
10
12
14
16
、
出错
答案:
27、【
单选题
】 设有如下通用过程:
Public Function Fun(xStr As String)
Dim tStr As String, srtL As Integer tStr+””
strL=Len(xStr)
i=1
Do While i<=strL/2
tStr=tStr &Mid(xStr,i ,1)& Mid (xStr ,strL-i+1,1)
i=i+1
Loop
Fun=tStr
End Function
在窗体上画一个名称为 Textl 的文本框和一个名称为 Command1 的命令按钮,然后编写如下的事件过程:
Private Sub Command 1_ Click()
Dim S1 As String
S1=”abcdef”
Text1.Text=UCase(Fun(S1))
End Sub
程序运行后,单击命令按钮,则 Text1 中显示的是 ( ) 。
[2分]
、
ABCDEF
、
abcdef
、
AFBECD
、
DEFABC
答案:
28、【
单选题
】 在窗体上画一个名称为 TxtA 的文本框,然后编写如下的事件过程:
Private Sub TxtA_KeyPress(KeyAscii As Integer)
……
End Sub
假定焦点已经位一地文本框中,则能够触发 KeyPress 事件的操作是
[2分]
、
单击鼠标
、
双击文本框
、
鼠标滑过文本框
、
按下键盘上的某个键
答案:
29、【
单选题
】 在窗体上画一个命令按钮和两上文体,其名称分别为 Command1 、 Text1 和 Text2 ,然后编写如下程序:
Dim S1 As String, S2 As String
Private Sub Form_Load()
Text1. Text=””
Text2. Text=””
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
S2=s2 & Chr(KeyCode)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
S1=S1 & chr(KeyAscii)
End Sub
Private Sub Command1_Click()
Text1.Text=S2
Text2.Text=S1
S1= “”
S2= “”
End Sub
程序运行后,在 Text1 中输入“ abc ”,然后单击命令按钮,在文本框 Text1 和 Text2 中显示的内容分别为 ( ) 。
[2分]
、
abc 和 ABC
、
abc 和 abc
、
ABC 和 abc
、
ABC 和 ABC
答案:
30、【
单选题
】 以下说法正确的是 ( ) 。
[2分]
、
任何时候都可以通过执行“工具”菜单中的“菜单编辑器”命令打开菜单编辑器
、
只有当某个窗体为当前活动窗体时,才能打开菜单编辑器
、
任何时候都可以通过单击标准工具栏上的“菜单编辑器”按钮打开菜单编辑器
、
只有当代码窗品为当前活动窗口时,才能找开菜单编辑器
答案:
31、【
单选题
】 在窗体上画一个通用对话框,其名称为 CommonDialog1 ,然后画一个命令按钮,并编写如下事件过程:
Private Sub Command1_Click()
CommonDialog1. Filter=”All Files(*.*)|*.*Text Files”&_
“(*.txt)|*.txt| Executable Files(*.exe)|*.exe”
CommonDialog1. Filterindex=3
CommonDialog1. Show Open
MsgBox CommonDialog1. FileName
End Sub
程序运行后,单击命令按钮,将显示一个“打开”对话框,此时在“文件类型”框中显示的是 ( ) 。
[2分]
、
All Files(*.*)
、
Text files(*.txt)
、
Executable Files(*.ext)
、
不确定
答案:
32、【
单选题
】 以下叙述错误的是
[2分]
、
一个工程中可以包含多个窗体文件
、
在一个窗体文件中用 Public 定义的通用过程不能被其他窗体调用
、
窗体和标准模块需要分别保存为不同类型的磁盘文件
、
用 Dim 定义的窗体层变量只能在该窗体中使用
答案:
33、【
单选题
】 以下叙述中错误的是()
[2分]
、
语句“ Dim a, b As Integer ”声明了两个整型变量
、
不能在标准模块中定义 Static 型变量
、
窗体层变量必须先声明,后使用
、
在事件过程或通用过程内定义的变量是局部变量
答案:
34、【
单选题
】 设有语句: Open "d: \ Text.txt" For OutputAs#1 ,以下叙述中错误的是()
[2分]