更多"编写如下事件过程: Option Explicit Private"的相关试题:
[单项选择]编写如下事件过程: Option Explicit Private Sub Form_Click( ) Dim Str As String, I As Integer Open "examp" For Output As 1 For I=1 To 5 Str=Chr(I+64) Print #1,Str; Next I Close 1 Open”examp’,For lnput AS 2 Str=Input(10,#2) Print Str; Close 2 End Sub 程序运行后,单击窗体,则窗体上显示的内容是
A. ABCDE
B. 96
C. 65
D. abcde
[单项选择]编写如下事件过程:
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)
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_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 Command1_Click( )
Dim a As Variant
a= Array (1,2,3,4)
j=1
for i=a To 1 Step-1
s=s+ a(i)*j
j=j*10
Next i
Print s
End Sub
运行上面的程序,单击命令按钮,其输出结果是______ 。
A. 4321
B. 12
C. 34
D. 1234
[单项选择]编写如下事件过程: Private Sub FOrm_ MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then Pint "AAAA" Then End If End Sub Private Sub Form_ MouseUp (Button As Integer, _ Shift As Integer, X As Single, Y As Single) Print "BBBB" End Sub程序运行后,如果在窗体上单击鼠标右键,则输出结果为______ 。
A. AAAA BBBB
B. BBBB
C. AAAA
D. BBBB AAAA
[单项选择]编写如下事件过程: Private Sub Form_ MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single) If Shift = 6 And Button = 2 Then Print “Hello” End If End Sub 程序运行后,为了在窗体上输出“Hello”,应在窗体上执行以下______ 操作。
A. 同时按下Shift键和鼠标左按钮.
B. 同时按下Shift键和鼠标右按钮
C. 同时按下Ctrl、Alt键和鼠标左按钮
D. 同时按下Ctrl、Alt键和鼠标右按钮
[单项选择]编写如下事件过程:
Private Sub Form MouseDown(Button As Integer,Shift As Integer,X As Single, Y As Single)
If Shift=6 And Button=2 Then
Print "BBBB"
End If
End Sub
程序运行后,为了在窗体上输出“BBBB”,应执行的操作为
A. 同时按下Shift键和鼠标左键
B. 同时按下Ctrl、Alt键和鼠标右键
C. 同时按下Shift键和鼠标右键
D. 同时按下Ctrl、Alt键和鼠标左键
[单项选择]编写如下事件过程:
Private Sub Form KeyDown (KeyCode As Integer, Shift As Integer)
Print Chr (KeyCode)
End Sub
Private Sub Form_KeyPress( KeyAscii As Integer)
Print Chr(KeyAscii)
End Sub
在一般情况下(即不按住Shift键和锁定大写键时)运行程序,若按“T”键,则程序输出的结果是
A. T
B. t
C. T
D. t
[单项选择]编写如下事件过程和函数过程:
Private Sub Command1_Click( )
Dim num(1 To 6) As Single
num(1)=103: num(2)=190: num(3)=0
hum(4)=32:num(5)=-56: num(6)=100
Print
Print p2(6,num( ))
End Sub
Private Function p2(ByVal n As Integer, number( ) As Single) As Integer
p2=number(1)
For j=2 To n
If number(j)<p2 Then p2=number(j)
Next j
End Function
程序运行后,在窗体上输出( )。
A. -56
B. 0
C. 103
D. 190
[单项选择]编写如下事件过程:
Private Sub Form_Activate( )
Dimscore(1 to 3)As Integer
Dimi As Integer
Dim t As Variant
Fori= 3 To 1 Step-1
score(i)=2*i
Nexti
ForEach t Inscore
Printt
Next
End Sub
程序运行后窗体上显示的值是( )。
A. 642
B. 246
C. 2
D. 6
[单项选择]编写如下事件过程: Private Sub Form Click( ) Dim Char As String,i As Integer Const ch$="#" msg$= "Enter a String:" char=InputBox$(msg$) n=Len(Char) For i=1 To n If Mid$(char,i,1)=ch$ Then Exit For End If Next i Print i - 1 End Sub 其中InputBox函数的功能是弹出一个输入对话框,按所给参数给出提示,等待用户输入,并返回输入的内容。程序运行后,单击窗体,如果在输入对话框内输入字符串“12ab$%*/#fg”,则窗体上输出
A. 2
B. 2
C. 5
D. 8
[单项选择]编写如下事件过程:
Private Sub Form Mouse Down(Button As Integer,Shift As Integer,X As Single,
Y As Single)
If Shift=6 And Button=2 Then
Print"BBBB"
End If
End Sub
程序运行后,为了在窗体上输出"BBBB",应执行的操作为_______。
A. 同时按下Shift键和鼠标左键
B. 同时按下Shift键和鼠标右键
C. 同时按下Ctrl、Alt键和鼠标左键
D. 同时按下Ctrl、Alt键和鼠标右键