题目内容

有如下程序,运行结果是( )。 Public Function fun(m%, n%) As Integer Do r = m Mod n m = n n = r Loop Until r = 0 fun = m End Function Private Sub Command1_Click() Print fun(12, 44) End Sub

A. 4
B. 程序出错
C. 6
D. 2

查看答案
更多问题

设有以下函数过程 Private Function Fun(a() As Integer, b As String) As Integer … End Function 若有变量声明: Dim x(10) As Integer, n As Integer, ch As String 则下面正确的语句是( )。

A. Call fun x,"ch"
B. x(0) = Fun(x, "ch")
C. n = Fun(x(10), ch)
D. n = Fun(n, ch)

运行程序,单击命令按钮Command1后窗体上输出结果为( )。 Private Sub Command1_Click() Dim p As Integer p = myfun(1) + myfun(2) + myfun(3) Print p End Sub Private Function myfun(n As Integer) As Integer Dim s As Integer For k = 1 To n s = s + k Next myfun = s End Function

A. 15
B. 20
C. 6
D. 10

运行如下程序后,单击命令按钮,如果在输入框中输入字符串“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

答案查题题库