niusouti.com
更多“下列事件过程运行后输出结果是 Private Sub Command1_Click()Print Format$(123,456, "###,##%") ”相关问题
  • 第1题:

    若有以下程序: include usingnamespace std; class Sample { private: const int n;

    若有以下程序:

    include <iostream>

    using namespace std;

    class Sample

    {

    private:

    const int n;

    public:

    Sample(int i) :n(i) {)

    void print()

    {

    cout<<"n="<<n<<end1;

    }

    };

    int main()

    {

    sample a(10);

    a.print();

    return 0;

    }

    上述程序运行后的输出结果是【 】。


    正确答案:n=10
    n=10 解析:本题考核常成员数据的应用。类Sample中,定义了一个常数据成员n,所以构造函数只能通过初始化列表来初始化它。

  • 第2题:

    以下代码的输出结果是()。 print('{:#>12.4}'.format('random')) 知识点:format方法

    A.########rand

    B.######random

    C.random######

    D.rand########


    [1, 27]

  • 第3题:

    1、下面代码的输出结果是‪‬‪‬‪‬‪‬‪‬‮‬‪‬‫‬‪‬‪‬‪‬‪‬‪‬‮‬‫‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‮‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‭‬‪‬‪‬‪‬‪‬‪‬‮‬‪‬‪‬a = 1.0 if isinstance(a,int): print("{} 是整数".format(a)) else: print("{}不是整数".format(a))

    A.无输出

    B.1.0不是整数

    C.1.0是整数

    D.a不是整数


    D 解析:该题考查对自增自减运算符的理解。假如op是操作数,自增自减运算符有下面几种形式。++op、op++,表示对操作数op加1,其中,++op表示先对。p加1然后再取其值,而。op++表示先取其值,然后再对op进行加1。 --op、op--,表示对操作数op进行减1操作,其中,--op表示先对op减1然后再取其值,而op--表示先取其值,然后再对op进行减1。在本题中,当进行到i=5时退出循环,此时j为6。故本题答案是D。

  • 第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。【解析】本题由主函数main入手,定义TestClass型的常对象a,然后调用对象a中的成员函数print。因为在C++中,如果一个对象被声明为常对象,则不能调用该对象中的非eonst型的成员函数。所以,这里调用的是对象中的const型成员函数“voidprintconst”,输出为print2。

  • 第5题:

    下列哪个语句输出浮点数类型变量x保留显示2位小数的结果是错误的:()

    A.print("{%.2f}".format(x))

    B.print("%.2f"%x)

    C.print("{:.2f}".format(x))

    D.print(format(x,".2f"))


    {:.2f}