浙江省计算机三级单片机考试试卷
附录二 2007年浙江省计算机等级考试试卷
说明:⑴ 考生应将所有试题的答案填写在答卷上。其中试题1~试题6,请在答卷上各小题正确选项的对应位置处打“√”;
⑵ 请将你的准考证号的后五位填写在答卷右下角的指定位置内;
⑶ 考试时间为90分钟。
试题一(每小题3分,共12分)
阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。
【程序说明】单击窗体后输入1个不小于6的正整数,然后输出该数所有的质数因子(如输入6则输出“ 2 3”,输入60则输出“ 2 2 3 5”,等等)。
【程序】
Private Sub f( (1) )
Dim i As Integer
i = 2
Do While (2)
If (3) Then k = k /i: Print i; Else i = i + 1
Loop
End Sub
Private Sub Form_Click()
Dim n As Integer
Do
n = InputBox("n=")
Loop (4)
Call f(n)
End Sub
【供选择的答案】
(1) A、B、kC、D、
(2) A、B、C、D、
(3) A、B、C、D、 A、B、C、D、
【供选择的答案】
(5) A、B、C、D、 A、B、C、D、A、B、C、D、A、vBlackB、C、D、A、B、C、D、Private Sub Command1_Click()
Dim x As Single
List1.Clear: CommonDialog1.Action = 1
Open CommonDialog1.FileName For (10) As #1
Do While (11)
Input #1, x: List1.Additem x
Loop
Close #1
End Sub
Private Sub Command2_Click()
Dim n As Single,x As Single,i As Integer,j As Integer,K As Integer
n = List1. (12)
Redim a(n) As Single
For i = 1 To n: a(i) = List1.List(i-1): Next i
For i = 1 To n -1
k = i
For j = i+1 To n: If (13) Then k = j: Next j
x = a(k): a(k) = a(i): a(i) = x
Next i
Open CommonDialog1.FileName For Output As #1
For i = 1 To n: Print #1,a(i): Next i
Close #1
End Sub
【供选择的答案】
(10) A、 B、C、D、 A、B、C、D、 A、B、C、D、A、B、C、D、Private Sub Form_Load()
Text1.Text="": Form1.Cls
End Sub
Private Sub Text1_KeyPress(k As Integer)
Static s As Integer
If (Chr(k) < "0" Or Chr(k) > "9") And k<> 13 Then k=0
If k=13 Then s = s + Val(Text1.Text): Text1.Text = "": Print s;
End Sub
(14) 写出运行时在Text1中依次按“1↙ 3↙ 5↙ ”后窗体上的显示结果。
A、B、C、D、Private Function f(a As Integer, b As Integer) As Integer
Dim r As Integer, t As Integer
If a < b Then t = a: a = b: b = t
Do
r = a Mod b
If r = 0 Then Exit Do
a = b: b = r
Loop
f = b
End Function
Private Sub Command1_Click()
Dim m As Integer, n As Integer
m = InputBox("m="): n = Inp