(完整版)浙江省07-08VB二级考试卷真题及答案_第1页
(完整版)浙江省07-08VB二级考试卷真题及答案_第2页
(完整版)浙江省07-08VB二级考试卷真题及答案_第3页
(完整版)浙江省07-08VB二级考试卷真题及答案_第4页
(完整版)浙江省07-08VB二级考试卷真题及答案_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、1 2008 年春浙江省高等学校计算机等级考试试卷 (二级 visual basic ) 说明:考生应将所有试题的答案填写在答卷上。其中试题1试题6,请在答卷上各小题正确选项的对应位置处填“”; 请将你的准考证号的后五位填写在答卷右下角的指定位置内; 考试时间为90 分钟 ; 试题 1(每小题3 分,共 12 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】单击command1 后用输入对话框输入1 个整数,单击command2 后在 text1中显示其反序的数(高位变低位)。要求在文本框中不可输入任何字符。例如:输入123 显示 321,输入 -567

2、 显示 -765 。【程序】 (1) private sub form_load() (2) end sub private sub command1_click() text1.text = : n = inputbox(n=) end sub private sub command2_click() if n 0 then n = -n: text1.text = - while n 0 text1.text = (3) (4) wend end sub 【供选择的答案】b(1) a 、dim n as byte b、dim n as integer c、dim n as string d

3、、public n as byte a(2) a 、text1.locked = true b、text1.locked = false c、text1.visible = true d、text1.visible = false d(3) a 、n/10 & text1.text b、n mod 10 & text1.text c、text1.text & n/10 d、text1.text & n mod 10 a(4) a 、n = n 10 b、n = n / 10 c、n = n mod 10 d、n = n - 10 试题 2(每小题3 分,共 12

4、 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】运行时,可以在图片框控件p1 用红色绘制下列坐标线并加上数字显示。2 private sub form_activate() p1.height = p1.width p1.fontsize = 10 (5) (-10, 110)-(110, -10) (6) p1.line (-5, 0)-(100, 0) p1.line (0, -5)-(0, 100) for i = (7) p1.line (i, 0)-(i, 2) p1.line (0, i)-(2, i) next i for i = 1 t

5、o 9 p1.currentx = i * 10 - 2 p1.currenty = -2 (8) next i end sub 【供选择的答案】b(5) a 、p1.draw b、p1.line c、p1.print d、p1.scale b(6) a 、p1.forecolor = rgb(255,0,0) b、p1.fillcolor = rgb(255,0,0) c、p1.fillcolor = vbred d、p1.forecolor = red a(7) a 、1 to 9 step 1 b、10 to 90 c、10 to 90 step 10 d、 2 to 9 b(8) a

6、、pset i b、p1.print i c、p1.pset i d、print i 试题 3(每小题3 分,共 12 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】单击“读文件” 按钮将文本文件读入并逐行在列表框控件list1中显示;然后单击 “分解”按钮将list1每行中的英文字母、其他字符分别显示在list2 、list3各行中。运行结果如下图所示。3 【程序】private sub command1_click() 读文件 dim s as string open e:xxx.txt for (9) as #1 while not eof(1)

7、 line input #1, s : list1.additem s wend close #1 end sub private sub command2_click() 分解 dim i as integer, n as integer, s1 as string, s2 as string for i = 1 to (10) n = len(list1.list(i - 1) redim a(n) as string * 1 for j = 1 to n a(j) = (11) next j s1 = : s2 = for j = 1 to n if (12) then s1=s1+a(

8、j) else s2=s2+a(j) next j list2.additem s1 list3.additem s2 next i end sub 【供选择的答案】c( 9)a、 read b、append c、input d、output d(10)a、 list1.count b、listcount c、listcount-1 d、list1.listcount a(11)a、 mid(list1.list(i-1),j,1) b、middle(list1.list(i-1),j,1) c、mid(list1.list(i-1),j) d、middle(list1(i-1),j,1) b

9、(12)a、 a(j)=a and a(j)=a and a(j)=a and a(j)=a and a(j)=z c、a=a(j)=z or a=a(j)=a and a(j)=a and a(j)=z)试题 4(每小题3 分,共 12 分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】private sub text1_keypress(k as integer) if k asc(9) then k = 0 else label1.caption = chr(k) + label1.caption end if end sub 【供选择的答案】b (13

10、) text1获得输入焦点后,依次按数字键1、 3、5,label1 显示: a、135 b、 531 c、9 d、5 a (14) text1获得输入焦点后,依次按数字键2、 7、9,label1 显示: a、972 b、279 c、297 d、18 c (15) text1获得输入焦点后,依次按 - 、2、3、5 键, label1 显示: a、-532 b、 -235 c、532 d、235 d (16) text1获得输入焦点后,依次按 1 、2、a、5 键, label1 显示: a、空白 b、 12a5 c、5a21 d、521 试题 5(每小题3 分,共 12 分)阅读下列程序并

11、回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】private sub form_load() timer1.interval = 1000 end sub private sub timer1_timer() static k as byte form1.currentx=0: form1.currenty=0 窗体的所有其他属性均取缺省值 form1.cls if k = 0 then k = 1 else k = 0 if k=0 then form1.forecolor = rgb(0, 255, 0) else _ form1.forecolor = rgb(0,

12、0, 255) print time end sub 【供选择的答案】a(17) 激活 timer1 后,每间隔1 秒显示一次系统时间,方式是: a 、蓝、绿色交替显示 b、蓝色显示 c、绿色显示 d、红色显示b(18) 系统时间的显示位置,是在:5 a 、窗体右上角 b、窗体左上角 c、窗体右下角 d、窗体左下角b(19) 如果将 timer 过程中的语句“static k as byte”改为“ dim k as byte” ,激活 timer1 后,窗体系统时间显示上的颜色为: a 、蓝、绿色交替 b、蓝色 c、绿色 d、红色a(20) 如果要同时显示系统日期、时间, 对 timer 过

13、程中 print语句之输出列表不可取的是: a 、date,time b、date;time c、date-time d、 date + time 试题 6(每小题3 分,共 12 分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】private sub f(b() as integer, byref m as integer) dim i as integer, j as integer, k as integer i = 1 do while i = m for j = 1 to m if b(i) mod b(j) = 0 and i j then fo

14、r k = i to m - 1: b(k) = b(k + 1): next k exit for end if next j if j m then i = i + 1 else m = m - 1 loop end sub private sub command1_click() dim a(6) as integer, i as integer, n as integer n = 6 for i = 1 to 6: a(i) = inputbox(a( & i & )=): next i call f(a, n) for i = 1 to n: print a(i);

15、: next i end sub d(21) 单击 command1 输入 7、8、5、4、 9、3 后,相应的显示结果为: a 、8 9 3 b、8 9 3 3 3 3 c、 7 5 4 3 3 3 d、7 5 4 3 c(22) 如果将过程f 首句中的“ byref”改为“ byval ” ,输入数据同 (21) ,显示结果为: a 、8 9 3 b、8 9 3 3 3 3 c、 7 5 4 3 3 3 d、7 5 4 3 b(23) 单击 command1 输入 4、12、27、8、-6 、3 后,相应的显示结果为: a 、4 3 3 3 3 3 b、4 3 c、 12 27 8 -6

16、d、12 27 8 a(24) 如果将过程f 首句中的“ byref”改为“ byval ” ,输入数据同 (23) ,显示结果为: a 、4 3 3 3 3 3 b、4 3 c、 12 27 8 -6 d、12 27 8 试题 7(28 分)编程,按 command1 可输入有10 个实数的数组,调用函数f 求他们的平均值v ,然后输出其中与v之差的绝对值为最小的那个数组元素。请将答卷上函数过程f (包括形参列表) 、事件过程command1 补充完整。private function f(a() as single,n as integer ) as single 2 分6 dim i a

17、s integer,sum as single 1 分 sum=0 for i=1 to n 5 分sum=sum+a(i) next i f=sum/n 2 分end function private sub command1_click() dim a(10) as single, i as integer, v as single, x as single, d as single 输入数据 (3分) for i= 1 to 10 a(i)=inputbox(“请输入数据”) next i 计算平均值v (3分) v=f(a,10) 将与 v 之差的绝对值为最小的那个数组元素赋值给x,输

18、出 x。d=abs(v-a(1) : x=a(1) 2 分for i=2 to 10 绝对值2 分, 其余 6 分 if dmax then max=a(i) if a(i)min then min=a(i) (7) next i (8) 8 【供选择的答案】a(5) a 、function b、sub c、private sub d、private function b(6) a 、max as single,min as single b、max as integer,min as integer c、byval max as single d、byval max as single,by

19、val min as single a(7) a 、f=f+a(i) b、f=f+a(i)/n c、f=a(i) d、f=a(i)/n d(8) a 、find = max b、end sub c、find = min d、end function 试题 3(每小题3 分,共 12 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】单击 command1 后读入文件中所有数据( 多于 10 个) ,将其中较大的5 个数、较小的5个数以及其他数分别在列表框控件list1 、list3 、list2中显示。【程序】private sub command1_cl

20、ick() dim n as integer, x as single, i as integer,j as integer,k as integer open e:score.txt for input as #1 do while (9) 统计文件中的数据个数n input #1, x : n = n + 1 loop (10) as single close #1: open e:score.txt for input as #1 重新打开文件 for i = 1 to n input #1,a(i) next i close #1 for i = 1 to n-1 k = i for

21、j = i+1 to n if (11) then k=j next j x = a(i): a(i) = a(k): a(k) = t if i a(k) b、a(i)a(k) d、a(j)=n-5 b、in-5 c、n5 d、in 试题 4(每小题3 分,共 12 分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】dim m as integer private sub command1_click() dim a as integer, i as integer, f as integer a = inputbox(a=) f = 1: i = 2 wh

22、ile i = a / 2 if a mod i = 0 then f = f + i i = i + 1 m = m + 1 wend form1.cls: print f end sub 【供选择的答案】 (13) 运行时第1 次单击 command1 输入 7 后,窗体上的显示结果为: a 、1 b、3 c、 5 d、7 (14) 运行时第2 次单击 command1 输入 8 后,窗体上的显示结果为:a、2 b、7 c、 8 d、6 (15) 运行时第3 次单击 command1 输入 9 后,窗体上的显示结果为:a、3 b、5 c、 7 d、4 (16) 运行时 3 次单击 comm

23、and1 、并依次输入7、 8、9 后,变量m的当前值为:a、6 b、7 c、 8 d、3 试题 5(每小题3 分,共 12 分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】private function f(a as integer, b as integer) as integer dim r as integer, t as integer f = a do while f mod b 0 f = f + a loop end function private sub command1_click() static k as integer 10 d

24、im m as integer, n as integer m = inputbox(m=) n = inputbox(n=) k = k + 1 form1.cls print f(m, n) end sub 【供选择的答案】(17) 运行时第1 次单击 command1 输入 4、6 后,窗体上的显示结果为: a 、4 b、24 c 、8 d、12 (18) 运行时第2 次单击 command1 输入 15、10 后,窗体上的显示结果为: a 、150 b、20 c、30 d、2 (19) 运行时第3 次单击 command1 输入 4、10 后,窗体上的显示结果为: a 、10 b、20

25、 c、40 d、80 (20) 第 4次单击 command1 后,该事件过程中变量k 的当前值为: a 、4 b、3 c、0 d、2 试题 6(每小题3 分,共 12 分)阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。界面设计以及运行时hscroll1.value值为 90 时的显示分别如下图左、图右所示。【程序】private sub form_load() picture1.width = picture1.height picture1.scale (-10, 10)-(10, -10) picture1.borderstyle = 0 hscroll1.sm

26、allchange = 2: hscroll1.largechange = 10 end sub private sub hscroll1_change() dim t as single picture1.cls t = hscroll1.value * 3.14159 / 180 label1.caption = hscroll1.value picture1.circle (0, 0), 10, vbred picture1.line (0, 0)-(9 * cos(t), 9 * sin(t) 11 end sub (21) 决定运行时图片框控件边框不显示的相关属性为: a 、back

27、color b、forecolor c、fillstyle d、borderstyle (22) 滚动条 value 属性值为180 时,以原点为起点的直线指向: a 、12 点方向 b、 9 点方向 c、6 点方向 d、3 点方向(23) 滚动条 value 属性值为270 时,以原点为起点的直线指向: a 、12 点方向 b、 9 点方向 c、6 点方向 d、3 点方向(24) 下列说法中正确的是: a 、拖动滚动条滑块的过程中以及结束后都不会触发hscroll1_change事件 b 、拖动滚动条滑块的过程结束后立即触发hscroll1_change事件 c 、单击滚动条两端箭头时val

28、ue 的增量为10 或 -10 。 d 、单击滚动条上空白区域时value 的增量为2 或-2 。试题 7(28 分)编程,计算多项式12321nnxaxaxaa的值。在文本框控件text1 、text2 中分别输入n、x 后,按 command1 可输入naaaa、321,按 command2 可计算该多项式的值并以标签控件label3 显示。程序设计时的界面设计如下图左所示。运行时输入n 为 3、 x 为 1.5 , 输入321aaa、分别为 1、 2、3 后的输出结果如下图右所示。请将答卷上各事件过程补充完整。2007 年春浙江省高等学校计算机等级考试试卷 (二级 visual basi

29、c ) 说明:考生应将所有试题的答案填写在答卷上。其中试题1试题6,请在答卷上各小题正确选项的对应位置处填“”; 请将你的准考证号的后五位填写在答卷右下角的指定位置内; 考试时间为90 分钟 ; 试题 1(每小题3 分,共 12 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。12 【程序说明】 单击窗体后输入1 个不小于6 的正整数,然后输出该数所有的质数因子(如输入 6 则输出“ 2 3” ,输入 60 则输出“ 2 2 3 5” ,等等)。【程序】private sub f( (1) ) dim i as integer i = 2 do while (2)

30、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) print end sub 【供选择的答案】b(1) a 、n as integer b、k as integer c、byval n as byte d、i as integer a(2) a 、k1 b、k=1 c、k=1 d、k mod i=0 d(3) a 、ki=0 b、ki*i=0 c、n mod i=0

31、d、 (ki)*i=kc(4) a 、until n6 b、while n=6 c、until n=6 d、while n6 试题 2(每小题3 分,共 15 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】统计鼠标单击图片框控件p1 中两个同心圆所围成黑色区域的次数:首次单击command1将统计结果请零、p1可用,再次单击则以消息框显示统计结果、p1不可用。dim n as integer private sub command1_click() if command1.caption = 开始 then command1.caption = 显示

32、p1.enabled = true: n = 0 else command1.caption = (5) p1.enabled = false: msgbox( 单击该区域 + (6) + 次 ) end if end sub private sub form_activate() p1.width = p1.height p1.scale(-3, 3) - (3, -3) p1.fillstyle = (7) 13 p1.fillcolor = (8) : p1.circle(0, 0), 2 p1.fillcolor = vbwhite: p1.circle(0, 0), 1 end su

33、b private sub form_load() command1.caption = 开始 : p1.enabled = false 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 【供选择的答案】d(5) a 、 退出 b、 开 始c、 显示 d、 开始 c(6) a 、n b、val(n) c、str(n ) d、trim(n) b(7)

34、a 、1 b、0 c、2 d、3 a(8) a 、vbblank b、rgb(255,0,0) c、vbwhite d、rgb(255,255,0) a(9) a 、x*x+y*y2 and y2 c、x*x+y*y4 试题 3(每小题3 分,共 12 分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】某文件中存放了若干个实数,单击command1 可用对话框打开该文件、并将读入的所有数据在 list1中显示,单击 command2 可将读入的数据按值从大到小顺序重新写入到该文件。【程序】private sub command1_click() dim x

35、 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

36、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.filenmae for output as #1 14 for i = 1 to n: print #1,a(i): next i close #1 end sub 【供选择的答案】b(10) a 、output b、input c、append d、 read b(1

37、1) a 、eof(1) b、not eof(1) c、eof(fn) d、 not eof(fn) d(12) a 、count b、listcount-1 c、list d、 listcount a(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.cls end sub private sub text1_keypress(k as i

38、nteger) 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 a(14) 写出运行时在text1 中依次按“ 1 3 5 ”后窗体上的显示结果。 a 、1 4 9 b、9 c、1 3 5 d、5 d (15) 写出运行时在text1 中依次按“ 2 4 6 ”后窗体上的显示结果。a、2 4 6 b、12 c、6 d、 2 6 12 b (16) 写出运行时在text1 中依次按“ 1 -3 5 ”后

39、窗体上的显示结果。a、1 -2 3 b、1 4 9 c、1 -3 5 d、 3 d (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 if r = 0 then exit do a = b: b = r loop f = b end function private sub command1_click() 15 dim m as integer, n as integer m = inputbox( m= ): n = inputbox( n= ) form1.cls: print f(m, n) end sub c(18) 运行时若输入

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论