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 |