浙江计算机二级VB真题_2006~2010全部真题 详尽答案
2006年秋浙江省高等学校
计算机等级考试试卷(二级Visual Basic)
试题1(每小题3分,共12分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】
•运行时初始界面如左上图所示,在文本框中输入一个整数n并按回车键后:如果n<1则重新输入,否则按钮Command1可用;
•按Command1计算费波那契数列第n项的值(该数列第1、2项均为1,此后各项为该项前两项之和,如:1、1、2、3、5、8、┄);
•用消息框输出结果(右上图表示输入n为8后,输出结果是21),按消息框中“是”按钮则界面显示如左上图,按“否”按钮则退出。【程序】
Dim n As Integer
Private Sub Form_Load()
  Command1.Enabled = False
End Sub
Private Sub Text1_KeyPress(k As Integer)
  If     (1)      明天会更好的原唱 Then Exit Sub
  n = Text1.Text
  If n < 1 Then MsgBox ("n应大于零!"): Exit Sub
  Command1.Enabled = True
End Sub
Private Sub Command1_Click()
  Dim i As Integer
          (2)       
  f(1) = 1: f(2) = 1
  For i =      (3)     
    f(i) = f(i-1) + f(i-2)
  Next i
  k = MsgBox("" & n & "项为" & f(n) & ",是否继续?",   (4)    )
  If k = vbYes Then
    Text1.Text = "" : Command1.Enabled = False
    Text1.SetFocus
  Else
    End
  End If
End Sub
(1) Ak = 13    Bk <> 13              CKeyAscii<>13        DKeyAscii=13
(2) ARedim f(8) As Long              BRedim f(n) As Long
CDim f(n) As Long                  DDim f(8) As Long
(3) A1 To n    B1 To n Step 1      C2 To n            D3 To n
感恩节暖心简短文案(4) AvbNo        BvbYes              CvbYesNo            DvbQuestion
试题2(每小题3分,共15分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】
单击Command1后,将所有在List1中存在、而在List2中不存在的表项添加到列表框控件List3中。
Private Sub Command1_Click()
  Dim i As Integer, j As Integer
        (5)           
  For i = 0 To       (6)         
        For j = 0 To         (7)             
          If List1.List(i) = List2.List(j) Then       (8)       
        Next j
        If   (9)    Then List3.AddItem  List1.List(i)
      Next i
    End Sub
(5) AList3.Clear      BList3.List=""    CList3.delete      DList3.Cls
(6) AList1.ListCount                        BList1.ListCount - 1
    CList2.ListCount                        DList2.ListCount - 1
(7) AList2.ListCount - 1                    BList2.ListCount
    CList1.ListCount – 1                    DList1.ListCount
(8) AExit For            BExit              CExit Do        DBreak
(9) Aj< List2.ListCount                      Bj<= List2.ListCount
    Cj> List2.ListCount                      Dj>= List2.ListCount
试题3深圳服装批发(每小题3分,共15分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】
选择一个图象文件(BMPJPG)后,在图片框控件P1中显示,按“反转”按钮后,将P1中每一像素在P2中相应位置以不同颜显示。男女合唱流行歌曲
【程序】
Private Sub Form_Load()
  File1.     (10)      = "*.bmp;*.jpg"
  P2.Width = P1.Width: P2.Height = P1.Height
  P1.ScaleMode = 3: P2.ScaleMode = 3
End Sub
Private Sub Dir1_Change()
  File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
  Dir1.Path =     (11)     
End Sub
Private Sub File1_Click()
        (12)        GoTo kk
  P1.Picture = LoadPicture(File1.Path + File1.FileName)
  Exit Sub
kk:
  P1.Picture = LoadPicture(File1.Path + "\" + File1.FileName)
End Sub
Private Sub Command1_Click()
  Dim x As Integer, y As Integer,     (13)     
  Dim r As Byte, g As Byte, b As Byte
  For x = P1.ScaleLeft To P1.ScaleLeft + P1.ScaleWidth
    For y = P1.ScaleTop To P1.ScaleTop + P1.ScaleHeight
      c = P1.Point(x, y)
      If c >= 0 Then
        r = c Mod 256: c = c \ 256
        g = c Mod 256: c = c \ 256
            (14)     
        P2.PSet (x, y), RGB(255 - r, 255 - g, 255 - b)
      End If
  Next y, x
End Sub
(10) AFilter          BPattern        CFileName        DPath
(11) ADir1.Path        BFile1.Path    CDrive1.Path    DDrive1.Drive
(12) AOn Error        BIn Error      CIf Error        DIf Error Then
(13) Ac As Byte        Bc As Long      Cc As Single    Dc As Integer
(14) Ab = c Mod 255    Bb = c \ 256    Cb = c          Db = c \ 256
试题4(每小题3分,共9分)
阅读下列程序并回答问题,在每小题提供的若干可选答案中,挑选一个正确答案。【程序】
Private Sub Form_click()
  Dim n As Integer, i As Integer, k As Integer, j As Integer
  Do
    n = InputBox("请输入119之间的整数")
中国四大绿茶品种
  Loop Until 0 < n And n < 10
  k = 10: j = 1
  For i = 1 To n
    Print Space(k); String(j, Trim(Str(i)))
新版天龙八部2021演员表    If i <= n / 2 Then
      k = k - 1: j = j + 2
    Else
      k = k + 1: j = j - 2
    End If
  Next i
End Sub
(15) 若运行时输入n值为2,窗体上的显示结果为:
A 1              B 1          C 1          D 2
  121            222            123            121
(16) 若运行时输入n值为3,窗体上的显示结果为:
A 1              B 1          C 1          D 1
  222            123            12            222
  33333          12321          123              3
(17) 若运行时输入n值为4,窗体上的显示结果为:
A 1              B 1          C 1          D 1
  222            222            123            222

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。