网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

在窗体中有1个命令按钮,对应的事件代码如下。单击命令按钮时,输出的结果是()。 Private Sub Commandl_Click() Dim s As Integer s = f (1) + f (2) + f (3) Debug.Print s End Sub Public Function f(n As Integer) As Integer Dim i As Integer f = 0 For i = 1 To n f = f + i Next i End Function

A.1

B.3

C.6

D.10


参考答案和解析
1
更多 “在窗体中有1个命令按钮,对应的事件代码如下。单击命令按钮时,输出的结果是()。 Private Sub Commandl_Click() Dim s As Integer s = f (1) + f (2) + f (3) Debug.Print s End Sub Public Function f(n As Integer) As Integer Dim i As Integer f = 0 For i = 1 To n f = f + i Next i End FunctionA.1B.3C.6D.10” 相关考题
考题 在窗体上画1个命令按钮,其名称为Command1,然后编写如下程序: Private Sub Command1 Click() Dim a(10) As Integer Dim x As Integer For i=1 To 10 a(i)=8+i Next x=2 Print a(f(x)+x) End Sub Function f(x As Integer) x=x+3 f=x End Function 程序运行后,单击命令按钮,输出结果为______。A.12B.15C.17D.18

考题 在窗体上画1个命令按钮,名称为Command1,然后编写如下程序: Dim Flag As Boolean Private Sub Command1_Click() Dim intNum As Integer intNum=InputBox(“请输入:”) If Flag Then Print f(intNum) End If End Sub Function f(X as Integer)As Integer If X<10 Then Y=X Else Y=X+10 End If f=Y End Function Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X as Single,Y As Single) Flag=True End Sub 运行程序,首先单击窗体,然后单击命令按钮,在输入对话框中输入5,则程序的输出结果为______。A.0B.5C.15D.无任何输出

考题 在窗体上画一个名称为Commandl的命令按钮,然后编写如下通用过程和命令按钮的事件过程: Private Function fun(By Val m As Integer) If m Mod 2=0 Then fun=2 Else fun=1 End If End Function Private Sub Commandl_Click() Dim i As Integer,s As Integer s=0 For i=1 To 5 s=s+fun(i) Next Print s End Sub 程序运行后,单击命令按钮,在窗体上显示的是______。A. 6B.7C.8D.9

考题 在窗体中有一个命令按钮command1,编写事件代码如下: Private Sub Command1_Click() Dim s As Integer s=P(1)+P(2)+P(3)+P(4) Debug.Print s End Sub Public Function P(N As Integer) Dim Sum As Integer Sum=0 For i=1 To N Sum=Sum+1 Next i P=Sum End Function 打开窗体运行后,单击命令按钮,输出的结果是( )。A.15B.20C.25D.35

考题 在窗体上有一个命令按钮Commandl,通用过程fun和命令按钮的事件过程如下: Private Function fun(By m As Integer) If m Mod 2=0 Then fun=2 Else Fun=1 Else If End Funcion Private Sub Commandl_Click() Dim i Integer,s As Integer s=0 For i=1 To 5 s=s+fun(i) Next Print s End Sub 程序运行后,单击命令按钮,则窗体上输出A.6 B.7 C.8 D.9

考题 设有如下程序: Private Sub Form. Click( ) Dim s As Long,f As Long Dim n As Integer,i As Integer f=1 n=4 For i=1 To n f=f*i s=s+f Next i Print s End Sub 程序运行后,单击窗体,输出结果是( )。A.32B.33C.34D.35

考题 阅读下列程序: Function func(n As Integer)As Integer Sum = 0 For i = 1 To n Sum = Sum + (i + 1)* i Next i func = Sum End Function.Private Sub Command1_Click () Dim a As Integer a= 5 s = func (A)Print s End Sub 程序运行后,单击命令按钮,输出的结果为A.80B.60C.70D.15

