1、2021年春浙江省高等学校 计算机等级考试试卷(二级Visual Basic)说明: 考生应将所有试题的答案填写在答卷上。其中试题1试题6,请在答卷上各小题正确选项的对应位置处填“”; 请将你的准考证号的后五位填写在答卷右下角的指定位置内; 考试时间为90分钟;试题1(每小题3分,共12分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】单击窗体后输入1个不小于6的正整数,然后输出该数所有的质数因子(如输入6则输出“ 2 3”,输入60则输出“ 2 2 3 5”,等等)。【程序】Private Sub f( (1) ) Dim i As Integer i
2、= 2 Do While (2) If (3) Then k = k /i: Print i; Else i = i + 1 LoopEnd SubPrivate Sub Form_Click() Dim n As Integer Do n = InputBox(n=) Loop (4) Call f(n) PrintEnd Sub【供选择的答案】(1) A、n As IntegerB、k As Integer C、Byval n As ByteD、I As Integer(2) A、k1B、k=1C、k=1D、k Mod i=0(3) A、ki=0B、ki*i=0C、n Mod i=0D、(
3、ki)*i=k(4) A、Until n6B、While n=6C、Until n=6D、While n6试题2(每小题3分,共15分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。 【程序说明】Dim n As Integer P1.Enabled = True: n = 0 Else P1.Enabled = False: MsgBox(单击该区域 + (6) + 次) End IfEnd Sub Private Sub Form_Activate() P1.Width = P1.Height P1.Scale(-3, 3) - (3, -3) P1.FillSt
4、yle = (7) P1.FillColor = (8) : P1.Circle(0, 0), 2 P1.FillColor = vbwhite: P1.Circle(0, 0), 1 End Sub Private Sub Form_Load() End Sub Private Sub P1_MouseDown(Button As Integer, Shift As Integer, _ x As Single, y As Single) If x * x + y * y = 1 And (9) Then n = n +1 End Sub【供选择的答案】(5) A、退出B、开 始C、显示D、
5、开始(6) A、nB、Val(n) C、Str(n)D、Trim(n)(7) A、1B、0 C、2D、3(8) A、vbBlackB、Rgb(255,0,0)C、vbwhiteD、Rgb(255,255,0)(9) A、x*x+y*y2 And y2C、x*x+y*y4试题3(每小题3分,共12分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】【程序】 Dim x As Single Do While (11) Input #1, x: List1.Additem x Loop Close #1End Sub Dim n As Single,x As Si
6、ngle,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 For i = 1 To n: Print #1,a(i): Next i Close #1End Sub【供选择的答案】(10
7、) A、Output B、Input C、Append D、Read(11) A、Eof(1) B、Not Eof(1) C、Eof(fn) D、Not Eof(fn)(12) A、Count B、ListCount-1 C、List D、ListCount(13) A、a(j)a(k) B、a(j)=a(k) C、a(j)a(k) D、a(j)a(k)试题4(每小题3分,共12分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】Private Sub Form_Load() Text1.Text=: Form1.ClsEnd SubPrivate Sub Te
8、xt1_KeyPress(k As Integer) Static s As Integer If (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、1 4 9 B、9 C、1 3 5 D、5 (15) 写出运行时在Text1中依次按“2 4 6 ”后窗体上的显示结果。A、2 4 6 B、12 C、6 D、2 6 12 (16) 写出运行时在Text1中依次按“1 -3
9、5 ”后窗体上的显示结果。A、1 -2 3 B、1 4 9 C、1 -3 5 D、3 (17) 写出运行时在Text1中依次按“1 2a 5 ”后窗体上的显示结果。A、1 43 48 B、1 2 5 C、5 D、1 3 8试题5(每小题3分,共9分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】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
10、 If r = 0 Then Exit Do a = b: b = r Loop f = bEnd Function Dim m As Integer, n As Integer m = InputBox(m=): n = InputBox(n=) Form1.Cls: Print f(m, n)End Sub(18) 运行时若输入m值为15、n值为25,窗体上的显示结果为: A、25 B、15 C、5 D、3(19) 运行时若输入m值为24、n值为16,窗体上的显示结果为: A、24 B、16 C、8 D、2(20) 运行时若输入m值为123、n值为23,窗体上的显示结果为: A、100 B
11、、1 C、23 D、146试题6(每小题3分,共12分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】Private Sub f(n As Integer, k As Integer, x As String) Dim m As Integer, t As Integer x= : m = n : n = Abs(n) Do While n 0 t = n Mod k If k=16 And t9 Then x = Chr(Asc(a)+t-10) + x Else x = t & x n = n k Loop If m 0 sum = sum + n Mod
12、 10 n = n 10 LoopEnd Function2解Private Function sum(ByVal n As Integer) As Integer Dim s As String, i As Integer s = Trim(Str(Abs(n) For i = 1 To Len(s) sum = sum + Val(Mid(s, i, 1) Next iEnd Function Dim a(10) As Integer, b(10) As Integer, i As Integer For i = 1 To 10 a(i) = InputBox() b(i) = sum(a(i) Print a(i); Next i Print For i = 1 To 10 Print b(i); Next iEnd Sub
©2010-2024 宁波自信网络信息技术有限公司 版权所有
客服电话:4008-655-100 投诉/维权电话:4009-655-100