|
试题1(每小题3分,共15分)
阅读下列程序和程序,在每小题提供的若干可选答案中,挑选一个正确答案。
【程序说明】
界面设计如上图所示,程序运行时要求有以下功能:
· 按Commandl(出题)后随机生成两个两位正整数存入模块级变量a、b且a>b,并分别在Labell Labe12中显示,此后Commandl不可用;
· 在Textl中输入结果、按回车后,以消息框显示运算正确与否、累计所完成题数以及做错的题数,Commandl恢复为可用;
·按Command2(退出)后以消息框显示所完成题数以及做错的题数,退出。
【程序】
Dim n As Integer, n_error As Integer
(1)
Private Sub Command1_Click()
a = 10 + Rnd * 89: b = 10 + Rnd * 89
If a < b Then
(2)
Label1.Caption = a: Label2.Caption = b
n = n + 1: Text1.Text = "": Command1.Enabled = False
End Sub
Private Sub Text1_
(3)
(keyAscii As Integer)
If keyAscii <> 13 Then
(4)
'回车键的ASCII 码值为13
If a - b = Val(Text1.Text)
Then
MsgBox ("回答正确")
Else
MsgBox ("回答不正确")
n_error = n_error + 1
End If
Command1.Enabled = True
End Sub
Private Sub Command2_Click()
MsgBox (
(5)
)
End
End Sub
【供选择的答案】
(1)A、’小学生两位数减法训练程序
B、a=0: b=0 : c=0
C、n=0: n_error=0
D、Dim a As Byte, b As byte, c As Byte
(2)
A、b=a: a=b
B、c=a: a=b: b=c
C、a=b: b=a
D、c=a: b=a: a=c
(3)
A、KeyPress
B、Change
C、KeyDown
D、KeyUp
(4)
A、Exit Sub
B、KeyAscii=13
C、KeyAsecii=0
D、Exit Do
(5)
A、“共”& n &“题,错” & n_error &“题”
B、“共n题,错n_error题”
C、“共”+ n +“题,错”+ n_error +“题”
D、共 & n“题,错”& n_error &“题”
试题2(每小题3分,共12分)
阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。
【程序说明】
输入n后,再输入n个数a1,a2,…,an,按照下列公式计算s的值并显示。
P(a1-v)2+(a2-v)2+…+(an-v)
|
v=
s=
【程序】
Private 定义变量 f(
(6)
) As Single
Dim i As Integer
For i = 1 To n: f = f + x(i): Next i
End 定义变量
Private Sub command1_Click()
Dim n As Integer, a() As Single, i As Integer
Dim V As Single, s As Single
n = InputBox("输入数据个数")
(7)
For i = 1 To n
a(i) = InputBox("a(" & i & ")=", "输入各数组元素")
Next i
V = f(a, n) / n
For i = 1 To n
s =
(8)
Next i
(9)
End Sub
【供选择的答案】
(6)
A、x() As Single, n As Integer
B、x(n) As Single
C、a As Single,n As Integer
D、n As Integer,x() As Single
(7)
A、Dim a(n) As Single
B、ReDim a()
C、Dim a (n)
D、ReDim a(n)
(8)
A、(a(i)-v)*(a(i)-v)
B、s+a(i)-v^2
C、s+(a(i)-v)^2
D、(a(i)-v)^2
(9)
A、s=s^0.5/n
B、Print s^0.5/n
C、Print Sqr(s)
D、Sqr(s)/n
试题3(每小题3分,共15分)
阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。
【程序说明】
·图片框控件P1、P2除Name属性外均取缺省值,将鼠标在P1拖动绘制矩形框(边框颜色通过用对话框指定):鼠标按下处为矩形左上角,鼠标抬起处为矩形右下角;
·鼠标抬起后,将P1中矩形区域内的图象在P2中重新绘制,如下图所示。
【程序】
(10)
Private Sub p1_MouseDown(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
xl = X: y1 = Y
End Sub
Private Sub p1_MouseUp(Button As Integer, Shift As Integer, _
X As Single, Y As Single)
Dim j As Single, i As Single, jk As Single, ik As Single
Dim
(11)
jk = P2.ScaleWidth / (X - xl):
ik = P2.ScaleHeight / (Y - y1)
CommonDialog1.Action =
(12)
P1.Line (xl, y1)-(X, Y), CommonDialog1.Color, B
For j = xl To X
For i = y1 To Y
c =
(13)
'读取该点处的颜色值
(14)
Next i, j
End Sub
【供选择的答案】
(10)A、Dim x As Single ,y As Single
B、Dim x2 As Single,y2 As Single
C、Public xl As Single ,yl As Single
D、Dim xl As Single,y1 As Single
(11)A、c As Long
B、c As Integer
C、c As Single
D、c As Double
(12)A、1
B、2
C、3
D、4
(13)A、P1.Pset(j,i)
B、P2.Pset(j,i)
C、P1.Point(j,i)
D、P1.Point(i,j)
(14) A、P2.PSet ((j-xl)*jk,(i-y1)*ik),c
B、P1.Pest((j-xl)*jk,(i-yl)*ik),c
C、P2.PSet((i-yl)*ik,(j-xl)*jk),c
D、P1.Pset((i-yl)*ik,(j-x1)*jk),c
试题4(每小题3分,共9分)
阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。
【程序】
Private Sub Form_Load()
Text1.Text = "": List1.Clear
End Sub
Private Sub Text1_Keypress(K As Integer)
Dim n As Integer
'If K>=Asc("0")And k<=Asc("9")Then K=0
If K = 13 Then
List1.AddItem Text1.Text, n
n = n + 1
Text1.Text = ""
End If
End Sub
(15) 运行时在文本框控件Textl中依次输入3个以回车结束的字符串“abc34”、“xy12$”、“+-*/”,列表框中各表项依次为:
A、abc34
B、+-*/
C 、abc
D、+-*/
xy12$
xy12$
xy$
xy$
+-*/
abc34
+-*/
abc
(16) 如果将语句Dim n As Integer 用Static n As Integer替换,运行时在文本框中依次输入3个以回车结束的字符串“abc34”、“xy12$”、“+-*/”.列表框中各表项依次为:
A、abc34
B、+-*/
C、abc
D、+-*/
xy12$
xy12$
xy$
xy$
+-*/
abc34
+-*/
abc
(17) 如果将语名Dim n As Integer 后一条语句前的注释符删除,运行时在文本框中依次输入3个以回车结束的字符串“abc34”、“xy12$”、“+-*/”,列表中各表项依次为:
A、abc34
B、+-*/
C、abc
D、+-*/
xy12$
xy12$
xy$
xy$
+-*/
abc34
+-*/
abc
试题5(每小题3分,共12分)
阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一正确答案。
【程序】
Private Sub f(s As String)
Dim i As Integer, n As Integer, c As String
n = Len(s)
If n Mod 2 = 1 Then c = Mid(s, n \ 2 + 1, 1)
For i = 1 To Len(s) \ 2
c = Mid(s, Len(s) + 1 - i, 1) + c + Mid(s, i, 1)
Next i
s = c
End Sub
Private Sub Command1_Click()
Dim x As String
x = InputBox("x=")
Call f(x)
Print x
End Sub
(18) 单击Commandl后输入“abc”,窗体上显示结果为:
A、cba
B、bca
C、abc
D、acb
(19) 单击Commandl后输入“abcd”,窗体上显示结果为:
A、abdc
B、cdab
C、abcd
D、bcad
(20) 如果将Sub过程f首句改为Private Sub f(Byval S As String),单击Commandl后输入“abcd”,窗体上显示结果为:
A、abdc
B、cdab
C、abcd
D、bcad
(21) 如果将Sub 过程f首句改为Private Sub f (Byref
S As String),单击Commandl后输入“abcd”,窗体上显示结果为:
A、abdc
B、cdab
C、abcd
D、bcad
试题6(每小题3分,共9分)
阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。
【程序】
Private Sub command1_Click()
Dim i As Integer, fn As Byte
fn = FreeFile
Open "e:/aaa.txt" For Output As #fn
For i = 1 To 20
If Sqr(i) = Int(Sqr(i)) Then Print #fn, i
Next i
Close #fn
End Sub
(22) 如果文件e:/aaa,txt已存在并已有数据1、4,执行以上过程后文件中全部数据为:
A、1,4,1,4,9,16
B、1,4,9,16
C、1,4
D、2,4,6,8,10,12,14,16,18
(23)如果文件e:/aaa.txt不存在,执行以上过程后文件中全部数据为:
A、1,4,1,4,9,16
B、1,4,9,16
C、空
D、2,4,6,8,10,12,14,16,18
(24) 如果文件e:/aaa,txt已存在并已有数据1、4,且程序中文件打开方式为Append,执行以上过程后文件中全部数据为:
A、1,4,1,4,9,16
B、1,4,9,16
C、1,4
D、2,4,6,8,10,12,14,16,18
试题7(14分)
编写过程Commandl_Click,用InputBox函数输入100个学生的成绩,统计后依次用标签控件Labell~Labe13显示优秀(85-100)、通过(60-84)和未通过(小于60)的人数。
试题8(14分)
编写程序,界面设计、运行时状态如下图所示,按照下列要求定义各事件过程:
(1)在窗体的Load事件过程中设置计时器控制Timerl的Enable属性为False、响应的时间间隔为1秒;
(2)单击Commandl后计时器开始计时,每隔1秒刷新一次控制件Labe12(0)~Labe12(3)在窗体上所显示的当前时间以及计时开始后所经过的时间。 |
|