举一反三
- 有以下程序: Private Sub Form_Activate() Fori=1 to 3 x=3 For i=i to 2 x=x+6 Next Next Print X End Sub 程序运行后,窗体上显示的结果为________
- 在窗体上添加一个命令按钮Command1,然后编写如下事件过程: Private Sub Command1_Click() For i = 1 To 4 x = 4 For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 Next k Next j Next i Print x End Sub 程序运行后,单击命令按钮,显示结果为( )。
- 运行下面的程序,第二行显示结果是___________。 Private Sub Form_Click() Dim A As Integer Dim i As Integer A = 5 For i = 1 To 9 Call sub1(i, A) Print i, A Next i End Sub Private Sub sub1(x As Integer, y As Integer) Static N As Integer Dim I As Integer For I = 3 To 1 Step -1 N = N + x x = x + 2 Next I y = y + N End Sub
- 下面程序的运行结果是 Private Sub Command1_Click() x=1:y=1 For i=1 To 3 x=x+y:y=y+x Next i:print x,y End Sub A: 6 6 B: 5 8 C: 13 21 D: 34 35
- Public Sub Proc(a%( )) Static i% Do a(i) = a(i) + a(i + 1) i = i + 1 Loop While i < 2 End Sub Private Sub Command1_Click( ) Dim m%, i%, x%(10) For i = 0 To 4: x(i) = i + 1: Next i For i = 1 To 2: Call Proc(x): Next i For i = 0 To 4: Print x(i);: Next i End Sub A: 3 4 7 5 6 B: 3 5 7 4 5 C: 2 3 4 4 5 D: 4 5 6 7 8
内容
- 0
下列程序运行时输出的结果是 Option Base 1 Private Sub Form_Click() Dim x (10)As Integer,y(5)As Integer For i=1 to 10 x(i)=10-i+1 Next For i=1 to 5 y(i)=x(2*i-1)+x(2*i) Next For i=1 to 5 Print y(i) Next End Sub A.3 7 11 45 19 B.19 15 11 7 3 C.1 3 5 7 9 D.不确定的值
- 1
在窗体上画一个命令按钮<其名称为Command1),然后编写如下事件过程: Private Sub Command1 Click() For i=1 T04 If i=1 Thenx=i If i<=4 Then x=x+1 Print x Next i End Sub 程序运行后,单击命令按钮;其输出结果为 ______。 A: A) 1 2 3 4 B: B) 2 3 4 5 C: C) 2 3 4 4 D: D) 3 4 5 6
- 2
运行下列程序,单击窗体后显示结果为( )。 Private Sub Form_Click() Dim k As Integer For k = 1 To 2 Print "3" + k; "3" & k; Spc(3); Next End Sub
- 3
运行下列程序,单击窗体显示的结果为( )。 Private Sub Form_Click() Dim a Dim s As Integer, i As Integer a = Array(1, 2, 3) For i = 2 To 0 Step -1 s = s + a(i) * a(i) Next i Print s End Sub
- 4
在窗体中有1个命令按钮Command1和1个文本框Text1,编写事件代码如下:Private Sub Command1_Click() For i=1 To 4 x=3 For j=1 To 3 For k=1 To 2 x=x+3 Next k Next j Next i Text1.Value=Str(x) End Sub 打开窗体运行后,单击命令按钮,文本框Text1输出的结果是