12、【
单选题
】 设a=2, b=3, c=4, d=5, 下列表达式的值是
Not a<=c Or 4*c=b^2 And b<>a+c
[2分]
、
-1
、
1
、
True
、
False
答案:
13、【
单选题
】 设a = 5,b = 10,则执行
c = Int((b - a) * Rnd + a) + 1
后,c值的范围为
[2分]
、
5~10
、
6~9
、
6~10
、
5~9
答案:
14、【
单选题
】 在窗体上画一个命令按钮,名称为Command1,然后编写如下事件过程:
Private Sub Command1_Click()
a$ = "software and hardware"
b$ = Right(a$, 8)
c$ = Mid(a$, 1, 8)
MsgBox a$, , b$, c$, 1
End Sub
运行程序,单击命令按钮,则在弹出的信息框的标题栏中显示的是
[2分]
、
software and hardware
、
software
、
hardware
、
1
答案:
15、【
单选题
】 在窗体上画一个命令按钮和一个文本框,其名称分别为Command1和Text1,把文本框的Text属性设置为空白,然后编写如下事件过程:
Private Sub Command1_Click()
a = InputBox("Enter an integer")
b = InputBox("Enter an integer")
Text1.Text = b + a
End Sub
程序运行后,单击命令按钮,如果在输入对话框中分别输入8和10,则文本框中显示的内容是
[2分]
、
108
、
18
、
810
、
出错
答案:
16、【
单选题
】 在窗体上画两个文本框,其名称分别为Text1和Text2,然后编写如下程序:
Private Sub Form_Load()
Show
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
Private Sub Text1_Change()
Text2.Text = Mid(Text1.Text, 8)
End Sub
程序运行后,如果在文本框Text1中输入BeijingChina,则在文本框Text2中显示的内容是
[2分]
、
BeijingChina
、
China
、
Beijing
、
BeijingC
答案:
17、【
单选题
】 在窗体上画一个列表框和一个命令按钮,其名称分别为List1和Command1,然后编写如下事件过程:
Private Sub Form_Load()
List1.AddItem "Item 1"
List1.AddItem "Item 2"
List1.AddItem "Item 3"
End Sub
Private Sub Command1_Click()
List1.List(List1.ListCount) = "AAAA"
End Sub
程序运行后,单击命令按钮,其结果为
[2分]
、
把字符串“AAAA”添加到列表框中,但位置不能确定
、
把字符串“AAAA”添加到列表框的最后(即“Item 3”的后面)
、
把列表框中原有的最后一项改为“AAAA”
、
把字符串“AAAA”插入到列表框的最前面(即“Item 1”的前面)
答案:
18、【
单选题
】 有如下程序:
Private Sub Form_Click()
Dim Check, Counter
Check = True
Counter = 0
Do
Do While Counter < 20
Counter = Counter + 1
If Counter = 10 Then
Check = False
Exit Do
End If
Loop
Loop Until Check = False
Print Counter, Check
End Sub
程序运行后,单击窗体,输出结果为
[2分]
、
15 0
、
20 -1
、
10 True
、
10 False
答案:
19、【
单选题
】 有如下程序:
Private Sub Form_Click()
Dim i As Integer, sum As Integer
sum = 0
For i = 2 To 10
If i Mod 2 <> 0 And i Mod 3 = 0 Then
sum = sum + i
End If
Next i
Print sum
End Sub
程序运行后,单击窗体,输出结果为
[2分]
、
12
、
30
、
24
、
18
答案:
20、【
单选题
】 在窗体上画一个名称为Text1的文本框和一个名称为Command1的命令按钮,然后编写如下事件过程:
Private Sub Command1_Click()
Dim array1(10, 10) As Integer
Dim i As Integer, j As Integer
For i = 1 To 3
For j = 2 To 4
array1(i, j) = i + j
Next j
Next i
Text1.Text = array1(2, 3) + array1(3, 4)
End Sub
程序运行后,单击命令按钮,在文本框中显示的值是
[2分]
、
12
、
13
、
14
、
15
答案:
21、【
单选题
】 在窗体上画一个命令按钮,其名称为Command1,然后编写如下事件过程:
Private Sub Command1_Click()
Dim a1(4, 4), a2(4, 4)
For i = 1 To 4
For j = 1 To 4
a1(i, j) = i + j
a2(i, j) = a1(i, j) + i + j
Next j
Next i
Print a1(3, 3); a2(3, 3)
End Sub
程序运行后,单击命令按钮,在窗体上输出的是
[2分]
、
6 6
、
10 5
、
7 21
、
6 12
答案:
22、【
单选题
】 有如下程序:
Option Base 1
Private Sub Form_Click()
Dim arr, Sum
Sum = 0
arr = Array(1, 3, 5, 7, 9, 11, 13, 15, 17, 19)
For i = 1 To 10
If arr(i) / 3 = arr(i) \ 3 Then
Sum = Sum + arr(i)
End If
Next i
Print Sum
End Sub
程序运行后,单击窗体,输出结果为
[2分]
、
25
、
26
、
27
、
28
答案:
23、【
单选题
】 在窗体上画一个命令按钮,然后编写如下事件过程:
Private Sub Command1_Click()
Dim a(5) As String
For i = 1 To 5
a(i) = Chr(Asc("A") + (i - 1))
Next i
For Each b In a
Print b;
Next
End Sub
程序运行后,单击命令按钮,输出结果是
[2分]
、
Private Sub Command1_Click()
CommonDialog1.DialogTitle = "New Title"
CommonDialog1.ShowPrinter
End Sub
、
Private Sub Command1_Click()
CommonDialog1.DialogTitle = "New Title"
CommonDialog1.ShowFont
End Sub
、
Private Sub Command1_Click()
CommonDialog1.DialogTitle = "New Title"
CommonDialog1.ShowOpen
End Sub
、
Private Sub Command1_Click()
CommonDialog1.DialogTitle = "New Title"
CommonDialog1.ShowColor
End Sub
答案:
29、【
单选题
】 如果一个工程含有多个窗体及标准模块,则以下叙述中错误的是
[2分]
、
任何时刻最多只有一个窗体是活动窗体
、
不能把标准模块设置为启动模块
、
用Hide方法只是隐藏一个窗体,不能从内存中清除该窗体
、
如果工程中含有Sub Main过程,则程序一定首先执行该过程
答案:
30、【
单选题
】 假定在工程文件中有一个标准模块,其中定义了如下记录类型
Type Books
Name As String * 10
TelNum As String * 20
End Type
要求当执行事件过程Command1_Click时,在顺序文件Person.txt中写入一条记录。下列能够完成该操作的事件过程是
[2分]
、
Private Sub Command1_Click()
Dim B As Books
Open "c:\Person.txt" For Output As #1
B.Name = InputBox("输入姓名")
B.TelNum = InputBox("输入电话号码")
Write #1, B.Name, B.TelNum
Close #1
End Sub
、
Private Sub Command1_Click()
Dim B As Books
Open "c:\Person.txt" For Input As #1
B.Name = InputBox("输入姓名")
B.TelNum = InputBox("输入电话号码")
Print #1, B.Name, B.TelNum
Close #1
End Sub
、
Private Sub Command1_Click()
Dim B As Books
Open "c:\Person.txt" For Output As #1
Name = InputBox("输入姓名")
TelNum = InputBox("输入电话号码")
Write #1, B
Close #1
End Sub
、
Private Sub Command1_Click()
Dim B As Book
Open "c:\Person.txt" For Input As #1
Name = InputBox("输入姓名")
TelNum = InputBox("输入电话号码")
Print #1, B.Name, B.TelNum
Close #1
End Sub
37、【
填空题
】 设有以下函数过程:
Function fun(m As Integer) As Integer
Dim k As Integer, sum As Integer
sum = 0
For k = m To 1 Step -2
sum = sum + k
Next k
fun = sum
End Function
若在程序中用语句 s = fun(10) 调用此函数,则s的值为
。
[每空2分]
答案:["30"]
38、【
填空题
】 在窗体上画一个命令按钮和一个文本框,然后编写命令按钮的Click事件过程。程序运行后,在文本框中输入一串英文字母(不区分大小写),单击命令按钮,程序可找出未在文本框中输入的其他所有英文字母,并以大写方式降序显示到Text1中。例如,若在Text1中输入的是abDfdb,则单击Command1按钮后Text1中显示的字符串是ZYXWVUTSRQPONMLKJIHGEC。请填空。
Private Sub Command1_Click( )
Dim str As String, s As String, c As String
str = UCase(Text1)
s = ""
c = "Z"
While c >= "A"
If InStr(str, c) = 0 Then
s =
End If
c = Chr$(Asc(c)
)
Wend
If s <> "" Then
Text1 = s
End If
End Sub
[每空2分]
Private Sub Command1_Click( )
Dim k As Integer
Dim sum As Single, max As Single, min As Single
sum = Text1(0)
max = Text1(0)
min =
For k =
To 6
If max < Text1(k) Then
max = Text1(k)
End If
If min > Text1(k) Then
min = Text1(k)
End If
sum = sum + Text1(k)
Next k
Text2 = (
) / 5
[每空2分]
Private Sub Command1_Click()
Dim k As Integer, n As Integer, found As Boolean
found = False
n = Len(
)
k = 0
While k < List1.ListCount And Not found
If Text1 = Left$(List1.List(k), n) Then
Text2 =
found = True
End If
k = k + 1
Wend
If Not found Then
Text2 = "查无此人"
End If
End Sub
[每空2分]