鸭子tv国产极品在线观看_成人69视频在线播放_91精品免费在线观看_亚洲AT永久偷窥无码精品_国产精品自产拍在线观看涩浪潮久

江蘇省高校計(jì)算機(jī)等級(jí)考試命題研究院 江蘇省高校計(jì)算機(jī)等級(jí)考試輔導(dǎo)
2005秋江蘇省等級(jí)考試筆試卷(2)

第二部分 VB程序設(shè)計(jì)

一、 選擇題

21.以下所列的8個(gè)控件中,具有Caption屬性的有         個(gè)。

CheckBox(復(fù)選框)、ComboBox(組合框)、HscrollBar(水平滾動(dòng)條)、DirListBox(文件夾列表框)、Image(圖像框)、Frame(框架)、Label(標(biāo)簽)、Line(線條)

A5              B4               C3             D2

22.執(zhí)行下面語(yǔ)句后,Len函數(shù)值最大的是          。

Dim IA As Integer, B As Single, S As String *5, Ch As String

IA=32767  : B=23.5  : S=”A”  :Ch=”abcd”

ALen(IA)        BLen(B)           CLen(S)        DLen(Ch)

23.假設(shè)變量Lng為長(zhǎng)整形變量,下面不能正常執(zhí)行的語(yǔ)句是

ALng=16384*2                      BLng=4*0.5*16384

CLng=190^2                        D32768*2

24.?dāng)?shù)學(xué)表達(dá)式 對(duì)應(yīng)的正確Visual Basic表達(dá)式為

A-b+Sqr(b*b-4*a*c)/2*a

B-b+Sqr(b*b-4*a*c)/(2*a)

C(-b+Sqr(b*b-4*a*c))/(2*a)

D(-b+Sqr(b*b-4*a*c))/ 2*a

25.設(shè)Mys1,Mys2均為字符串型變量,Mys1=”Visual Basic”,Mys2=”b”,則下面關(guān)系表達(dá)式中結(jié)果為的是

ALen(Mys1)<>2*InStr(Mys1,”1”)

BMod(Mys1,8,1)>Mys2

CChr(98)&Right(Mys1,4)=”Basic”

DInStr(Left(Mys1,6),”a”)+60

26.在窗體模塊代碼窗口的通用聲明處,可以使用語(yǔ)句說(shuō)明數(shù)組

Public A(10) As Integer     ② Dim A(10) As Integer

Private A(10)As Integer     ④ Static A(10) As Integer

A①②    B②③    C③④    D①④

27.設(shè)A=7,B=4,C=6,,則表達(dá)式A Mod3+B^3/C\5的值為

A1       B2       C3       D.出錯(cuò)

28.下列說(shuō)法中,錯(cuò)誤的是

A. 當(dāng)程序正常結(jié)束時(shí),所有沒(méi)用Close語(yǔ)句關(guān)閉的文件都會(huì)自動(dòng)關(guān)閉

B. 在關(guān)閉文件或程序結(jié)束之前,可以不用Unlock語(yǔ)句對(duì)已鎖定的記錄解鎖

C. 可以用不同的文件號(hào)同時(shí)打開一個(gè)隨機(jī)文件

D. Output模式打開一個(gè)順序文件,即使不對(duì)它進(jìn)行寫操作,原來(lái)內(nèi)容也被清除

29.程序中有兩個(gè)過(guò)程Private Sub Fun1(S As String)Private Sub Fun2(a() As String 6),在調(diào)用過(guò)程中用Dim  St(6)  As  String6定義了一個(gè)字符串?dāng)?shù)組。下面調(diào)用語(yǔ)句中正確的是。

Call Fun1(St(3)) Call Fun2(St) Call Fun1(St) Call Fun2(St(6) )

A.①②   B.①③   C.②③   D.②④

30DrawStyle屬性用于設(shè)置圖形方法輸出的線型,它受屬性的限制

AFillStyle    BFillColor   CBorderStyle    DDrawWidth

二、

填空題

1.若窗體有列表框,則List1.List(List1.ListIndex)的值等于List1__Text___屬性值。

2.執(zhí)行下面的程序,當(dāng)單擊Command1時(shí),列表框List1的第2列表項(xiàng)內(nèi)容是 3 ,第4列表項(xiàng)內(nèi)容是_15_,第5列表項(xiàng)內(nèi)容是  28    。

  Private Sub Command1_Click()

     Dim I As Integer,j As Integer

     For I =1 To 10

        j=I+j

        List1.AddItem j

     Next I

     For I =1 To 4

        List1.RemoveItem List1.ListCount - I

     Next I

  End Sub

