单击命令按钮时,下列程序的执行结果是Private Sub Command1_Click()Dim a As Integer, b As Inte

题目

单击命令按钮时,下列程序的执行结果是 Private Sub Command1_Click() Dim a As Integer, b As Integer, c As Integer a=3:b :4:c =5 Print SecProc ( c, b,A)End Sub Function FirProc(x As Integer, y As Integer, z As Integer) FirProc:2 * x + y + 3 * z+2 End Function Function SecProc( x As Integer, y As Integer, z As Integer) SecProc = FirProc ( z, x, y) + x + 7 End Function

A.20

B.25

C.37

D.32

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

在窗体上画一个命令按钮,然后编写如下程序: Sub S1(ByVal x As Integer,ByVal y As Integer) Dim t As Integer t=x x=y y=t End Sub Private Sub Command1_Click() Dim a As Integer,b As Integer a=10 b=30 S1 a,b Print"a=";a;"b=";b End Sub 程序运行后,单击命令按钮,输出结果是 ______。

A.a=30 b=10

B.a=30 b=30

C.a=10 b=30

D.a=10 b=10


正确答案:C
解析:过程S1似乎是要将两个变量的值进行交换,但由于参数是用传值的方式来传递变量值的,所以执行完该过程后,a和b的值并未被交换,保持原来的值不变。

第2题:

单击命令按钮时,下列程序代码的执行结果为 ______。 Public Sub Procl(n As Integer,ByVal m As Integer) n=n Mod 10 m=m/10 End Sub Private Sub Command1_Click() Dim x As Integer,y As Integer x=12: y=34 Call Procl(x,y) Print x;y End Sub

A.12 34

B.2 34

C.2 3

D.12 3


正确答案:B
解析:过程中传递参数的方式有两种:
  一种是按地址传递参数,这种形式使过程用变量的内存地址去访问实际变量的内容,如果在过程中改变了该变量的值,则是真正改变了这一变量的值,这种形式是传递参数的缺省方式。
  另一种是按值传递参数,这种形式只是传递变量的副本,如果在过程中改变该变量副本的值,并不能真正改变该变量本身的值。
  解题思路:观察程序段,过程Procl的第一个参数n是按地址传递参数,第二个参数m是按值传递参数,所以调用过程Procl后,变量x的值改变,而变量y的值不变。
  由程序段可知,x=12 Mod 10=2,y=34
  最终的输出结果是: 2 34。

第3题:

单击命令按钮时,下列程序的执行结果是

Private Sub Command1_Click()

BT 4

End Sub

Private Sub BT(x As Integer)

x=x * 2 + 1

If x < 6 Then

Call BT(x)

End If

x=x * 2

Print x;

End Sub( )。

A.15

B.16

C.17

D.18


正确答案:D

第4题:

单击命令按钮时,下列程序的执行结果为 Private Sub Command1_Click() Dim a As Integer,b As Integer,c As Integer a=2:b=3:C=4 Print P2(c,b,A)End Sub Private Function P1(x As Integer,y As Integer,z As Integer) P1=2 * X + y + 3 * z End Function Private Function P2(x As Integer,y As Integer,z As Integer) P2=P1(z,x,y) + X End Function

A.21

B.19

C.17

D.34


正确答案:A
解析:对于多个过程或函数依次调用和处理与简单过程调用处理一样,本题先调用函数P2,而函数P2又调用函数P1,结果返回的顺序是从P1到P2,P2计算后输出到调用的地方。

第5题:

阅读下列程序: 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.80

B.60

C.70

D.15


正确答案:C
解析:本题调用一个Function过程func,该过程只有一个参数,类型为整型,返回值也为整型。过程的调用十分简单,关键是要搞清楚过程func的功能。从For-Next循环可以看出,该过程的功能是:1×2+2×3+3×4+…+(n+1)×n。在调用过程时,实参a的值为5,即上式中的n=5。因此返回的值为:1×2+2×3+3×4+4×5+5×6=70。

第6题:

在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Private Sub subl(ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) z=x*x+y*y End Sub Private Sub Command1_Click() Dim a As Integer a=8 Call subl(1, 2,a) Print a End Sub 程序运行后,单击命令按钮,则窗体下显示的内容是______。

A.8

B.2

C.5

D.11


正确答案:A
解析:因为Subl过程的形参都是传值传送,所以在其内的所有计算结果都不将返回,并不影响对应的实参值,变量a的值并没有改变,仍然是8。

第7题:

单击命令按钮时,下列程序代码的执行结果为( )。 Private Function FirProc(x As Integer,y As Integer,z As Integer) FirProc=2*x+y+3*z End Funcfion Private Function SecProc(x As Integer,y As Integer,z As Integer) SecProc=FirProc(z,x,y)+x End Funcfion Private Sub Command1_Click() Dim a As Integer Dim b As Integer Dim c As Integer a=2 b=3 c=4 Printf SecProc(c,b,a) End Sub

A.21

B.19

C.17

D.34


正确答案:A

第8题:

单击命令按钮时,下列程序的执行结果为

Private Sub Command1_Click()

Dim x As Integer, y As Integer

x=12: y=32

Call PCS(x, y)

Print x; y

End Sub

Public Sub PCS(ByVal n As Integer, ByVal m As Integer)

n=n Mod 10

m=m Mod 10

End Sub( )。

A.12 32

B.2 32

C.2 3

D.12 3


正确答案:A

第9题:

单击命令按钮时,下列程序代码的执行结果为______。 Private Sub Proe1 (n As Integer,ByVa1 m As Integer) n=n Mod 10 m=m\ 10 End Sub Private Sub Command1_Click() Dim x As Integer Dim y As Integer x= 12 y = 34 Call Proe1 (x, y) Print x; y End Sub

A. 12 34

B.2 34

C.2 3

D.12 3


正确答案:B

第10题:

在窗体上添加一个命令按钮(名为Command1),然后编写如下程序:

Private Sub Command1_Click()

Dim a As Integer,b As Integer

x=10

y=20

End Sub

打开窗体运行后,单击命令按钮,消息框的输出结果为( )。


正确答案:20
20 解析: 本题考查IIf函数的知识。对于IIf函数可用于执行简单的条件判断操作,当第一个参数为真时返回第二个参数值,否则返回第三个参数值。因为x>y为假,所以返回y的值也就是返回20。

更多相关问题