1. <small id="kntrr"><delect id="kntrr"></delect></small>
    2. <sub id="kntrr"></sub>
        1. <form id="kntrr"><listing id="kntrr"></listing></form>
            江蘇省高校計算機等級考試命題研究院 江蘇省高校計算機等級考試輔導
            江蘇計算機等級二級vb模擬試題1

            第二部分:vb部分

            21.代數表達式  , 對應Visual Basic 表達式是______。

            A. E^(x+y)+|x+y|^1/2/2π+1

            B. Exp(x+y)+Sqr(Abs(x+y))/2*3.14159+1

            C. (Exp(x+y)+Sqr(Abs(x+y)))/(2*3.14159+1)

            D.( Exp(x+y)+Sqr(Abs(x+y)))/2*π+1

            22. 下面表達式的值為真的是______。

            A. Mid("Visual Basic",1,12)=Right("Programming Language Visual Basic",12)

            B. "ABCRG">"abcde"

            C. Int(134.69)>=Cint(134.69)

            D. 78.9/32.77<=97.5/43.97 And -45.4>-4.98

            23. 以下有關對象屬性的說法中正確的是______。

            A. 對象所有的屬性都羅列在屬性窗口列表中

            B. 不同對象不可能有同名屬性

            C. 不同對象的同名屬性取值一定相同

            D. 對象的某些屬性既可以在實行窗口中設置,也可以通過程序代碼設置或改變

            24.在窗體模塊的通用聲明處用下面的語句聲明變量、數組,正確語句有______個。

            Public A(5) As Integer     Public N As Integer

            Public St As String*10     Public b() As Integer

            A. 2  B. 3   C. 4   D. 1

            25. 單選按紐(OptionButton)用于一組互斥的選項中。若一個應用程序包含多組互斥條件,可在不同的______中安排適當的單選按紐,即可實現。

            A. 框架控件(Frame)或圖象控件(Image

            B. 組合框(ComboBox)或 圖象控件(Image

            C. 組合框(ComboBox)或圖片框(PictureBox

            D. 框架控件(Frame)或圖片框(PictureBox

            26. 下面的語句或方法,錯誤的有______。(其中mn Integer型變量)

            Dim Array(m,n) As Integer       n=32764+6

            Print A=A+B;A+B          ChDriver "C:"

            A. 1  B. 2   C. 3   D. 4

            27. 執行下面的程序,單擊窗體后在窗體上顯示的結果是_____。

            Private Sub Form_Click()

            Dim Str1 As String, Str2 As String,I As Integer

            Str1="ab"

            For I=Len(Str1) To 1 Step -1

            item=LCase(Mid(entry,I,1))&I

            Str1=Str1&Chr(Asc(Mid(Str1,I,1))+I)

            Next I

            Print Str1

            End Sub

            A. abce       B. abcd       C. abdb      D. abfd

            28. 下面說法不正確的是______。

            A. VB允許將一個數字字符串賦值給一個數值型的變量

            B. VB允許使用未經說明的變量,其類型都是Variant類型

            C. Cls只清除運行時在窗體或圖形框中顯示的文本或圖形

            D. 事件過程既可建在窗體模塊中,也可建在標準模塊中

            29. 下面能夠正確打開文件的一組語句是______。

            A. Open "data1" For Output As #5 , Open "data1" For Input As #5

            B. Open "data1" For Output As #5 , Open "data1" For Input As #6

            C. Open "data1" For Input As #5 , Open "data1" For Input As #6

            D. Open "data1" For Input As #5 , Open "data1" For Random As #6

            30. 應用程序窗體的名稱屬性為Frm1,窗體上有一個命令按紐,其名稱屬性為Cmd1,窗體和命令按紐的Click 事件過程名分別為______。

            A. Form_Click() Command1_Click()      B. Frm1_Click() Command1_Click()

            C. Form_Click() Cmd1_Click()           D:      

             

            二、填空題(請把答案填寫在答題紙的相應答題號內,每個答題只占一行)

            1.運行下面的程序,當單擊窗體時,窗體上第一行內容是______(1)_____,第三行內容是  ______(2)________  ,第四行內容是_________(3)____________。

             

            Dim x As Integer, y As Integer

            Private Sub Form_Click()

            Dim A As Integer, B As Integer

            A = 5: B = 3

            Call Sub1(A, B)

            Print A, B

            Print x, y

            End Sub

            Private Sub Sub1(ByVal M As Integer, N As Integer)

             Dim x As Integer, y As Integer

              x = M + N: y = M - N

              M = fun1(x, y)

              N = fun1(y, x)

            End Sub

            Private Function fun1(A As Integer, B As Integer) As Integer

              x = A + B: y = A - B

              Print x, y

              fun1 = x + y

            End Function

            2. 執行下面的程序,第一行輸出結果是___(4)___,第二行輸出結果是___5___。

            OPtion Explicit

            Private Sub Form_Click()

            Dim I As Integer,J As Integer

            J=10

            For I=1 To J

            I=I+1

            J=J-I

            Next I

            Print I

            Print J

            End Sub

            3. 執行下面的程序,第一行輸出結果是___(6)___,第三行輸出結果是___7___。

            Private Sub Form_Click()

            Dim A As Integer, I As Integer

            A=2

            For I=1 To 9

            Call Sub1(I,A)

            Print I,A

            Next I

            End Sub

            Private Sub Sub1(X As Integer,Y As Integer)

            Static N As Integer

            Dim I As Integer

            For I=3 To 1 Step -1

            N=N+X

            X=X+1

            NEXT I

            Y=Y+N

            End Sub

            4. 執行下面程序后,A1,3)的值是___(8)___,A2,2)的值是___(9)___,A3,1)的值是___(10)___。

            Option Explicit

            Private Sub Form_Click()

            Dim A(3,3) As Integer, I As Integer

            Dim J As Integer, K As Inteher,N As Integer

            For K=1 To 5

            If K<=3 Then

            For I=1 To K

            N=N+1

            A(I,K-I+1)=N

            Next I

            Else

            For I=1 To 6-K

            N=N+1

            A(K-3+I,4-I)=N

            Next I

            End If

            Next K

            For K=1 To 3

            For I =1 To 3

            Print A(K,I);

            Next I

            Print

            Next K

            End Sub

            5. 執行下面的程序,第一行輸出結果是___(11)___,第二行輸出結果是___12___。

            Option Explicit

            Private Sub Form_Click()

            Dim I As Integer,J As Integer

            I=1:j=2

            Call Test(I,J)

            Print I,J

            Call Test(I,J)

            Print I,J

            End Sub

             

            Private Sub Test(M As Integer,N As Integer)

            Static Sta As Integer

            M=M+N

            N=N+M+Sta

            Sta=Sta+M

            End Sub

            6. 下面程序的功能是統計當前盤當前文件夾中的順序文件data.txt中共有多少個英文單詞,約定連續出現的英文字母定義為一個單詞。

            Option Explicit

            Private Sub Form_Click()

            Dim Char As String, St As String,Tem As String

            Dim Idx As Integer,Js As Long,Flen As long

            Dim F As Boolean,W As String*1

            ___(13)___

            Flen=Lof(10)

            St=Input(Flen,#10)

            Js=1

            Do While Js<=Flen Then

            W=Mid(St,Js,1)

            If ___(14)___Then

            Tem=Tem+W

            F=True

            Else If F=True Then

            Idx=Idx+1

            ReDim Preserve Char(Idx)

            Char(Idx)=Tem

            Tem=___(15)___

            F=False

            End If

            ___(16)___

            Loop

            Print "共有";Idx;"個單詞"

            For Js=1 To Idx

            Print Char(Js)

            Next Js

            Close #10

            End Sub

            7. 下面程序的功能是當循環次數一定時,統計生成互不相同的1——100之間的隨機整數的個數。

            Option Explicit

            Option Base 1

            Private Sub Form_Click()

            Dim Data() As Integer, I As Integer,Idx As Integer

            Dim N As Integer, Temp As Integer,Flg As Boolean

            N=InputBox("輸入循環次數")

            ReDim Data(1)

            Idx=1

            Data(1)=Int(100*Rnd(1))+1

            For I=1 To N

            Temp=Int(100*Rnd(1))+1

            ___(17)___

            Call COmpare(Data,Temp,Flg)

            If Flg=True Then

            Idx=Idx+1

            ___(18)___

            Data(Idx)=Temp

            End If

            Next I

            Print "生成";Idx;"個不相同的整數"

            For I=1 To Idx

            Print Data(I)

            If I Mod 10=0 Then Print

            Next I

            End Sub

            Private Sub Compare(Array() As Integer,K As Integer,Logic As Boolean)

            Dim Ub As Integer, I As Integer

            ___(19)___

            For I=1 To Ub

            If Array(I)=K Then

            ___(20)___

            End If

            Next I

            Logic=True

            End Sub

            8. 下面程序的功能是驗證回文數猜想。任取一自然數,將其倒過來,并將這兩個數相加,然后把這個和數倒過來,與原來的和數相加……重復這個過程有限次,必將得到一個回文數。

            所謂回文數指左右數字完全對稱的自然數,例如,121,12321,898,111均是回文數。根據猜想,假如取一自然數68——68+86=154——154+451=605——605+506=1111,經過三步運算就得到回文數1111。

            Option Explicit

            Private Sub Form_Click()

            Dim S As Long,D As Long,Sum As Long

            Dim Flg As Boolean

            S=InputBox("輸入一個正整數")

            Do

            D=Fun(S)

            Sum =S+D

            Print Sum;"=";S;"+";D

            Call Comp(Sum,Flg)

            S=___(21)___

            Loop Until Flg

            Print Sum;"是回文數"

            End Sub

             

            Private Function Fun(N As Long)As Long

            Dim Char As String,J As Long

            Dim I As Integer,Slen As Integer

            Char=Ltrim(Str(N))

            ___(22)___

            J=1

            For I=1 To Slen

            Fun=Fun+Val(Mid(Char,I,1))*J

            ___(23)___

            Next I

            End Function

            Private Sub Comp(N As Long,F As Boolean)

            Dim Ch As String,S As Integer,I As Integer

            S=Len(Ltrim(Str(N)))

            F=False

            Ch=Ltrim(Str(N))

            For I=1 To___(24)___

            If Mid(Ch,I,1)<>Mid(CH,S+1-I,1)Then Exit Sub

            Next I

            ___(25)___

            End Sub

            9. 若一個等比數列的首項為2,公比為3,其第n項到第m 項之和為720。下面是求出符合上述要求的n m 的程序。

             Private Sub Command1_Click()

              Dim Num() As Integer, Q As Integer, A As Integer

              Dim i As Integer, N As Integer, M As Integer

              Const k As Integer = 720

              ReDim Num(1)

                A = 2: Q = 3

                Num(1) = A

                 ____________(26)____________    

              Do

                A = A * Q

                i = i + 1

                  ___________(27)______________

               Num(i) = A

              Loop Until Num(i) >= 720

              Call Sum1(Num, N, M, k)

              Label1 = "" + Str(N) & "~" & Str(M) & " 項的和是720"

              End Sub

             Private Sub Sum1(Num() As Integer, N As Integer, M As Integer, ByVal k As Integer)

               Dim Ub As Integer, s As Integer, i As Integer, Idx As Integer

              _________(28)____________  

              For i = 1 To Ub

                 ________(29)_________________    

               N = i

                   ________(30)______________

              Do Until s >= k

               s = s + Num(Idx)

               Idx = Idx + 1

              Loop

               If s = k Then

               M = Idx1

              Exit For

              End If

              Next i

            End Sub

            答案:

            21.C22.A23.D24.A25.D26.C27.C28.D29.C30.C

            1.10  6 

            2.5  4

            3.10 -6

            4.11

            5.-20

            6.4  8 

            7.12  86

            8.4

            9.5

            10.6

            11.3  5

            12.8  16

            13.Open "data.txt" For Input As #10

            14.w>="A" and w<="Z" or W>="a" and w<="z"

            15.""

            16.js=js+1

            17.Flg=False

            18.Redim Preserve Data(idx)

            19.Ub=Ubound(arry)

            20.Exit Sub

            21.Sum

            22.Slen=Len(char)

            23.J=J*10

            24.S

            25.F=True

            26.I=1

            27.Redim Preserve Num(i)

            28.Ub=Ubound(Num)

            29.S=0

            30.Idx=i

            国产在线精品一区二区三区不卡_亚洲第一极品精品无码_永久免费无码网站在线观看_亚洲av综合日韩