al Basic Programming
然后编写如下事件过程:
Private Sub Command1_Click()
Open "d:\temp\outf.txt" For Output As #1
For i = 1 To Len(Text1.Text)
c = Mid(Text1.Text, i, 1)
If c >= "A" And c <= "Z" Then
Print #1, LCase(
End If
Next i
Close
End Sub
程序运行后,单击命令按钮,文件outf.txt中的内容是( )。
A.MVBP
B.mvbp
C.M
D.m
V v
B b
P p
(34)在窗体上画一个名称为Command1的命令按钮,然后编写如下程序:
Dim SW As Boolean
Function func(X As Integer) As Integer
If X < 20 Then
Y = X
Else
Y = 20 + X
End If
func = Y
End Function
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
SW = False
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
SW = True
End Sub
Private Sub Command1_Click()
Dim intNum As Integer
intNum = InputBox("")
If SW Then
Print func(intNum)
End If
End Sub
程序运行后,单击命令按钮,将显示一个输入对话框,如果在输入对话框中输入25,则程序的执行结果为( )。
A.输出0
B.输出25
输出45
D.无任何输出
(35)设有如下通用过程:
Public Sub Fun(a() As Integer, x As Integer)
For i = 1 To 5
x = x + a(i)
Next
End Sub
在窗体上画一个名称为Text1的文本框和一个名称为Command1的命令按钮。然后编写如下的事件过程:
Private Sub Command1_Click()
Dim arr(5) As Integer, n As Integer
For i = 1 To 5
arr(i) = i + i
Next
Fun arr, n
Text1.Text = Str(n)
End Sub
程序运行后,单击命令按钮,则在文本框中显示的内容是( )。
A.30
B.25
C.20
D.15 二、填空题(每空2分,共30分)
请将每空的正确答案写在答题卡【1】~【15】序号的横线上,答在试卷上不得分。
(1)某二叉树中度为2的结点有18个,则该二叉树中有 【1】 个叶子结点。
(2)在面向对象方法中,类的实例称为 【2】 。
(3)诊断和改正程序中错误的工作通常称为 【3】 。
(4)在关系数据库中,把数据表示成二维表,每一个二维表称为 【4】 。
(5)问题处理方案的正确而完整的描述称为 【5】 。
(6)以下语句输出结果是 【6】 。
Print Int(12345.6789 * 100 + 0.5) / 100
(7)在窗体上画一个文本框和一个图片框,然后编写如下两个事件过程:
Private Sub Form_
上一页 [1] [2] [3] [4] [5] [6] [7] 下一页
责任编辑:小草