16、【
单选题
】 设a=4,b=3,c=2,d=1,下列表达式的值是。
a>b+1 Or c< Mod b And>
[2分]
、
True
、
1
、
-1
、
0
答案:
17、【
单选题
】 以下可以作为Visual Basic变量名的是。
[2分]
、
A#A
、
counstA
、
3A
、
?AA
答案:
18、【
单选题
】 设x=4,y=6,则以下不能在窗体上显示出“A=10”的语句是。
[2分]
、
Print A=x+y
、
Print"A=";x+y
、
Print "A="+Str(x+y)
、
Print"A="&x+y
答案:
19、【
单选题
】 假定有如下的命令按钮(名称为Command1)事件过程:
Private Sub Command1_Click()
x=InputBox("输入:","输入整数")
MsgBox"输入的数据是:”,,”输入数据:"+x
End Sub
程序运行后,单击命令按钮,如果从键盘上输入整数10,则以下叙述中错误的是。
[2分]
、
x的值是数值10
、
输入对话框的标题是“输入整数”
、
信息框的标题是“输入数据:10”
、
信息框中显示的是“输入的数据是:”
答案:
20、【
单选题
】 在窗体上画1个命令按钮(名称为Command1)和1个文本框(名称为Text1),然后编写如下事件过程:
Private Sub Command1_Click()
x=Val(Text1.Text)
Select Case x
Case 1,3
y=x*x
Case Is>=10,Is<=-10
y=x
Case -10 To 10
y=-x
End Select
End Sub
程序运行后,在文本框中输入3,然后单击命令按钮,则以下叙述中正确的是。
[2分]
、
执行y=x*x
、
执行y=-x
、
先执行y=x*x,再执行y=-x
、
程序出错
答案:
21、【
单选题
】 设有命令按钮Command1的单击事件过程,代码如下:
Private Sub Command1_Click()
Dim a(30)As Integer
For i=1 To 30
a(i)=Int(Rnd*100)
Next
For Each arrItem In a
If arrItem Mod 7=0 Then Print arrItem;
If arrItem>90 Then Exit For
Next
End Sub
对于该事件过程,以下叙述中错误的是。
[2分]
、
a数组中的数据是30个100以内的整数
、
语句For Each arrItem In a有语法错误
、
If arrItem Mod 7=0……语句的功能是输出数组中能够被7整除的数
、
If arrItem>90……语句的作用是当数组元素的值大于90时退出For循环
答案:
22、【
单选题
】 设有命令按钮Command1的单击事件过程,代码如下:
Private Sub Command1_Click()
Dim a(3,3)As Integer
For i=1 To 3
For j=1 To 3
a(i,j)=i*j+i
Next j
Next i
Sum=0
For i=1 To 3
Sum=Sum+a(i,4-i)
Next i
Print Sum
End Sub
运行程序,单击命令按钮,输出结果是。
[2分]
、
20
、
7
、
16
、
17
答案:
23、【
单选题
】 在窗体上画1个名称为Command1的命令按钮,然后编写如下事件过程:
Private Sub Command1_Click()
a=0
For i=1 To 2
For j=1 To 4
If j Mod 2<>0 Then
a=a-1
End If
a=a+1
Next j
Next i
Print a
End Sub
程序运行后,单击命令按钮,输出结果是。
[2分]
Private Sub Option1_Click(Index As Integer)
If Text1.Text<>""Then
Select Case ?
Case 0
Text2.Text=Val(Text1.Text)
Case 1
Text2.Text=Val(Text1.Text)*10
Case 2
Text2.Text=Val(Text1.Text)*100
End Select
End If
End Sub
[2分]
、
Index
、
Option1.Index
、
Option1(Index)
、
Option1(Index).Value
答案:
25、【
单选题
】 在窗体上画1个命令按钮,其名称为Command1,然后编写如下程序:
Private Sub Command1_Click()
Dim a(10)As Integer
Dim x As Integer
For i=1 To 10
a(i)=8+i
Next
x=2
Print a(f(x)+x)
End Sub
Function f(x As Integer)
x=x+3
f=x
End Function
程序运行后,单击命令按钮,输出结果为。
[2分]
编写如下程序:
Private Sub Form_Load()
Text1.Text=""
Text2.Text=""
Text3.Text=""
End Sub
Private Sub Command1_Click()
x=Val(Text1.Text)
y=Val(Text2.Text)
Text3.Text=f(x,y)
End Sub
Function f(ByVal x As Integer,ByVal y As Integer)
Do While y<>0
tmp=x Mod y
x=y
y=tmp
Loop
f=x
End Function
运行程序,在Text1文本框中输入36,在Text2文本框中输入24,然后单击命令按钮,则在Text3文本框中显示的内容是。
[2分]
、
4
、
6
、
8
、
12
答案:
28、【
单选题
】 窗体上有名称分别为Text1、Text2的2个文本框,要求文本框Text1中输入的数据小于500,文本框Text2中输入的数据小于1000,否则重新输入。为了实现上述功能,在以下程序中问号(?)处应填入的内容是。
Private Sub Text1_LostFocus()
Call CheckInput(Text1,500)
End Sub
Private Sub Text2_LostFocus()
Call CheckInput(Text2,1000)
End Sub
Sub CheckInput(t As ?,x As Integer)
If Val(t.Text)>x Then
MsgBox"请重新输入!"
End If
End Sub
[2分]
、
Text
、
SelText
、
Control
、
Form
答案:
29、【
单选题
】 在窗体上画1个文本框,其名称为Text1,然后编写如下过程:
Private Sub Text1_KeyDown(KeyCode As Integer,Shift As Integer)
Print Chr(KeyCode)
End Sub
Private Sub Text1_KeyUp(KeyCode As Integer,Shift As Integer)
Print Chr(KeyCode+2)
End Sub
程序运行后,把焦点移到文本框中,此时如果敲击“A”键,则输出结果为。
[2分]
、
A
A
、
A
B
、
A
C
、
A
D
答案:
30、【
单选题
】 为了使列表框中的项目呈多列显示,需要设置的属性为。
[2分]
、
Columns
、
Style
、
List
、
MultiSelect
答案:
31、【
单选题
】 在窗体上画1个命令按钮,名称为Command1,然后编写如下程序:
Dim Flag As Boolean
Private Sub Command1_Click()
Dim intNum As Integer
intNum=InputBox("请输入:")
If Flag Then
Print f(intNum)
End If
End Sub
Function f(X As Integer)As Integer
If X<10 Then
Y=X
Else
Y=X+10
End If
f=Y
End Function
Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single)
Flag=True
End Sub
运行程序,首先单击窗体,然后单击命令按钮,在输入对话框中输入5,则程序的输出结果为。
[2分]
、
0
、
5
、
15
、
无任何输出
答案:
32、【
单选题
】 在菜单编辑器中建立1个名称为Menu0的菜单项,将其“可见”属性设置为False,并建立其若干子菜单,然后编写如下过程:
Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
If Button=1 Then
PopupMenu Menu0
End If
End Sub
则以下叙述中错误的是。
[2分]
、
该过程的作用是弹出一个菜单
、
单击鼠标右键时弹出菜单
、
Menu0是在菜单编辑器中定义的弹出菜单的名称
、
参数X、Y指明鼠标当前位置的坐标
答案:
33、【
单选题
】 窗体上有1个名称为CD1的通用对话框,1个名称为Command1的命令按钮。命令按钮的单击事件过程如下:
Private Sub Command1_Click()
CD1.FileName=""
CD1.Filter="All Files|*.*|(*.Do
C.|*.Doc|(*.Txt)|*.txt"
CD1.FilterIndex=2
CD1.Action=1
End Sub
关于以上代码,错误的叙述是。
[2分]