下列程序的运行结果是( )。 Private Sub Commandl_Click() a=1.5 b=1.5 Call fun(a,B)Print a,b End Sub Private Sub fun(x,y) x=y*y y=y+x End SubA.2.25 3.75B.1.5 2.25C.1.5 0.75D.0.75 1.5

题目

下列程序的运行结果是( )。 Private Sub Commandl_Click() a=1.5 b=1.5 Call fun(a,B)Print a,b End Sub Private Sub fun(x,y) x=y*y y=y+x End Sub

A.2.25 3.75

B.1.5 2.25

C.1.5 0.75

D.0.75 1.5


相似考题
更多“下列程序的运行结果是()。Private Sub Commandl_Click()a=1.5b=1.5Call fun(a,B)Print a,bEnd Sub ”相关问题
  • 第1题:

    有如下程序: #included<iostream> usingnamespacestd; classTestClass {private: intX,y; public: TestClass(inti,intj) {x=i; y=j;} voidprint() {cout<<"printl"<<endl;} voidprint()const {cout<<"print2"<<endl;}}; intmain() {constTestClassa(1,2); print(); return0;} 该程序运行后的输出结果是( )。

    A.printl

    B.print2

    C.printlprint2

    D.程序编译时出错


    正确答案:B
    B。【解析】本题由主函数main入手,定义TestClass型的常对象a,然后调用对象a中的成员函数print。因为在C++中,如果一个对象被声明为常对象,则不能调用该对象中的非eonst型的成员函数。所以,这里调用的是对象中的const型成员函数“voidprintconst”,输出为print2。

  • 第2题:

    有如下程序:

    #included<iostream>

    usingnamespacestd;

    classTestClass

    {private:

    intX,y;

    public:

    TestClass(inti,intj)

    {x=i;

    y=j;}

    voidprint()

    {cout<<"printl"<<endl;}

    voidprint()const

    {cout<<"print2"<<endl;}};

    intmain()

    {constTestClassa(1,2);

    print();

    return0;}

    该程序运行后的输出结果是( )。

    A.printl

    B.print2

    C.printlprint2

    D.程序编译时出错


    正确答案:B
    B。【解析】本题由主函数main入手,定义TestClass型的常对象a,然后调用对象a中的成员函数print。因为在C++中,如果一个对象被声明为常对象,则不能调用该对象中的非eonst型的成员函数。所以,这里调用的是对象中的const型成员函数“voidprintconst”,输出为print2。

  • 第3题:

    17、下列程序的执行结果是___________。 def fun(lst): lst = [4, 5, 6] lst = [1, 2, 3] fun(lst) print(lst)


    [1, 2, 3]

  • 第4题:

    有如下程序: #included<iostream> usingnamespacestd; classTestClass { private: intx,Y; public: TestClass(inti,intj) { x=i: y=j; } voidprint() { cout<<"printl"<<endl; } voidprint()const { cout<<"print2"<<endl; } }; intmain() { constTestClassa(1,2); print(); return0; } 该程序运行后的输出结果是( )。

    A.printl

    B.print2

    C.printlprint2

    D.程序编译时出错


    正确答案:B
    B。【解析】本题定义TestClass型常对象a,然后调用对象a中的成员函数print。因为在C++中.如果一个对象被声明为常对象,则不能调用该对象中的非const型成员函数。所以,这里调用的是对象中的const型成员函数voidprintconst,输出为print2。

  • 第5题:

    下列程序的输出结果是___________。x = 1 def fun(): global x x = 2 fun() print(x)

    A.2

    B.0

    C.1

    D.3


    1

  • 第6题:

    18、下列程序的输出结果是__________。def fun(list): list = [4, 5, 6] return list a = [1, 2, 3] fun(a) print(a[1])


    1