考题 在窗体中有一个命令按钮Commandl,编写事件代码如下:Private Sub Commandl Click( ) Dim S As Integer s=p(1)q+p(2)q+p(3)+p(4) debu9.Print S End Sub Public Function P(N As Integer) Dim Sum As IntegerSum==0 For i=1 To N Sum=Sum+1 Next i P=Sum End Function 打开窗体运行后,单击命令按钮,输出的结果是( )。A.15B.20C.25D.35

考题 在窗体中添加一个名称为Command1的命令按钮,然后编写如下代码: Function F(a As Integer) b=0 Static c b=b+1 c=c+1 F=a+b+c End Function Private Sub Command1 Click() Dim a As Integer Dim b As Integer a=2 For i=1 To 3 b=F(A) Print b Next i End Sub 程序运行后,如果单击按钮,则在窗体上显示的内容是A.4 4 4B.4 5 6C.5 6 7D.5 5 5

考题 有如下程序: Function F(a As Integer) b = 0 Static C b = b + 1 c = c + 2 F = a + b + c End Function Private Sub Command1_Click() Dim a As Integer a = 2 For i=1 To 3 Print F(a); Next i End Sub 运行上面的程序,单击两次命令按钮,在窗体上输出结果为A.4 4 4B.4 5 6C.5 7 9D.11 13 15

考题 设有如下程序: Private Static Function Fac(n As Integer)As Integer Dim f As Integer f=f+n Fac=f End Function Private Sub Form_Click( ) Dim I As Integer For 1=2 To 3 Print"#";I“=”Fac(1) Next I End Sub 程序运行后,单击窗体,在窗体上显示的是A.#2=2 #3=3B.#2=2 #3=5C.#;2=2 #;3=3D.#;2=2 #3;=5

考题 现有如下程序: Private Sub Command1_Click() s=0 For i=1 To 5 s=s+f(5+i) Next Print s End Sub Public Function f(x As Integer) If x>=10 Then t=x+1 Else t=x+2 End If f=t End Function 运行程序,则窗体上显示的是( )。A.38B.49C.61D.70

考题 有如下函数过程: Function lj(x As Integer) As Long Dim s As Long Dim i As Integer s=0 For i = 1 To x s=s+ i Next i 1j= s End Function在窗体上添加一个命令按钮,名为Command1, 编写事件过程调用该函数: Private Sub Command1 Click() Dim i As Integer Dim sum As Long For i = 1 To 5 sum = sum + 1j(i) Next i Print sum End SubA. 25B.35C.45D.55

考题 在窗体上绘制一个名称为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 程序运行后,单击命令按钮,在窗体上显示的是A.6B.7C.8D.9

考题 在窗体上画一个名称为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_C1ick() Dim i As Integer, s As Integer s=0 For i=1 To 5 s=s+fun(i) Next Print s End Sub 程序运行后,单击命令按钮,在窗体上显示的是______。A.6B.7C.8D.9

考题 在窗体中添加—个名称为Command1的命令按钮,然后编写如下代码: Function F(a As Integer) b=0 Static c b=b+1 C=c+1 F=a+b+c End Function Private Sub Command1_Click( ) Dim a As Integer Dim b As Integer a=2 For i=l To 3 b=F(A)Print b Next i End Sub 程序运行后,如果单击按钮,则在窗体上显示的内容是A.4 4 4B.4 5 6C.5 6 7D.5 5 5

考题 阅读程序: Function F(a As Integer) b=0 Static c b=b+1 c=c+1 F=a+b+c End Function Private Sub Command1_Click() Dim a As Integer a=2 For i=1 To 3 Print F(A)Next i End Sub 运行上面的程序,单击命令按钮,输出结果为 ______。A.4 4 4B.4 5 6C.4 6 8D.4 7 9

考题 在窗体上画一个命令按钮,然后编写如下事件过程: Sub BTC(old Copy( ) As Integer,new Copy( ) As Integer) Dim i AS Integer For i=LBound(oldCopy( ))To UBound(oldCopy( )) newCopy(i)=oldCopy(i) Next i End Sub Private Sub Command1 _ Click( ) Dimm(10) As Integer,n(10)As Integer For i=1 To 10 m(i) =i*i Next i Call BTC(m,n) Print n(5) End Sub 程序运行后,单击命令按钮输出结果为A.0B.2C.10D.25

