单击命令按钮时,下列程序的运行结果为
Private Sub Command1_Click()
Print Fun(23,18)
End Sub
Public Function Fun(m As Integer,n As Integer) As Integer
DO While m<>n
DO While m>n:m=m-n:Loop
DO While m<n:n=n-m:Loop
Loop
Fun=m
End Function
A.0
B.1
C.3
D.5
第1题:
单击命令按钮时,下列程序的运行结果为
Private Sub Command1_Click()
Print Fun(23, 18)
End Sub
Public Function Fun(m As Integer, n As Integer) As Integer
Do While m <> n
Do While m > n: m=m - n: Loop
Do While m < n: n=n - m: Loop
Loop
Fun=m
End Function
A.0
B.1
C.3
D.5
第2题:
单击命令按钮时,下列程序的运行结果为
Private Sub Command1_Click()
Print MyBM(23, 18)
End Sub
Public Function MyBM(m As Integer, n As Integer) As Integer
Do While m <> n
Do While m > n: m=m - n: Loop
Do While m < n: n=n - m: Loop
Loop
MyBM=m
End Function( )。
A.0
B.1
C.3
D.5
第3题:
以下程序的运行结果为: a=15 if a>15: print(5,end="") elif a>10: print(20,end="") elif a>5: print(35,end="")
第4题:
下面程序运行后,单击命令按钮,输出的结果是______。
Private Sub Command1_Click()
Dim a%(1 To 5),i%,s
For i=1 To 5
a(i) =i
Next
s=Fun(A)Print "s=";s;
End Sub
Function Fun(a() As Integer)
Dim t,i%
t=1
For i=LBound(A)To UBound(A)t=t*a(i)
Next
Fun=t
End Function
第5题:
下列说法不正确的是()。 知识点:全局变量
A.x = 5 def fun(): x = 2 x = x * 3 print(x, end=' ') fun() print(x) 程序无误,输出结果为6 5
B.x = 5 def fun(): global x x = 2 x = x*3 print(x, end=' ') fun() print(x) 程序无误,输出结果为6 6
C.x = 5 def fun(): x = x * 3 print(x ,end=' ') fun() print(x) 程序无误,输出的结果为15 15
D.x = 5 def fun(): print(x, end=' ') fun() print(x) 程序无误,输出的结果为5 5