3.運(yùn)行下面的程序,當(dāng)單擊Command1時(shí),窗體上顯示的第一行內(nèi)容是DCB,第三行內(nèi)容是 D,第四行內(nèi)容是3。

  Private Sub Command1_Click()

    Print Text3

  End Sub

  Private Function Textt As IntegerAs Integer

    Dim i As Integer

    If t=1 Then

       Call Testt-1

       For i = 3 To t Step - 1

           Print ChrAsc(“A”)+ i);

       Next i

Print

     End if

     Test = t

  End Function

4.運(yùn)行下面的程序,當(dāng)單擊窗體時(shí),窗體上顯示的第一行內(nèi)容是10 8,第三行內(nèi)容是5 2,第四行內(nèi)容是12  -10。

  Dim x As Integery As Integer

  Private Sub Form_Click()

    Dim a As Integer,b As Integer

    A=5b=3

    Call sub1ab

    Print a,b

    Print x,y

  End sub

  Private Sub sub1ByVal m As Integern As Integer

    Dim y As integer

    X=m+ny=m-n

    M=fun1x,y

    N=fun1yx

  End sub

  Private Function fun1a As Integer,b As IntegerAs Integer

    X=a+by=a-b

    Print x,y

    Fun1=x+y

  End function

5.執(zhí)行下面的程序,當(dāng)單擊COMMAND1時(shí),picute1中顯示內(nèi)容的第二行與第四行分別是5 6 7 813 14 15 16,picture2中顯示內(nèi)容的第一行和第三行分別是4 8 12 162 6 10 14。

  Private Sub Command1_Click()

     Dim a44As Integer,I As Integer,j As Integer

     Dim b44As Integer

     For I=1 To 4

        S=“”

        For j =1to 4

           AI,j=((I-1*4+j

           S=s&Right(“ & StraIj)),3

        Next j

        Picture1.Print s

      Next i

      For I=1 To 4

         For j=1 To 4

            B5-j,I=aIj

         Next j

      Next i

      For I=1 to 4

         S=“”

         For j = 1 To 4

            If  Len((CStrbI,j)))<2 Then

               S=s&“” & CStrbI,j))&

            Else

               S=s& CStrbIj))&

            End if

         Next j

         Picture2.Print s

      Next i

  End Sub

6.下面程序的功能時(shí),輸入x的值,利用遞推法分別求出級(jí)數(shù)前n項(xiàng)(n=01,2,3…)之和。

S=a0+a1++an+

其中,

 a 0=1   a n=a n-1 *    n=1,2,3……

計(jì)算積數(shù),直到第n項(xiàng)的絕對(duì)值小于等于0.001時(shí)停止,完善程序,實(shí)現(xiàn)以上功能。

  Option Explicit

  Private Sub Command1_Click()

     Dim x As Single, I As Integer, s As Single

     Dim a As Single, a1 As Single

     X = Text1

     A=1s = a

     List1.AddItems(“&0= & Strs

     Do

        I=I+1

       ____a1=a*x*(3-2*i)/(2*i)______

        S=s+a1

        List1.AddItems(” &CStrI&“)= & Strs

        If  Absa1)〈=0.001 Then

             Text2=i

                Exit do   

        Else

A=a1

        End if

Loop

  End Sub

7.下面程序的功能時(shí),驗(yàn)證任意一個(gè)大于5的奇數(shù)可表示為3個(gè)素?cái)?shù)之和。完善程序,實(shí)現(xiàn)以上功能。

  Option Base 1

  Private Sub Command1_Click()

Dim P()As IntegerN As Integer,L As Integer

Dim I As Integer,J As Integer,k As Integer

Dim ch As String

N=InputBox(“輸入一個(gè)大于5的奇數(shù)!”)

Label1.Caption=   str(n) & “=”

Call PrimePN

L=UboundP

For I=1 to L

   For J=1 to L

      For k =1 to L

         If p(i)+p(j)+p(k)=n  then

            Ch=CStrPI&+ &CStrPJ))&+ & CStrPk))

            Text1.text = ch

             Exit sub

         End if

      Next k

   Next J

