C++试卷

第341题

有如下程序,运行时的输出结果是()。

#include<iostream>
using namespace std;
class XA{
    int a;
public:
    static int b;
    XA(int aa):a(aa){b++;}
    ~XA(){}
    int get(){return a;}
};
int XA::b=0;
int main(){
    XA d1(2),d2(3);
    cout<<<d1.get()+d2.get()+XA::b<<endl;
    return 0;
}
第342题

下列关于析构函数的描述中,错误的是()。

第343题

下列关于构造函数的描述中,错误的是()。

第344题

若PAT是一个类,则程序运行时,语句 PAT (*ad)[3]; 调用PAT的构造函数的次数是()。

第345题

有如下程序,运行时的输出结果是()。

#include<iostream>
using namespace std;
class MyClass {
public:
    MyClass () { cout << "*"; }
    MyClass (MyClass & a) { cout << "#"; }
    ~MyClass () { cout << "@"; }
};
int main(){
    MyClass a;
    Myclass b(a);
    return 0;
}
第346题

有如下程序,运行这个程序的输出结果是()。

#include<iostream>
using namespace std;
class Monkey{
public:
    Monkey() {cout<<"M";}
    Monkey(char n) {cout<<n;}
    ~Monkey() {cout<<"Y";}
};
int main(){
    Monkey p1,*p2;
    p2=new Monkey('X');
    delete p2;
    return 0;
}
第347题

下列关于类成员对象构造函数调用顺序的叙述中,正确的是()。

第348题

 有如下程序,运行这个程序的输出结果是()。

#include<iostream>
#include<cstring>
using namespace std;
class MyString{
public:
    char str[80];
    MyString(const char* s){strcpy(str,s);}
    MyString& operator+=(MyString a){
        strcat(str,a.str);
        return *this;
    }
};
ostream& operator<<(ostream& s,const MyString& z){return s<<z.str;}
int main(){
    MyString x("abc"),y("cde");
    cout<<(x+=y)<<endl;
    return 0;
}
第349题

有如下头文件,在所描述的函数中,具有隐含的this指针的是()。

int f1();
static int f2();
class MA{
public:
    int f3();
    static int f4();
};
第350题

有两个关系R和S,则由关系R得到关系S的操作是

关系 R:

| A | B | C |

| a | 1 | 2 |

| b | 2 | 1 |

| c | 3 | 1 |

关系 S:

| A | B | C |

| c | 3 | 1 |


第351题

数据字典(DD)所定义的对象包含于

第352题

软件需求规格说明书的作用不包括

第353题

下列属于黑盒测试方法的是

第354题

下列不属于软件设计阶段任务的是

第355题

下列关于函数重载的叙述中,错误的是

第356题

下列关于类成员对象构造函数调用顺序的叙述中,正确的是

第357题

下列关于派生类的叙述中,错误的是

第358题

下列关于运算符重载的叙述中,正确的是

第359题

下列关于模板的叙述中,错误的是

第360题

下列关于输入输出流的叙述中,正确的是