第1章 VB6.0概述 答案 一、判断题
1——5 : ××√×√ 6——10: ××√√√ 11――15: √×××√ 二、选择题
1——5:ADBBB 6——10: CACDB 11—-14:CDCC 三、程序设计题 略
第2章 VB6.0语言基础 答案 一、判断题
1——5 : ×××√× 6——10: ×××√√ 11——14 ×××× 二、选择题
1——5:ABCDA 6——10: ABDBB 11-15: AADBB 三、填空题
1.a?bb?d?ce2ab
2. int(900*rnd)+100
3. sin(65/180*3.14159)+2*3.14159*sqr(x+2*exp(y))/(x-y)
4.BCD 5.6 6. Byte 7.5*5
第3章 顺序文件 一、程序阅读
1. A=2 B=1 C=2 2. 12
二、选择题
1.D 2.A 3. C 4.A 6.A 7.A 8. D 三、略
第四章 选择结构程序设计
一、选择题
1.A 2. D 3.A 4.B 5.A 6.A 二、程序阅读 1. -9 2. w=4
w=13 w=135 w=31 3. s=1 s=2 s=5 s=20
三、程序填空题 1.
(1) max (2)min (3)c>max (4)c (5) x mod 3=2 and x mod 5=3 and x mod 7=4 then (6) text1.text=”” 五、程序设计题 1. Private Sub Command1_Click() Dim y As Integer y = Val(InputBox(\ If (y Mod 4 = 0 And y Mod 100 <> 0) Or (y Mod 400 = 0) Then Print \是闰年\ Else Print \不是闰年\ End If End Sub 2、 Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer, t As Integer a = Val(InputBox(\b = InputBox(\c = InputBox(\ If a > b Then t = a: a = b: b = t If a > c Then t = a: a = c: c = t If b > c Then t = b: b = c: c = t Print a; b; c End Sub 3. Private Sub Command1_Click() Dim x!, y! x = Val(InputBox(\ If x < 0 And x <> -3 Then y = x * x + x – 6 elseIf 0 <= x And x < 10 And x <> 2 And x <> 3 Then y = x *sin(x) +2^ x else y=sqr(x+5)+log(x+4)/log(10) End If Print \End Sub 第5章 循环结构程序设计 一、判断题 1——6: √×√××× 二、选择题 1——6: BCCCDA 三、程序阅读 1、 88 6886 458864 24588642 2、 2 12 3、 D 4、 1(第一次输入7后) 7(第2次输入8后) 5、 2 2 3 5 四、程序填空 (1) while n<0 or n>30 (2) k=0 (3) sum+1/(k*(k+1)) (4) len(str1) (5) length-1 (6) mid(str1,i,2) (7) sum=0 (8) Sign=1 (9) For I=2 to 19 (10) (11) (12) (13) (14) (15) (16) (17) Sign=-sign While m<=len(str1)/2-1 mid(str1,m+1,1) mid(str1,len(str1)-m,1) B A D A 五、程序设计 1. Private Sub Command2_Click() Dim x As Single, s As Single, t As Long, i As Integer s = 0: t = 1 n = Val(InputBox(\x = Val(InputBox(\For i = 2 To n t = t * i s = s + (-1) ^ (i) * x / t Next i Print \ End Sub 2. Private Sub Command3_Click() Dim i As Integer Dim a As Integer, b As Integer, c As Integer i = 100 Do While i <= 999 a = i Mod 10 b = i \\ 10 Mod 10 c = i \\ 100 If i = a ^ 3 + b ^ 3 + c ^ 3 Then Print i i = i + 1 Loop End Sub 3. Private Sub Command3_Click() Dim i As Integer, e As Single, item As Single i = 1: e = 1: item = 1 '变量赋初值 Do item = item / i e = e + item i = i + 1 Loop While abs(item-item/I) >= 0.0001 Print \End Sub 4. Private Sub Command4_Click() Dim x As Integer, k As Integer, i As Integer,c as integer i = 2 : c=1 for j= 1 to 100 x=int(rnd*990+10) k = Int(Sqr(x)) Do While i <= k If x Mod i = 0 Then Exit Do i = i + 1 Loop If i > k Then Print x; C=c+1 If c mod 5= 0 then print End If Next j Print “总共有:”+str(c)+”个素数” End Sub 5. Private Sub Command5_Click() Dim i As Integer, j As Integer For i = 1 To 5 Print space(20 - i); For j = 1 To 2 * i - 1 Print Trim(Str(i)); Next j Print Next i For i = 6 To 9 Print space(10 + i); For j = 1 To 19 - 2 * i Print Trim(Str(i)); Next j Print Next i End Sub 第6章 数组 一、判断题