更多"编写如下事件过程: Option Base 1 Private S"的相关试题:
[单项选择]编写如下事件过程: Option Base 1 Private Sub Form Click( ) Dim x1( )As Integer Dim i As Integer Dim s As Integer ReDim x1(3) For i = 1 To UBound(x1) x1(i)=i + 1 Next i Call sub1(x1) For i = 1 To UBound(x1) s = s + x1(i) Next i Print s End Sub Private Sub sub1(n( )As Integer) Dim i As Integer ReDim Preserve n(5) For i = 3 To 5 n(i)=n(i-1)*2 Next i End Sub 程序运行后,单击窗体,则窗体上显示的内容是
A. 6
B. 12
C. 24
D. 47
[单项选择]对窗体编写如下代码: Option Base 1 Private Sub Form_ KeyPress (KeyAscii As Integer) a=Array(237,126,87,48,498) m1=a(1) m2=1 If KeyAscii=13 Then For i=2 To 5 If a(i)>m1 Then m1=a(I) m2=i End If Next i End If Print m1 Print m2 End Sub 程序运行后,按回车键,输出结果为______ 。
A. 48 4
B. 237 1
C. 498 5
D. 498 4
[单项选择]对窗体编写如下事件过程:
Option Base 1
Private Sub Form_KeyPress (KeyAScii AS Integer)
arr=Array(12,15,18,20,24)
m1=arr(1)
m2=1
If fKeyAscii=12 Then
For i=2 To 5
If arr(i)>m1 Then
m1=arr(i)
m2=i
End If
Next i
End If
Print m1
Print m2
End Sub
程序运行之后按回车键,输出结果为( )。
[单项选择]阅读如下程序:
Option Base 1
Private Sub Form Click( )
Dim Arr(4,4)As Integer
For i=1 To 4
For j=1 To 4
Arr(i,j)=(i-1)*2+j
Next j
Next i
For i=3 To 4
For j=3 To 4
Print Arr(j,i);
Next j
Print
Next i
End Sub
程序运行后,单击窗体,输出的结果为
A. 5 7 6 8
B. 6 8 7 9
C. 7 9 8 10
D. 8 10 8 11
[单项选择]有如下程序: Option Base 1 Private Sub Form Click( ) Dim arr,Sum Sum=0 alt=Array(1,3,5,7,9,11,13,15,17,19) For i=1 To 10 If arr(i)/3=arr(i)/3 Then Sum=Sum+arr(i) End If Next i Print Sum End Sub 程序运行后,单击窗体,输出结果为______。
A. 25
B. 26
C. 27
D. 28
[单项选择]对窗体编写如下事件过程: Option Base 1 Private Sub Form_KeyPress (KeyAScii AS Integer) arr=Array(12,15,18,20,24) m1=arr(1) m2=1 If fKeyAscii=12 Then For i=2 To 5 If arr(i)>m1 Then m1=arr(i) m2=i End If Next i End If Print m1 Print m2 End Sub 程序运行之后按回车键,输出结果为
A. 12
B. 20
C. 18
D. 24
[单项选择]现有程序如下:
Option Base 1
Private Sub Form_Click( )
Dim x(5, 6)As Integer, y(5)As Integer
For i = 1 To 5
For j =1 To 6
x(i, j) = Int(Rnd * 9+1)
Next j
Next i
Call f(5, 6, x, y)
For i=1 To 5
Print y(i);
Next i
End Sub
Sub f(m As Integer, n As Integer, a( )As Integer, b( )As Integer)
For i = 1 To m
b(i) =0
For j = 1 To n
b(i) =b(i) +a(i, j)
Next j
Next i
End Sub
关于上述程序,以下叙述中正确的是( )。
A. 调用过程语句有错,参数不匹配
B. 程序有错,数组下标越界
C. y数组中保存的是x数组每行数据之和
D. x数组中数据的取值范围是1-10
[单项选择]设有如下程序:
Option Base 0
Private Sub Form_Click( )
Dim a
Dim i As Integer
a=Array(1,2,3,4,5,6,7,8,9)
For i=0 To 3
Print a(5-i)
Next
End Sub
程序运行后,单击窗体,则在窗体上显示的是
A. 4 3 2 1
B. 54 3 2
C. 6 5 4 3
D. 7 6 5 4