题目内容

运行程序,单击窗体后输出结果是( )。 Public Function fun(s As String) As String Dim tStr As String, n As Integer tStr = "" n = Len(s) i = 1 Do While i <= n / 2 tStr = tStr & Mid(s, i, 1) & Mid(s, n - i + 1, 1) i = i + 1 Loop fun = tStr End Function Private Sub Form_Click() Dim s1 As String s1 = "abcdef" Print UCase(fun(s1)) End Sub

AFBECD
B. abcdef
C. DEFABC
D. ABCDEF

查看答案
更多问题

阅读程序: Function fac(ByVal n As Integer) As Integer Dim temp As Integer temp = 1 For i = 1 To n temp = temp * i Next fac = temp End Function Private Sub Form_Click() Dim nsum As Integer, i As Integer nsum = 1 For i = 2 To 4 nsum = nsum + fac(i) Next Print nsum End Sub 程序运行后,单击窗体,输出结果是( )。

A. 33
B. 31
C. 35
D. 32

设有如下说明: Public Function F1(n%) …… n = 3 * n + 4 …… End Function Private Sub Command1_Click() Dim n%, m n = 3: m = 4 …… '调用F1语句 …… End Sub 则在Command1_Click事件中无效的调用语句是( )。

A. F1 (m)
B. F1 (5 )
C. F1 (5+m)
D. F1(n+m)

在窗体上画一个名称为Command1的命令按钮,然后编写如下通用过程和命令按钮的事件程序: Private Function fun(ByVal m As Integer) If m Mod 2 = 0 Then fun = 2 Else fun = 1 End If End Function Private Sub Command1_Click() Dim i As Integer,s As Integer s = 0 For i = 1 To 5 s = s + fun(i) Next Print s End Sub 程序运行后,第一次单击命令按钮时,x的结果为( )。

A. 5
B. 7
C. 11
D. 9

要想从子过程调用后返回两个结果,下面子过程说明语句合法的是( )。

A. Sub f1(ByVal n%, m%)
B. Sub f1(n%, m%)
C. Sub f1(n%, ByVal m%)
D. Sub f2(ByVal n%, ByVal m%)

答案查题题库