运行下列程序:
Private Sub form_Click( )
Dim sl As String, s2 As String
s1 = "1234"
m = 0
For i = 3 To 1 Step -1
m = m + 1
s2 = fun1(s1, m)
Debug.Print s2;
Next i
End Sub
Private Function fun1(x, y) As String
fun1 = Right(x, y)
End Function
单击窗体后,则在立即窗口内显示结果是( )。
A.1234
B.4321
C.434234
D.1111
第1题:
有如下程序:
Private Sub Form_Click()
Dim i As Integer,Sum As Integer
Sum=0
For i=2 To 10
If i Mod 2<>0 And i Mod 3=0 Then
Sum=Sum+i
EndIf
Next
Print Sum
End Sub
程序运行后,单击窗体,输出结果为
A.12
B.30
C.24
D.18
第2题:
设有如下程序:
Private Sub Form_Click()
Dim n As Integer, s As Integer
n = 8
s = 0
Do
s = s + n
n = n - 1
Loop While n > 0
Print s
End Sub
以上程序的功能是______。程序运行后,单击窗体,输出结果为______。
求1-8的和 36
第3题:
下列程序的执行结果为
Private Sub Command1_Click()
Dim s1 As String, s2 As String
s1= "abcd"
Call Transfer(s1, s2)
Print s2
End Sub
Private Sub Transfer (ByVal xstr As String, ystr As String)
Dim tempstr As String
i=Len(xstr)
Do While i >=1
tempstr=tempstr + Mid(xstr, i, 1)
i=i - 1
Loop
ystr=te mpstr
End Sub( )。
A.dcba
B.abdc
C.abcd
D.dabc
第4题:
在窗体上画一个命令按钮和两个文本框,其名称分别为Command1、Text1和Text2,然后编写如下程序: Dim S1 As String,S2 As String Private Sub Form_Load() Text1.Text="" Text2.Text="" End Sub Private Sub Text1_KeyDown(KeyCode As Integer,Shift As Integer) S2=S2 & Chr(Keycode) End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) S1=S1 & Chr(KeyAscii) End Sub Private Sub Command1_Click() Text1.Text=S2 Text2.Text=S1 S1="" S2="" End Sub 程序运行后,在Text1中输入“abc”,然后单击命令按钮,在文本框Text1和Text2中显示的内容分别为______。
A.abc和ABC
B.abc和abe
C.ABC和abc
D.ABC和ABC
第5题:
设有如下程序:
Private Sub Form_Click()
Dim i As Integer,x As String,Y As String
x=”ABCDEFG”
For i=4 To 1 Step-1
y=Mid(x,i,i)+y
Next i
Print y
End Sub
程序运行后,单击窗体,输出结果为
A.ABCCDEDEFG
B.AABBCDEFG
C.ABCDEFG
D.AABBCCDDEEFFGG
第6题:
阅读下面的程序:
Private Sub Form_Click()
Dim Check As Boolean, Counter As Integer
Check = True
Counter = 5
Do
Do While Counter < 20
Counter = Counter + 1
If Counter = 10 Then
Check = False
Exit Do
End If
Loop
Loop Until Check = False
Print Counter
End Sub
程序运行后,单击窗体,输出结果为______。
10
第7题:
下列程序,当单击窗体时s的值是( )
Private Sub Form_Click()
Dim s As Integer
s = Not 2 * 5<>11
Print s
End Sub
A. True
B. False
C.1
D.0
第8题:
单击窗体时,下列程序的执行结果是
Private Sub Invert(ByVal xstr As String, ystr As String)
Dim tempstr As String
Dim I As Integer
I=Len(xstr)
Do While I >=1
tempstr=tempstr + Mid(xstr, I, 1)
I=I - 1
Loop
ystr=tempstr
End Sub
Private Sub Form_Click()
Dim s1 As String, s2 As String
s1= "abcdef"
Invert s1, s2
Print s2
End Sub( )。
A.abcdef
B.afbecd
C.fedcba
D.defabc
第9题:
下列程序运行时输出的结果是( )。 Option Base 1 Private Sub Form_Click() Const a=6 Dim x (a) As Integer For I=1 to a x(i)=1^2 Next I Print x(i) End Sub
A.36
B.25
C.1
D.出错信息
第10题:
有弹出式菜单的结构如下表,程序运行时,单击窗体则弹出如下图所示的菜单。下面的事件过程中能正确实现这一功能的是( )。
A.Private Sub Form_Click() PopupMenu cut End Sub
B.Private Sub Command1_Click() PopupMenu edit End Sub
C.Private Sub Form_Click() PopupMenu edit End Sub
D.Private Sub Form_Click() PopupMenu cut End Sub