Q2 : Declare Function Multiply_Add Lib “test” (ByRef A as i as integer ) as integer
Q2.1: Explain what is Declare Function used for ?
Ans :
Q2.2 : Explain the difference between ByRef and ByVal ?
Ans :
第1题:
在窗体上画一个命令按钮,命名为Command1。程序运行后,如果单击命令按钮,则显示一个输入对话框,在该对话框中输入一个整数,并用这个整数作为实参调用函数过程F1,在F1中判断所输入的整数是否是奇数,如果是奇数,过程F1返回1,否则F1返回1,否则返回0。能够正确实现上述功能的代码是 。A.Private Sub Command1_Click() x=InputBox("请输入整数") a=F1(Val(x)) Print a End Sub Function F1(ByRef b As Integer) If b Mod 2=0 Then Return 0 Else Return 1 End If End FunctionB.Private Sub Command1_Click() x=InputBox("请输入整数") a=F1(Val(x)) Print a End Sub Function F1(ByRef b As Integer) If b Mod 2=0 Then F1= 0 Else F1= 1 End If End FunctionC.Private Sub Command1_Click() x=InputBox("请输入整数") F1(Val(x)) Print a End Sub Function F1(ByRef b As Integer) If b Mod 2=0 Then F1= 1 Else F1= 0 End If End FunctionD.Private Sub Command1_Click() x=InputBox("请输入整数") F1(Val(x)) Print a End Sub Function F1(ByRef b As Integer) If b Mod 2=0 Then Return 0 Else Return 1 End If End Function
第2题:
A、Sub plus(sum, a , b ): sum = a + b: End Sub
B、Sub plus(ByVal sum , a , b ): sum = a + b: End Sub
C、Sub plus(sum , ByVal a, ByVal b ): sum = a + b: End Sub
D、Sub plus(sum , ByRef a , ByRef b ): sum = a + b: End Sub
第3题:
有以下函数过程: Function Gys (ByVal x As Integer, ByVal y As Integer) As Integer Do While y<>0 Reminder = x Mod y x = y y= Reminder Loop Gys=x End Function 以下是调用该函数的事件过程,该程序的运行结果是 Private Sub Command1_Click() Dim a As Integer Dim b As Integer a = 50 b = 10 x=Gys (a,B)Print x End Sub
A.0
B.10
C.50
D.100
第4题:
有如下函数过程: Function funl(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=funl(a,B)Print x End Sub
A.0
B.25
C.50
D.100
第5题:
有如下函数过程。
Function UNC(ByVal x As Integer,ByVal y As Integer)As Integer
Do While y<>0
S=x/y
x=y
y=S
Loop
UNC=x
End Function
以下事件调用该函数,程序运行结果是【 】。
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
a=12
b=2
x=UNC(a,b)
Print x
End Sub
第6题:
Comment is nonprogram(78) embedded in a program to explain its form. and function to human readers.
A.command
B.expression
C.text
D.statement
第7题:
有下列函数过程: 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
A.0
B.25
C.50
D.100
第8题:
下面4个CT函数中是用来判断用户输入的数是否为奇数的,是奇数的返回1,否则返回0,其中正确的是
A.Function CT(ByVal a As Integer) If a Mod 2=0 Then Return 0 ElSe Return 1 End if End Function
B.Function CT(ByVal a As Integer) If a Mod 2=0 Then CT=0 Else CT=1 End if End Function
C.Function CT(ByVal a As Integer) If a Mod 2=0 Then CT=1 Else CT=0 End if End Function
D.Function CT(ByVal a As Integer) If a Mod 2=0 Then Return 1 Else Return 0 End if End Function
第9题:
阅读程序: Function fac(ByVal As Integer)As Integer Dim temp As Integer temp=1 For i%=1 To n temp=temp*i% Next i% fac=temp End Function Private Sub Form. Click( ) Dim nsum As Integer nsum=1 For i%=2 T0 4 nsum=nsum+fac(i%) Next i% Print nsum End Sub 程序运行后,单击窗体,输出结果是( )。
A.35
B.31
C.33
D.37
第10题:
在窗体上画一个名称为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 7
B.2 8 14 53
C.0 3 21 45
D.0 5 11 34
第11题:
以下是某个窗体的模块代码,请分析单击窗体后程序运行至"*"号位置时变量X、Y和Z的值分别是【 】。
DIM X AS INTEGER
DIM Y AS INTEGER
PRIVATE SUB FORM_CLICK()
DIM X AS INTEGER
X=1
Y=1
CALL AA(Y+1)
Z=BB(X)
'* * * * * * *
MSGBOX "X="&X&"/Y="&Y&"/Z="&Z
END SUB
PRIVATE SUB AA(BYVAL Z AS INTEGER)
Y=Z+X
Z=X+Y
END SUB
PRIVATE FUNCTION BB(BYREF Y AS INTEGER
Y=Y+1
BB=X+Y
END FUNCTION
第12题:
在Oracle 中,下列语句中哪些可以合法地创建一个函数? (1.0分) [多选]
A. CREATE FUNCTION func_name(cdcode NUMBER) RETURN CHAR IS DECLARE dis_cd CHAR(15);
BEGIN .. END; B. CREATE FUNCTION func_name(cdcode NUMBER) RETURN CHAR IS dis_cd CHAR(15);
BEGIN .. END; C. CREATE FUNCTION func_name(cdcode NUMBER) IS
BEGIN .. END; D. CREATE FUNCTION func_name(cdcode NUMBER) RETURN CHAR IS
BEGIN .. END; E. CREATE FUNCTION func_name(cdcode NUMBER) RETURN CHAR IS DECLARE dis_cd STRING (15);
BEGIN .. END;
答案: B D
第13题:
下列子过程语句中正确的是( )。
A.Sub fl(By Val()As Integer)
B.Sub fl(n() As Integer)As Integer
C.Functionn fl(fl As Integer)As Integer
D.Function fl(ByVal f As Integer)
第14题:
A、Private Sub sele(ByVal A( ) As integer)
B、Private Function sale(A() As Integer) As String
C、Private Sub sale(A() As Integer) As Integer
D、Private Sub sale(A(i) As Integer)
第15题:
在窗体上画一个命令按钮,命名为CommandI。程序运行后,如果单击命令按钮,则显示一个输入对话框,在该对话框中输入一个整数,并用这个整数作为实参调用函数过程 F1,在F1中判断所输入的整数是否是奇数,如果是奇数,过程F1返回1,否则返回0。 能够正确实现上述功能的代码是
A.Privme Sub Command1_Click() x=InputBox(“请输入整数”) a=F1(Val(x)) Print a End Sub Function F1(ByRef b As Integer) If b Mod 2=0 Then Return 0 Else Return 1 End If End Function
B.Private Sub Command1_Click() x=InputBox(“请输入整数”) a=F1(Val(x)) Print a End Sub Function F1(ByRef b As Integer) If b Mod 2=0 Then F1=0 Else F1=1 End If End Function
C.Private Sub Command1_Click() x=InputBox(“请输入整数”) F1(Val(x)) Print a End Sub Function F1(ByRef b As Integer) If b Mod 2=0 Then F1=1 Else F1=0 End If End Function
D.Private Sub Command1_Click() x=InputBox(“请输入整数”) F1 (Val(x)) Print a End Sub Function F1(ByRef b As Integer) If b Mod 2=0 Then Return 0 Else Return 1 End If End Function
第16题:
在过程定义中有语句: Private Sub GetData(ByRef f As Integer. 其中"ByRef"的含义是
A.传值调用
B.传址调用
C.形式参数
D.实际参数
第17题:
is nonprogram text embedded in a program to explain its form. and function to human readers.
A.Command
B.Compile
C.Comment
D.Statement
第18题:
下列子过程语句中正确的是( )。
A.Sub f1(ByVal() As Integer)
B.Sub f1(n() As Integer)As Integer
C.Function f1(f1 As Integer)As Integer
D.Function f1(ByVa1 f as Integer)
第19题:
下列子过程语句的说明正确的是( )。
A.Sub fl(ByVal x() As Integer)
B.Sub fl(x%())As Integer
C.Function fl%(fl%)
D.Function fl%(x As Integer)
第20题:
Q2 : Declare Function Multiply_Add Lib “test” (ByRef A as integer ,VeRef B as integer , ByVal c as integer ) as integer
Q2.1: Explain what is Declare Function used for ?
Ans :
Q2.2 : Explain the difference between ByRef and ByVal ?
Ans :
第21题:
在过程定义中有语句: Private Sub GetData(ByRef fAs Integer)其中,“ByRef’的含义是( )。
A.传值调用
B.传址调用
C.形式调用
D.实际参数
第22题:
下列子过程语句的说明正确的是( )。
A.Sub f1(ByVal x()As Integer)
B.Sub f1(x%())As Integer
C.Function f1%(f1%)
D.Function f1%(x As Integer)
第23题: