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) A、k = 13 B、k <> 13 C、KeyAscii<>13 D、KeyAscii=13
(2) A、Redim f(8) As Long B、Redim f(n) As Long
C、Dim f(n) As Long D、Dim f(8) As Long
(3) A、1 To n B、1 To n Step 1 C、2 To n D、3 To n
感恩节暖心简短文案(4) A、vbNo B、vbYes C、vbYesNo D、vbQuestion
试题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) A、List3.Clear B、List3.List="" C、List3.delete D、List3.Cls
(6) A、List1.ListCount B、List1.ListCount - 1
C、List2.ListCount D、List2.ListCount - 1
(7) A、List2.ListCount - 1 B、List2.ListCount
C、List1.ListCount – 1 D、List1.ListCount
(8) A、Exit For B、Exit C、Exit Do D、Break
(9) A、j< List2.ListCount B、j<= List2.ListCount
C、j> List2.ListCount D、j>= List2.ListCount
试题3深圳服装批发(每小题3分,共15分)阅读下列程序说明和程序,在每小题提供的若干可选答案中,挑选一个正确答案。【程序说明】
选择一个图象文件(BMP、JPG)后,在图片框控件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) A、Filter B、Pattern C、FileName D、Path
(11) A、Dir1.Path B、File1.Path C、Drive1.Path D、Drive1.Drive
(12) A、On Error B、In Error C、If Error D、If Error Then
(13) A、c As Byte B、c As Long C、c As Single D、c As Integer
(14) A、b = c Mod 255 B、b = c \ 256 C、b = c D、b = 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("请输入1个1至9之间的整数")
中国四大绿茶品种 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小时内删除。
发表评论