单击窗体时,下列程序代码的执行结果为______ 。 Private Sub Test (x As Integer) x=x*2+1 If x < 6 Then Call Test(x) End If x-x*2+1 Print x; End Sub Private Sub Command1_ Click () Test 2 End SubA.23 47B.5 11C.10 22D.23 29

题目

单击窗体时,下列程序代码的执行结果为______ 。 Private Sub Test (x As Integer) x=x*2+1 If x < 6 Then Call Test(x) End If x-x*2+1 Print x; End Sub Private Sub Command1_ Click () Test 2 End Sub

A.23 47

B.5 11

C.10 22

D.23 29


相似考题
参考答案和解析
正确答案:A
更多“单击窗体时,下列程序代码的执行结果为______ 。 Private Sub Test (x As Integer) x=x*2+1 If x < ”相关问题
  • 第1题:

    单击窗口时,下列程序代码的执行结果为 Private Sub Form_Click( ) Text1 End Sub Private Sub Text(x As Integer) x=x*3+1 if x<6 Then call Text(x) End if x=x*2+1 Print x; End Sub

    A.27 55

    B.11 35

    C.22 45

    D.24 51


    正确答案:A
    解析:难点在于Sub过程Text中嵌套了一个Text过程。根据Text的描述,当把1以传地址的方式传送给x时,x的值为4,此时x的值满足If条件,所以再次执行1次Text过程。第2次执行时,x的值变为13,此时跳过If语句,执行x=x*2+1语句,x值变为27,随后用Print方法输出。注意,到此时,整个Text过程仅仅执行完了callText(x)这一语句块,结束这个语句块,系统接着执行x=x*2+1语句,由于x参数的传地址的方式传送,此时在执行该句前,x的值为27,执行完之后x的值为55,再将这一值输出。窗体上显示27与55。

  • 第2题:

    单击一次窗体之后,下列程序代码的执行结果为______。 Private Sub Command1_ Click() Dim a As Integer, b As Integer, c As Integer a = 1: b = 2: c = 4 Print Value(a, b,C)End Sub Function Num(x As Integer, y As Integer, z As Integer) Num = x * x + y * y + z * z End Function Function Value(x As Integer, y As Integer, z As Integer) Value = Num(x, y, z) + 2 * x End Function

    A.21

    B.23

    C.19

    D.35


    正确答案:B

  • 第3题:

    单击窗体时,下列程序代码的运行结果为()。 Private Sub Test(x As Integer) x = x * 2 + 1 If x < 6 Then Call Test(x) End If x = x * 2 + 1 Print x; End Sub Private Sub Form_Click() Test 2 End Sub

    A.5 11

    B.23 47

    C.10 22

    D.23 23


    21

  • 第4题:

    单击一次窗体之后,下列程序代码的执行结果为______。 Private Sub Command1_ Click() Dim x As Integer, y As Integer, z As Integer x = 1: y = 2: z = 3 Call fun1 (x, y, z) Print x; y; z Call fun2(x, y, z) Print x; y; z End Sub Private Sub fun1(x As Integer, y As Integer, z As Integer) x = 10 * z y=z*z+ x z=x+ y+ z End Sub Private Sub fun2 (ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) x=10*z y=z*z+ x z=x+ y +z End Sub

    A.1 2 3 30 39 72

    B.1 2 3 1 2 3

    C.30 39 72 1 2 3

    D.30 39 72 30 39 72


    正确答案:D

  • 第5题:

    运行下列程序:Dim bPrivate Sub Form_Click( )a = 1: b = 1Call fun1(a)Print "X = &quo

    运行下列程序:

    Dim b

    Private Sub Form_Click( )

    a = 1: b = 1

    Call fun1(a)

    Print "X = "; a; ",Y = "; b

    End Sub

    Private Sub fun1(a)

    b = 2 * a

    a = 3 * b

    End Sub

    单击窗体后,则在窗体上显示的结果是( )。

    A.X = 1,Y = 1

    B.X = 2,Y = 6

    C.X = 6,Y = 2

    D.X = 6,Y = 1


    正确答案:C