[单选题]单击命令按钮执行下列程序,其输出结果是。 Private Sub Commana1_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 End Function Function SecProc(x As Integer,y As Integer,z As Integer) SecProc = FirProc(z,x,y) + x End Function
正确答案 :C
28
解析:【解析】本题是在Commana1过程中调用SecProc函数,而在SecProc函数中又调用了FirProc函数。函数调用时,实参和形参要一一对应传递。程序运行过程是:①Print SecProc(c,b,a)→Print SecProc(3,5,4);②SecProc = FirProc(z,x,y) + x→SecProc = FirProc(3,5,4) + 5;③FirProc = 2 * x + y + 3 * z→FirProc = 2 * 3 + 5 + 3 * 4=23;④SecProc = 28→Print SecProc(c,b,a)→Print28.形参是在被调用的SuB、Function过程中定义的参数名;实参则是在调用的Sub或Function过程中定义的参数名。
[单选题]假定时钟控件的Interval属性为1000,Enabled属性为True,并且有下面的事件过程,计算机将发出( )beep声。 Sub Timer1_Timer() Fori=1 to 10 Beep Nexti End Sub
正确答案 :D
以上都不对
[单选题]在窗体上有一个命令按钮Commandl,编写事件代码如下:Private Sub Commandl Click( ) Dim X As Integer,Y As Integer x=12:y=32 Call Proc(x,Y) Debug.Print X;Y End Sub Public Sub proc(n As Integer,ByVal in As Integer) n=n Mod 10 m=m Mod 1O End Sub 打开窗体运行后,单击命令按钮,立即窗口上输出的结果是( )。
正确答案 :A
232
解析:A。【解析】由程序可知proc过程作用是将参数的个位求出并赋给本身。它的第一个参数是默认按地址传递,所以它可以改变实参的值,而第二个是按值传递,形参的改变对实参无影响。于是当Callproc(x,y)后X由12变为2,而y仍为32。
查看原题