vb程序阅读题与填空题

发布时间 : 星期日 文章vb程序阅读题与填空题更新完毕开始阅读

Unload [9] [10] Sub

[9] [10]

3.设计一个欢迎程序。该程序用户界面如图所示。要求程序运行后,用户选中粗体复选框时 “欢迎您!”几个字的字体变成粗体,用户选中斜体复选框时 “欢迎您!”几个字的字体变成斜体。若取消选中,则恢复原字体。按结束,则退出。

4.任给3个数,求其中间数,写出程序代码。

三、阅读程序题

1.阅读下列程序并写出程序运行结果

Private Sub Form_Click()

Dim s As Long, f As Long, n As Integer, i As Integer n = 3

For i = 1 To n f = f + i s = s + f Next

Print \End Sub

写出程序运行时单击窗体后,窗体Form1上的输出结果。 运行结果:

2.阅读下列程序并写出程序运行结果

Private Sub Command1_Click() x = 0

Do While x < 100

x = (x + 2) * (x + 4) n = n + 1 Loop

Text1.Text = Str(n) Text2.Text = Str(x)

Text3.Text = Val(Text1.Text) + Val(Text2.Text) End Sub

文件框Text3的结果是:

5

运行结果:

3.阅读下列程序并写出程序运行结果 Private Sub Command1_Click()

Dim Sum1 As Integer, Sum2 As Integer Sum1 = 0: Sum2 = 1 For I = 1 To 4 For J = 1 To I Sum2 = Sum2 * J Next J

Sum1 = Sum1 + Sum2 Next I Print Sum1 End Sub

写出程序运行时单击命令按纽后,窗体上的输出结果。 运行结果:

4. 阅读下列程序并写出程序运行结果

Private Sub Command1_Click() Dim x As Integer Static s As Integer

x = Val(InputBox(\请输入一个正整数=\6.阅读下列程序并写出程序运行结果 If x < 6 Then Private Sub Command1_Click() s = s * x Else s = s + x End If

Text1.Text = \End Sub

程序运行时连续3次单击Command1,且设输入 5.阅读下列程序并写出程序运行结果 Private Sub Form_Click() Dim A(1 To 3) As String Dim c As Integer,j As Integer A(1) = “2” A(2) = “4” A(3) = “6” c=0

For j=1 to 3

6

Dim A(2 To 7) As Integer Dim b As Integer For b = 2 To 7 A(b) = b Next b Text1.Text = A(b - 2) End Sub Text1的结果是: 的数据为6、5、4时,分别写出文本框Text1的值。 程序运行后,单击命令按纽文本框 c = c + Val(A(j))

Next j Print c End Sub

写出程序运行时单击窗体后,窗体Form1上的结果: 运行结果:

7.阅读下列程序并写出程序运行结果

Sub test(i As Integer) i = i + 1 End Sub

Private Sub Form_Click() Dim x As Integer x = 4 Print \Call test(x) Print \End Sub

8. 阅读下列程序并写出程序运行结果 Private Sub Form_Click() a = 1: b = 1

Print \ Call mult(a)

Print \End Sub

Private Sub mult(x) x = 2 * x b = 3 * b End Sub

9. 阅读下列程序并写出程序运行结果

Private Sub Form_Click() Dim i As Integer, a As Integer k = 0

For i = 1 To 6 If i > 3 Then

a = a + 4

Else

a = a + 1

7

11. 阅读下列程序并写出程序运行结果 Private Sub Form_Click( ) Static Sum As Integer I=1 While i<=3 Sum=Sum+I I=I+1 Wend Print Sum End Sub 点击两次后,Sum的值应该是: End If Next i Print i, a End Sub

写出程序运行时单击窗体后,Form1上的输出结果。 10. 阅读下列程序并写出程序运行结果

Sub Change(ByVal x As Integer, ByVal y As Integer) Dim t As Integer t=x x=y y=t Print x,y End sub

Private Sub Form_Click() Dim a As Integer, b As Integer a = 3: b = 4 Change a, b Print a,b End Sub

写出程序运行时单击窗体后,Form1上的输出结果 (20) 下列程序段执行结果为 ( ) x=5 y=-6

If Not x>0 Then x=y-3 Else y=x+3 Print x-y; y-x

A) -3 3 B) 5 -9 C) 3 -3 D) -6 5 (23) 单击命令按钮时,下列程序的执行结果为 ( ) Private Sub Command1_Click() Dim x As Integer, y As Integer x=12:y=32 Call Proc(x,y) Print x; y End Sub

Public Sub Proc(n As Integer, ByVal m As Integer) n=n Mod 10 m=m Mod 10 End Sub

8

联系合同范文客服:xxxxx#qq.com(#替换为@)