运行如下程序后,单击命令按钮,如果在输入框中输入字符串“abcde”,则在窗体上输出结果是( )。 Public Function fun(s As String) As String Dim s1 As String For i = Len(s) To 1 Step -1 s1 = UCase(Mid(s, i, 1)) + s1 Next fun = s1 End Function Private Sub Command1_Click() Dim str1 As String, str2 As String str1 = InputBox("请输入一个字符串") str2 = fun(str1) Print str2 End Sub
ABCDE
B. EDCBA
C. abcde
D. edcba
查看答案
运行程序,单击命令按钮Command1后窗体上输出结果是( )。 Function f(x As Integer) As Integer x = x / 2 f = x End Function Private Sub Command1_Click() Dim a As Integer a = 10 Print a + f(a) End Sub
A. 5
B. 20
C. 10
D. 15
有如下程序,运行结果是( ) 。 Public Function f(m%, n%) Do While m <> n Do While m > n m = m - n Loop Do While n > m n = n - m Loop f = m Loop End Function Private Sub Command1_Click() Print f(24, 18) End Sub
A. 3
B. 0
C. 2
D. 6
运行程序,单击命令按钮Command1后窗体上输出结果是( )。 Function f(x As Integer) As Integer x = x / 2 f = x End Function Private Sub Command1_Click() Dim a As Integer a = 8 Print f(a + f(a)) End Sub
A. 10
B. 6
C. 8
D. 4
运行程序,单击命令按钮Command1后窗体上输出结果是( )。 Function F(a As Integer) Static c b = b + 1 c = c + 1 F = a + b + c End Function Private Sub Command1_Click() Dim i As Integer For i = 1 To 3 Print F(i); Next i Print End Sub
A. 4 5 6
B. 3 4 5
C. 4 6 8
D. 3 5 7