2010年3月江苏VB考试真题 |
绝密★ 启用前 2010年春 江苏省高等学校非计算机专业学生 计算机基础知识和应用能力等级考试 二级试卷 试卷语种:VB语言 说 明: 1.本试卷包括计算机基础知识部分和程序设计部分,考试时间共12 0分钟; 2.本试卷满分为60分,分选择题和填空题,试卷不分A、B类型; 3.计算机基础知识部分全部是选择题(20分),程序设计部分分为选择题(1 0 分)和填空题(30分)两种; 4.选择题用答题卡答题。每一项有A、B、C、D四个可供选择的答案,请选 择其中一个你认为正确的答案,用HB铅笔涂写在答题卡的相应答题号内。 每选对一项得1分,不选或选错不得分; 5.填空题用答题纸答题。请将答案用蓝、黑色钢笔或圆珠笔填写在答题纸的 相应答题号内,每个答案只占一行,不得换行。每填对一个答案得1分, 不填或填错不得分; 6.请认真填写并仔细核对答题卡和答题纸上的学校名称、准考证号和姓名是 否填写正确。 7.考试结束时将试卷、答题卡和答题纸放在桌上,不得带走。待监考人员收 毕清点后,方可离场。
一、选择题(用答题卡答题,答案依次填在21—30答题号内) 21.关于窗体,以下叙述中正确的是 21 。 A.仅当窗体上没有可以获得焦点的控件时,窗体才可以获得焦点 B.一个VB工程只能从某个指定的窗体开始启动 C.只有窗体可以作为控件的容器 D.Unload Me和End语句的效果总是等同的 22.若a为长整型变量,则执行a=12 : Print Len(a);Len(Str(a)); Len(CStr(a))后,在窗体上看到的是 22 。 A.4 2 3 B.2 3 23.数学表达式 A.Cos(30*3.14159/180)/(4*y+Ln(x))+Exp(2) B.Cos(30*3.14159/180)/(4*y+Log(x))+Exp(2) C.Cos(30*3.14159/180)/(4*y+Ln(x))+e^2 D.Cos(30)/(4*y+Log(x))+e^2 24.表达式Fix(-2.5)+Int(-3.5)+CInt(-2.5)的值是 24 。 A.-8 B. 25.以下说法中,错误的是 25 。 A.使用缺省Preserve关键字的ReDim语句可以改变数组的维数和大小 B.ReDim语句只能出现在过程中 c.使用ReDim语句重新定义的动态数组,只能比原数组大 D.使用ReDim语句可以对动态数组的所有元素进行初始化 26.下列关于菜单的说法中,错误的是. 26 。 A.可以为菜单项选定快捷键 B.若在"标题"文本框中键入连字符(一),则可在菜单的两个菜单命令项之间加一条分隔线 C.除了Click事件之外,菜单项还可以响应其他事件 D.菜单编辑器的"名称"文本框用于输入菜单项的名称 27.以下有关过程中形式参数的描述中,错误的是 27 。 A.函数过程可以没有形式参数 B.事件过程一定没有形式参数 C.形参数组只能按地址与实参数组结合 D.窗体与控件也可以作为过程的参数 28.以下表达式中,可以表示"A和B之一大于0"的是 28 。 ①A*B<=0 ②A>0 Xor B>0 ③A>0 Or B>0 ④A>0 And B<=0 Or B>0 And A<=0 A.①③ B.③④ C.②④ D.①②④ 29.设变量A为长整型,则下面不能正常执行的语句是 29 。 A.A=32768*2 B.A=2*1.5*16384 C.A=16384*2 D.A=190^2 30.以下有关滚动条控件(ScrollBar)的说法中错误的是 30 。 A.只能在设计时设置Max与Min属性值 B.Value属性返回滚动条内滑块当前所处位置的值 C.拖动滚动条内滑块时,将触发滚动条的Scroll事件 D.单击滚动箭头时,将触发滚动条的Change事件 二:填空题 1.执行下面的程序后,A(1,4)的值是_____,A(2,3)的值是_______,A(3,2)的值是 Option Explicit Option Base 1 Private Sub Command1_Click() Dim a(4, 4) As Integer, ub As Integer Dim i As Integer, j As Integer, n As Integer ub = UBound(a, 1) n = 0 For i = ub To 1 Step -1 For j = 1 To ub + 1 - i n = n + 1 a(j, j + i - 1) = n Next j Next i For i = ub To 2 Step -1 For j = ub To i Step -1 a(j, j - i + 1) = a(5 - j, 4 - j + i) Next j Next i For i = 1 To ub For j = 1 To ub Picture1.Print a(i, j); Next j Picture1.Print Next i End Sub 2.在InputBox函数对话框中输入4(或直接单击”确定”按钮)窗体显示的第一行内容__(4)___,第二行是__(5)___,第四行是__(6)___ Option Explicit private Sub command1_Click() dim days as integer Days=InputBox("输入正整数",4) print fun(days) End Sub private function fun(d as integer) as integer if D=1 then fun=1 else fun=2*fun(D-1)+1 print D;fun end if End Function 3窗体显示的第一行是__(7)_____第三行是__(8)_____最后一行是___(9)__ private sub command1_Click() Dim i as integer, k as integer For i=1 to 5 k=fun(i)+I print k next i print i End Sub Function Fun(N as integer) as Integer Static M as integer Dim j as integer M=M+N N=N+1 For J=1 To M J=J+2 Fun=Fun+J Next J Fun=Fun+N End Function 4.窗体显示的第一行是__(10)_____第三行是__(11)_____,最后一行是_(12)____ Option Explicit Private Sub Command1_Click() Dim S as String,N as Integer S="3AB" N=14 Print Convert(S,N) End Sub Private Function Convert(S As string,N as Integer) as Long Dim St as string, L as Integer, I as integer L=Len(s) Do while L>=1 st=Left(s,1) if st>"9" then st=Asc(st)-55 end if Covert=Convert+Val(st)*N^(L-1) print Val(st)*N^(L-1) L=L-1 s=Right(S,L) End Function 5.窗体显示的第一行是__(13)___,第二行是__(14)____,第三行是___(15)__ Option Explicit Private Sub Command1_Click() Dim s as string, k as integer, ch() as string Dim P as string,i as integer s=Ucase("Meet me after the class.") For i=1 to Len(s) If Mid(s,i,1)<="Z" and Mid(s,i,1)>="A" then p=p & Mid(s,i,1) ElseIf p<>"" then k=k+1 Redim Preserve ch(k) ch(k)=p p="" End if Next i For i=1 to Ubound(ch) if len(ch(i))<=2 then Call move_c(ch(i),1) else Call move_c(ch(i),2) end if print ch(i) next i End SUb Private Sub Move_c(s as string, k as integer) Dim i as integer, j as integer, p as string*1 For i=1 to k p=Right(s,1) For j=Len(s)-1 to 1 step -1 Mid(s,j+1,1)=Mid(s,j,1) Next j s=p & Right(s,Len(s)-1) next i End Sub 6.下面的程序是求的近似值,当第n项的绝对值小于10^-5时终止计算 option explicit Private Sub Command1_Click() dim n as long, s as single, t as single, pi as single Const eps=0.00001 n=1 t=1 s=0 do s=s+t n=n+1 t=___(16)______ Loop Until __(17)______ pi=s*4 Label1.Caption ="的近似值为:" End Sub 7.下面程序的功能是,找出满足以下条件的三位整数,不含数字0, 且任意交换数字位置所得到的数,均能被6整除 Option explicit Private sub Command1_Click() dim i as integer, j as integer, k as integer, st as string Dim a(6) as integer For i=100 to 999 if ______(18)_________ then For j=1 to 6 if a(j) Mod 6<>0 then Exit For Next j if______(19)________THen st=st & str(i) k=k+1 if k mod 3 =0 then st=st & vbcrlf End if End if Next I Text1=st End Sub Private Function fj(a() as integer, s as string) as Boolean Dim n as Integer, i as integer, j as integer if Instr(s,"0")<>0 then ___(20)___ end if For i=1 to 3 For j=1 to 2 n=n+1 ____(21)___ s=Left(s,1) & Right(s,1) & Mid(s,2,1) Next j s=Right(s,1) & left(s,2) Next i fj=True End Function 8.下面程序的功能是求两个特大整数之和,由于vb中能够表示的整数大小有一定限制,所以必须用新的方法求特大整数之和,本程序将特大整数使用字符类型进行处理,其中函数add用于求两个1位整数之和,参数c用于保存进位,注意,求和前需首先将两个整数按位对齐 option explicit private Sub command1_Click() Dim s1 as string, s2 as string, s3 as string dim i as integer, n1 as integer, n2 as integer dim c as integer, n as integer s1=text1 : s2=Text2 n=______22_____ if sgn(n)>0 then s2=________23__________ elseif Sgn(N)<0 then s1=String(Abs(n),"0") & s1 end if For i=len(s1) to 1 step -1 n1=Val(Mid(s1,i,1)) n2=Val(Mid(s2,i,1)) s3=_______(24)________ Next i if c<>0 then s3=________(25)________ Text3=s3 End Sub Private Function Add(x as integer, y as integer, c as Integer) as string Add=Cstr((x+y+c) Mod 10) _________(26)________ End Function 9. Option Explicit Private Sub Command1_Click() dim i as long,i2 as long, flag as Boolean Dim a(0 to 9) as integer, b(0 to 9) as integer For i=100000 to 160000 Call Validate(i,a,flag) if flag then i2=i*6 call Validate(i2,b,flag) if flag and Compare(a,b) then List1.AddItem i & " " & i2 End if End if Next i end sub Private Sub validate(n as long, a() as Integer, f as Boolean) dim p as integer, i as integer Erase a f=false for i=1 to len(cstr(N)) p=___(27)___ if a(p)=1 then exit sub else a(p)=1 end if next i ___(29) f=true End Sub Private Function Compare(a() as integer, b() as integer) as Boolean dim j as integer compare=false for j=1 to Ubound(a) if a(j)<>b(j) then ____(30)____exit function End if next j Compare=true End Function |