Next I

  End sub

  Private Sub PrimeA()As Integer,N As Integer

Dim I As Integer,Idx As Integer

Dim J As Integer

For I=2 to N

   For J = 2 To SqrI

       If I Mod J =0 Then Exit For

   Next  J

If J>Sqi(I) then

     ___idx=idx+1______

redim preserve A(idx)

a(idx)=I

     end if

8.將20個(gè)棋子圍成一圈,按順時(shí)針?lè)较驈?/SPAN>1-20給棋子編號(hào),從中取出棋子的規(guī)則是:從某編號(hào)棋子開始取出第1個(gè)棋子,然后按順時(shí)針?lè)较驀@周數(shù)棋子,從1數(shù)到2取第2個(gè),再?gòu)?/SPAN>1數(shù)到3取第3個(gè),再?gòu)?/SPAN>1數(shù)到4取第4個(gè)……直到取完。本程序的功能就是找出依照上述規(guī)則取棋子的編號(hào)序列,使得最后一個(gè)被取棋子的編號(hào)為指定的編號(hào)。例如:若指定最后取棋子的編號(hào)為9,則必須從編號(hào)為17的棋子開始取第一個(gè)棋子,取棋子的順序是:1719,2,6,11,18……。完善程序,實(shí)現(xiàn)以上功能。

Option base 1

Private sub command1_click()

   Dim a(20) as integer,I as integer,k as integer

   Dim n as integer,number as integer,s as string

   Number=val(text2)

   For k=1 to 20

      For I=1 to20    

          A(i)=1

      Next I

  S=_left(cstr(k) & “--”,3)

  Call sub1(a,k,n,s)

  If n=number then

     Text1=s

     Exit for

  End if

Next k

End sub

Private sub sub1(a() as integer,byval idx as integer,n as integer,s as string)

   Dim I as integer,js as integer,sum as integer

   Dim ub as integer,step as integer

   _____ub=ubound(A)__________

   js=1:stemp=1

  a(idx)=0

  do while js<20

       step=step+1

       ____sum=0_______

       do while sum

                idx=idx+1

               if idx>ub then ____idx =idx mod ub___

               sum=sum+a(idx)

        loop

    a(idx)=0

     s=s & left(cstr(idx) & “ ”,3)

    ____js=js+1______

if js mod 10=0 then s=s & vbcrlf

loop

n=idx

end sub

9C盤根目錄下的數(shù)據(jù)文件data.txt中有兩組數(shù)據(jù),第一組數(shù)據(jù)未排序,并以-1表示該組數(shù)據(jù)結(jié)束;第二組數(shù)據(jù)按從小到大順序排列。下面程序的功能是,單擊“讀入數(shù)據(jù)”按鈕,將文件中的兩組數(shù)據(jù),分別讀入到A、B數(shù)組中,單擊“插入排序”按鈕,則把A數(shù)組的元素按其大小依次插入到B數(shù)組的適當(dāng)位置,使得B數(shù)組中元素仍為從小到大排列。完善程序,實(shí)現(xiàn)以上功能。

Dim a() as integer, b() as integer

Private sub command1_click()

  Dim I as integer,j as integer,n as integer, s as string

     __ open “c:\data.txt” for input as #11__

  do

          input #11,n

          if n=-1 then exit do

          I=I+1

          Redim preserve a(i)

          A(i)=n

          S=s & str(a(i))

  Loop

  Text1=s

   S=””

  ___Do while not eof(1)__

         j=j+1

         redim preserve b(j)

         input #11,b(j)

         s=s & str(b(j))

 loop

 text2=s

close 11

end sub

private sub command2_click()

dim I as integer, j as integer, s as string

for I=1 to ubound(a)

    if a(i)  then

         call change(a(i),1)

    elseif a(i)>b(ubound(b))  then

       ___redim preserve b(ubound(b)+1)___

    b(ubound(b))=a(i)

else

  for j=2 to bound(b)

     if(a(i)>b(j-1))  and a(i)<=b(j)  then call change(a(i),j)

  next j

end if

next I

for I=1 to ubound(b)

     s=s & str(b(i))

next I

text3=s

end sub

private sub change( n as integer,k as integer)

dim I as integer

redim preserve b(ubound(b)+1)

for I=ubound(b)  to k+1 step –1

   _____b(I)=b(I-1)_

next I

____b(k)=n__

end sub