VB试卷08答案

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

盐城师范学院
___年___学期《Visual Basic程序设计教程》期___考试试卷答案
试卷代号:___VB08__
第一部分:笔试试卷
一、选择题(每题1分,计35分。


二、填空题(每空1分,计25分。


(1) ”请输入半径” (2) ”输入对话框”
(3) 10 (4) 11
(5) 5 (6) 4 8 (7) 12 86 (8) 4 (9) 5 (10) 6
(11) 3 5 (12) 14 8
(13) open “data1.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) s=sum (22) slen=len(char) (23) j=j*10 (24) int((1+s)/2)
(25) f=ture
第二部分:上机试卷
一、改错题(17分)
Option Explicit
Private Sub Form_Click()
Dim a() As Single, i As Integer
Dim y As Single
i = 1
Do
ReDim a(i) 改为ReDim Preserve a(i)
a(i) = 1 / fib(i)
If a(i) <= e-4 Then Exit Do 改为:1e-4
y = y + a(i)
i = i + 1
Loop
Print "y="; y
For i = 1 To UBound(a)
Print a(i)
Next i
End Sub
Private Function fib(i As Integer) As Integer
If i = 1 Then
fib = 1
ElseIf i = 2 Then
fib = 2
Else
fib(i)=fib(i-1)+fib(i-2) 改为:fib = fib(i - 1) + fib(i - 2 End If
End Function
二、编程题(23分)
Private Sub Command1_Click()
Dim a As Single, b As Single, c As Single, d As Single
Dim x1 As Single, x2 As Single
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
d = b * b - 4 * a * c
If d < 0 Then
MsgBox ("方程无实根") Else
x1 = (-b + Sqr(d)) / (2 * a)
x2 = (-b - Sqr(d)) / (2 * a)
Text4.Text = Str(x1)
Text5.Text = Str(x2)
End If
End Sub
Private Sub Command2_Click() Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Command3_Click() End
End Sub。

相关文档
最新文档