计算机二级

单击命名按钮时,下列程序代码的执行结果为 Public Sub procl ( n As Integer, Byval m As Integer) n=n Mod 10 m=m Mod 10 End Sub Private Sub Cmmand1 Click() Dim x As Integer, y As Integer x=12:y=12 Call Procl (x, y) Print x;y End SubA.12 2B.2 12C.2 2D.12 12

题目

单击命名按钮时,下列程序代码的执行结果为 Public Sub procl ( n As Integer, Byval m As Integer) n=n Mod 10 m=m Mod 10 End Sub Private Sub Cmmand1 Click() Dim x As Integer, y As Integer x=12:y=12 Call Procl (x, y) Print x;y End Sub

A.12 2

B.2 12

C.2 2

D.12 12

参考答案和解析
正确答案:B
解析:本题为典型的考查传地址与传值区别的题.由于n为默认的传地址参数,m为传值参数,故在调用Procl过程后,x值为经过处理后的值,y为原值,不发生改变。故正确答案为B.
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

Private Sub Command1_Click()

Dim x As Integer, y As Integer

x=86: y=29

Call Proc(x, y)

Print x; y

End Sub

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

n=n Mod 10

m=m Mod 10

End Sub( )。

A.12 32

B.6 29

C.2 3

D.12 3


正确答案:B

第2题:

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

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

第3题:

( 11 )在窗体中添加一个名称为 Command1 的命令按钮,然后编写如下事件代码:

Private Sub Command1_Click( )

Dim x As Integer, y As Integer

x=12 : y=32

Call p(x, y)

MsgBox x*y

End Sub

Public Sub p (n As Integer, By Val m As Integer)

n=n Mod 10

m=m Mod 10

End Sub

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


正确答案:

第4题:

单击命令按钮时,下列程序代码的执行结果为 Public Sub proc1(n As Integer,Byva1 m As Integer) n=n Mod 10 m=m Mod 10 End Sub Private Sub Cmmand1_Click( ) Dim x As Integer,y As lngeger x=12:y=12 Call Proe1(x,y) Print x;y End Sub

A.12 2

B.2 12

C.2 2

D.12 12


正确答案:B
解析:由于n为默认的传地址参数,m为传值参数,故在调用Proc1过程后,x值为经过处理后的值,y为原值,不发生改变。

第5题:

单击命令按钮时,下列程序代码的执行结果为______。 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

第6题:

单击命令按钮时,下列程序的执行结果为( )。 Private Sub Commandl_Click() Dimx As Integer,y As Integer x=12: y=32 CallPCS(x,y) PrintX;y End Sub PubUc Sub PCS(ByValn As Integer,ByValm As Integer) n=nMod 10 m=mMod 10 End Sub

A.1232

B.232

C.23

D.123


正确答案:A

第7题:

单击命令按钮时,下列程序代码的执行结果为 ______。 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。

第8题:

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

Private Sub Command1_Click()

Dim x As Integer, y As Integer

x=32: y=42

Call PCS(x, y)

Print x; y

End Sub

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

n=n Mod 10+1

m=m Mod 10+1

End Sub ( )。

A.32 42

B.2 32

C.2 3

D.12 3


正确答案:A

第9题:

单击命令按钮,并在对话框内依次输入5,7,6下列程序段的执行结果为______。 Private Sub Command1_Click() Dim n AS Integer, a As Integer, b As Integer, c As Integer n = 0 For i = 1 To 3 a = InputBox ("请输入数字") n = n+a*a If n > 50 Then GoTo ex End If Next i ex: Print n End Sub

A.25

B.74

C.85

D.110


正确答案:B

第10题:

单击命令按钮时,下列程序代码的执行结果为______。 PubUc Sub Procl(n As Integer,By Valm As InteSg) n=n Mpd 10 m=m/10 End Sub PHvate Sub Commandl Click() Dim X As Inte9er,y As Intger 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=12Modl0=2,y=34
最终的输出结果是: 2 34。

更多相关问题