考题 编写如下事件过程: Option Base 1 Private Sub Form Click() Dim x1()As Integer Dim i As Integer Dim s As Integer ReDim x1(3) For i = 1 To UBound(x1) x1(i)=i + 1 Next i Call sub1(x1) For i = 1 To UBound(x1) s = s + x1(i) Next i Print s End Sub Private Sub sub1(n()As Integer) Dim i As Integer ReDim Preserve n(5) For i = 3 To 5 n(i)=n(i-1)*2 Next i End Sub 程序运行后,单击窗体,则窗体上显示的内容是A.6B.12C.24D.47

考题 在窗体上画一个名称为Command1的命令按钮,然后编写如下通用过程和命令按钮的事件过程: Private Function f(m As Integer) If m Mod 2 = 0 Then f = m Else f = 1 End If End Function Private Sub Command1_Click() Dim i As Integer s = 0 For i = 1 To 5 s = s + f(i) Next Print s End Sub 程序运行后,单击命令按钮,在窗体上显示的是A. 11B.10C.9D.8

考题 窗体中有命令按钮Commandl,事件过程如下: PublicFunction f(x As Integer)As Integer Dim Y AsInteger X=20 y=2 f= X *Y End Function PrivateSub Commandl_Click( ) Dim y As Integer static x As Integer x=10 y=5 y=f(x) Debug.Print x;y End Sub 运行程序,单击命令按钮,则立即窗口中显示的内容是( )A.10;5B.10;40C.20;5D.20;40

考题 在窗体上画一个名称为Commandl的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim n As Integer For n = 0 To 9 Step 3 Print rel(n); Next n End Sub Private Function rel(ByVal i As Integer)As Integer Dim x As Integer x = 0 For j = 1 To i If i < 5 Then rel = i: EXit Function x = x + i Next i rel = x End Function 程序运行后,单击命令按钮,则窗体上显示的内容是A.1 3 5 7B.2 8 14 53C.0 3 21 45D.0 5 11 34

考题 在窗体上画一个命令按钮,其名称为Commandl,然后编写如下程序: Pfivate Sub Commandl_Click() Dima(10) As Integer Dimx As Integer Fori=1 To 10 a(i)=8+i NeXt X=2 Print a(f(x)+x) End Sub Function f(X As Integer) X=X+3 f=X End FuA.12B.15C.17D.18

考题 在窗体上有一个命令按钮Command1,通用过程fun和命令按钮的事件过程如下: 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_Cliek() Dim i As Integer, s As Integer s=0 For i=1 To 5 s=s+fun(i) Next Print s End Sub 程序运行后,单击命令按钮,则窗体上输出( )。A.6B.7C.8D.9

考题 阅读程序: Function F(a As Integer) b=0 Static c b=b+1 c=c+1 f=a+ b+ c End Function Private Sub Command1_Click() Dim S As Integer a=2 For i=1 To 3 Print P(A) Next i End Sub运行上面的程序,单击命令拄钮,输出结果为______ 。A.4 4 4B.4 5 6C.4 6 8D.4 7 9

考题 设有一个命令按钮Command1的事件过程以及一个函数过程。程序如下: Private Sub Command1 Click( ) Static x A S Integer x=f(x+5) Cls Print X End Sub Private Function f(x As Integer)As Integer f=x+x End Function 连续单击命令按钮3次,第3次单击命令按钮后,窗体显示的计算结果是( )。A.10B.30C.60D.70

考题 在窗体上画一个名称为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 3 End Sub 程序运行后,单击命令按钮,在窗体上显示的是A.6B.7C.8D.9

考题 阅读程序: Function F(a As-Integer) b=0 Static c b=b+1 c=c+1 F=a+b+c End Function Private Sub Command1_Click() Dim a As Integer a=2 For i=1 To 3 Prim F(A)Next i End Sub 运行上面的程序,单击命令按钮,输出结果为 ______。A.4 4 4B.4 5 6C.4 6 8D.4 7 9