有如下程序: Private Sub Commandl_Click() Dim a As Single Dim b As Single a=2:b=4

题目

有如下程序: Private Sub Commandl_Click() Dim a As Single Dim b As Single a=2:b=4 Call CS(a,b)End Sub Sub CS(x As Single,y As Single) t=X x=t\y y=t Mod y End Sub 程序运行后,单击命令按钮,a和b的值分别为

A.0 0

B.1 1

C.0 2

D.1 2

参考答案和解析
正确答案:C
解析:调用一个过程时,必须把实际参数传送给过程,完成形式参数与实际参数的结合,然后用实际参数执行调用的过程;因为在默认的情况下,变量都是通过“引用”传送给Sub过程,在这种情况下,可以通过改变过程中相应的参数来改变变量的值;过程Sub的形参获得a,b的地址,此时x=2,y=4,在过程Sub中,将x,即2的值赋给t,而将ty的值赋给x,将t除以y的余数赋给y,此时x,y的值为0,2。
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

VB中数据类型Single表示单精度型,占( )字节。

A.2

B.4

C.6

D.8


正确答案:B

第2题:

You are developing a Windows Communication Foundation (WCF) service that does not operate on a duplex channel.You find that operations do not start until all previous operations have finished. The service hosting code contains the following lines.var service = new WarehouseService(); var host = new ServiceHost(service);You need to ensure that new operations do not wait for previous operations to finish.Which attribute should you use to decorate the service?()

A. [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Multiple)]

B. [CallbackBehavior(ConcurrencyMode=ConcurrencyMode.Multiple)]

C. [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Single)]

D. [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single, ConcurrencyMode=ConcurrencyMode.Reentrant)]


参考答案:B

第3题:

【问题1】(2分)

为程序中空缺处(1)选择正确答案。

备选答案:

A. Open B. Run C. Execute D. Dim


正确答案:
(1)A或Open       (2分)

第4题:

模块级变量的声明既可以用关键字Private,也可以用关键字Dim。( )

此题为判断题(对,错)。


正确答案:正确

第5题:

Single(单精度)型数据占( )个字节。

A.2

B.4

C.8

D.10


正确答案:B
解析:VB中每种数据类型占用的字节数是不同的,如Integer型占两个字节,Single型占4个字节,Double型占8个字节。

第6题:

You are developing a Windows Communication Foundation (WCF) service.One of the service operations contains the following code.private static int counter = 0;[OperationContract]public void IncrementCount(){ counter++;}You need to set a service behavior that prevents two or more threads from incrementing the counter variable at the same time.Which code segment should you use to set the service behavior?()

A. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single)]

B. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Single)]

C. [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]

D. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Reentrant)]


参考答案:A

第7题:

在标准模块中用:Dim或Private关键字定义的变量是______变量,它们只能在程序的模块中使用。


正确答案:局部标准
局部标准

第8题:

( 22 )有如下过程代码:

Sub var_dim()

Static numa As Integer

Dim numb As Integer

numa=numa+2

numb=numb+1

print numa;numb

End Sub

连续 3 次调用 var_dim 过程,第 3 次调用时的输出是

A ) 2 1

B ) 2 3

C ) 6 1

D ) 6 3


正确答案:C

第9题:

有如下过程代码: Sub var_dim( ) static numa As Integer Dim numb As Integer numa=numa+2. numb=numb+1 print numa;mub End Sub 连续3次调剧var_dim过程,第3次调用时的输出是( )。

A.2 1

B.2 3

C.6 1

D.6 3


正确答案:C
C。【解析】Static是将变量声明为静态变量,每次调用值会取上次调用后的值。而numb是局部变量,每次会重新初妁化,所以应选C选项。

第10题:

半速率小区中,某个呼叫“优选半速率信道”,则下列信道的分配顺序错误的有()

A.全速率—Couple半速率—Single半速率

B.全速率—Single半速率—Couple半速率

C.Couple半速率—Single半速率—全速率

D.Couple半速率—全速率—Single半速率

E.Single半速率—全速率—Couple半速率


参考答案:A, B, C, D, E