更多"阅读程序: Function Fun(a As Integer) "的相关试题:
[单项选择]阅读程序: Function Fun( a As Integer) Static c b=0:b=b+2:c=c+2 F=a*b*c End Function Private Sub Commandl _ Click( ) Dim a As Integer a=2 For i = 1 To 2 Print Fun (a); Next End Sub 运行上面的程序,单击命令按钮,输出结果为
A. 8 16
B. 9 18
C. 10 20
D. 7 14
[单项选择]阅读程序:
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. 4 5 6
B. 4 6 8
C. 4 7 9
[单项选择]有如下一个函数过程:
Function Fun(a As Integer)
Static C
b=0:b=b+1:c=c+1
Fun=a+b+c
End Function
在窗体上添加一个命令按钮,事件过程如下:
Private Sub Command1_Click( )
Dim a As Integer
a=2
For i=1 To 3
Print Fun(
A. ;
[单项选择]有如下一个函数过程:
Function Fun(a As Integer)
Static c
b=0:b=b+1:c=c+1
Fun=a+b+c
End Function
在窗体上添加一个命令按钮,事件过程如下:
Private Sub Command1_Click( )
Dim a As Integer
a=2
For i=1 To 3
Print Fun(
A. ;
[单项选择]阅读程序:
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. 4
B. 4
C. 4
[单项选择]设有如下函数过程:
Function fun(a As Integer, b As Integer)
Dim c As Integer
If a<b Then
c=a:a=b:b=c
End If
c=0
Do
c=c+a
Loop Until c Mod b=0
fun=c
End Function
若调用函数fun时的实际参数都是自然数,则函数返回的是
A. a、b的最大公约数
B. a、b的最小公倍数
C. a除以b的余数
D. a除以b的商的整数部分
[填空题]设有以下函数过程:
Function fun(m As Integer) As Integer Dim k As Integer, sum As Integer sum = 0
For k = m To 1 Step -2
sum = sum + k
Next k
fun = sum
End Function
若在程序中用语句s=fun(10)调用此函数,则s的值为 _________。
[单项选择]有如下程序:
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. ;
[填空题]如果存在如下过程:
Private Function Fun( a( ) As Integer)
Dim First As Integer, Last As Integer, i As Integer
First = LBound(a)
Last=UBound (a)
Max = a(First)
For i=First To Last
If a(i)>Max Then Max =a(i)
Next
Fun=Max
End Function
在窗体上添加一个命令按钮,然后编写如下事件过程:
Private Sub Command1_Click( )
ReDim m(1 To 4) As Integer
m(1) =20: m(2) =30: m(3) =50: m(4) =100
c =Fun(m)
Print c
End Sub
单击命令按钮,其输出结果为 【10】 。
[单项选择]设有以下函数过程:
Function fun(a As Integer,b As Integer)
Dim c As Integer
If a c=a:a=b:b=C
End IF
c=0
Do
c=c+a
Loop Until c Mod b=0
fun=c
End Function
若调用函数fun时的实际参数都是自然数,则函数返回的是( )。
A. a、b的最大公约数
B. a、b的最小公倍数
C. a除以b的余数
D. a除以b的商的整数部分
[单项选择]有如下函数过程:
Function fun1 (ByVal x As Integer, ByVal y As Integer) As Integer
Do While y <> 0
reminder=x Mod y
x=y
y=reminder
Loop
fun1=x
End Function
在下列按钮单击事件中调节器用该函数,则该程序的运行结果是( )。
Private Sub Command1_Click( )
Dim a As Integer
Dim b As Integer
a=100
b=25
x=fun1(a, b)
Print x
End Sub
A. 0
B. 25
C. 5O
D. 100
[单项选择]有下列函数过程:
Function fun1(ByVal x As Integer,ByVal y As Integer)As Integer
Do While y<>0
reminder=x Mod y
x=y
y=reminder
Loop
fun1=x
End Function 在下列按钮单击事件中调用该函数,则该程序的运行结果是( )。
Private Sub Command1_Click( )
Dim a As Integer
Dim b As Integer
a=100
b=25
x=fun1(a,b)
Print x
End Sub
A. 0
B. 25
C. 50
D. 100
[填空题]如果存在如下过程:
Private Function Fun(a( )As Integer)
Dim First As Integer,Last As Integer,i As Integer
First=LBound(a)
Last=LBound(a)
Max=a(First)
For i=First To Last
If a(i)>Max Then Max=a(i)
Next
Fun=Max
End Function
在窗体上添加一个命令按钮,然后编写如下事件过程:
Private Sub Command1_Click( )
ReDim in(1 To 4)As Integer
m(1=20:m(2)=30:m(3)+50:m(4)=100
c=Fun(m)
Print c
End Sub
单击命令按钮,其输出结果为______。