(23)设有以下函数过程
Private Function Fun(a() As Integer, b As String) As Integer
...
End Function
若已有变量声明:
Dim x(5)As Integer, n As Integer, ch As String
则下面正确的过程调用语句是
A)x(o)=Fun(x, "ch")
B)n=Fun(n, ch
C)Call Fun x, "ch"
D)n=Fun(x(5), ch)
第1题:
( 25 )设有以下函数过程
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 的商的整数部分
第2题:
在窗体上有一个命令按钮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
第3题:
有如下函数过程:
Function Fun(By Val x As Ingeger,ByVal y As Integer) As Integer
DO While …y<>0
reminder=x Mod y
x=y
y=reminder
Loop
Fun=x
End Function
以下是调用该函数的事件过程,该程序的运行结果是
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a=100:b=25
x=Fun(a,B)Print x
End Sub
A.0
B.25
C.50
D.100
第4题:
在窗体上画一个名称为Command1命令按钮,然后编写如下事件过程: Private Function fun1(n As Integer)As Integer Dim k As Integer If n = 1 Then k = 1 Else k = 1 + fun1(n - 1)* 2 End If fun1 = k End Function Private Sub Command1_Click () Dim m As Integer, x As Integer x = 4 m = fun1 (x) Print m End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是
A.4
B.6
C.9
D.15
第5题:
有如下函数过程: 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
第6题:
设有以下函数过程:
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的值为______。
30
第7题:
假定有以下函数过程: Function Fun(S As String) As String Dim sl As String For i=1 To Len(S) s1=UCase (Mid(S,i,1))+s1 Next i Fun=s1 End Function则Str2=Fun("abcdefg”)的输出结果为( )。
A.abcdefg
B.ABCDEFG
C.gfedcba
D.GFEDCBA
第8题:
在窗体上画一个名称为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. 6
B.7
C.8
D.9
第9题:
设有以下函数过程 Private Function Fun(a( )As Integer,b As String)As Integer … End Function 若已有变量声明: Dim x(5)As Integer,n As Integer,ch As String 则下面正确的过程调用语句是( )。
A.x(O)=Fun(x."ch")
B.n=Fun(n.ch)
C.CallFun X,"ch"
D.n=Fun(x(5),ch)
第10题:
设有以下函数过程
Private Function Fun(a()As Integer,b As String)As Integer
Ehd Function
若已有变量声明:
Dim x(5)As Integer,n As Integer,ch As String
则下面正确的过程凋用语句是
A.x(0)=Fun(x,“ch”)
B.n=Fun(n,ch)
C.Call Fun x,“ch”
D.n=Fun(x(5),ch)