运行程序,单击命令按钮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
查看答案
设有一个命令按钮Command1的事件过程以及一个函数过程。程序如下: Private Sub Command1_Click() Static x As Integer x = f(x + 5) Cls Print x End Sub Private Function f(x%) As Integer f = x + x End Function 连续单击命令按钮3次,第3次单击命令按钮后,窗体上显示的计算结果是( )。
A. 70
B. 60
C. 30
D. 10
设有一个命令按钮Command1的事件过程以及一个函数过程。程序如下: Private Sub Command1_Click() Static x As Integer x = f(x + 3) Cls Print x End Sub Private Function f(x%) As Integer f = x + x End Function 连续单击命令按钮3次,第3次单击命令按钮后,窗体上显示的计算结果是( )。
A. 6
B. 18
C. 42
D. 12
运行程序,单击命令按钮Command1后窗体上输出结果是( )。 Private Function fun1(str$, ch$) As String Dim k As Integer Dim temp As String, s As String s = "" For k = 1 To Len(str) temp = Mid(str, k, 1) If temp = ch Then s = s & temp End If Next k fun1 = s End Function Private Sub Command1_Click() Dim str As String, ch As String str = "ABCABC" ch = "B" Print fun1(str, ch) End Sub
A. BB
B. ACAC
C. 程序出错
D. AA
运行程序,单击窗体后输出结果是( )。 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