选择题 循环链表的主要优点是 。
选择题 下列叙述中,正确的是______
选择题 下列关于函数的描述中,错误的是______。
选择题 有如下程序:
#include<iostream>
#include<cstring>
using namespace std;
class Name{
char name[20];
public:
Name(){strcpy(name,''); cout<<'?';}
Name(char*fname){strcpy(name,fname);cout<<'?';}
};
int main(){
Name names[3]={Name('张三'),Name('李四')};
return 0;
}
运行此程序输出符号?的个数是______。
选择题 若有以下程序:
#include <iostream>
using namespace std;
class Base
{
private:
int a,b;
public:
Base(int x, int y)
{
a=x;
b=y;
}
void show()
{
cout<<a<<', '<<b<<end1;
}
};
class Derive : public Base
{
private:
int c, d;
public:
Derive(int x, int y, int z,int m):Base(x,y)
{
c=z;
d=m;
}
void show()
{
cout<<c<<', '<<d<<end1;
}
};
int main ( )
{
Base b(50,50) ,*pb;
Derive d(10,20,30,40);
pb=d;
pb->show {);
return 0;
}
选择题 语句cout<<setprecision(2)<<1024.4567;的输出结果为______
选择题 有如下的对类“X”的说明,其中 ______ 是错误的。
class X
{
选择题 下面程序的结果是
#include<iostream.h>
class A
{ public:
A( ) { cout < < 'construtA' < < end1;}
virtual ~A( ) { cout < < 'destructA' < < end1;} };
class B:public A
{ };
class C:public A
{ };
class D:public B,public C
{ };
void main( )
{ Dd;}
选择题 有如下程序:
#include<iostream>
using namespace std;
class test{
private:
int a;
public:
test(){cout<<'constructor'<<endl;}
test(int a){cout<<a<<endl;}
test(const test _test){
a=_test.a;
cout<<'copy constructor'<<endl;
}
~test(){cout<<'destructor'<<endl;}
};
int main(){
test A(3);
return 0;
}
执行这个程序的输出结果是______。
选择题 有如下两个类定义:
class AA{};
class BB{
AA v1,*v2;
BB v3;
int*v4;
};
其中有一个成员变量的定义是错误的,这个变量是______。
选择题 有如下类定义:
class MyBase {
int k;
public:
MyBase(int n=0): k(n) {}
int value()const {return k;}
};
class MyDefived: MyBase {
int j;
public:
MyDefived(int i): j(i) {}
int getK()const {return k;}
int getJ()const {return j;}
};
编译时发现有一处语法错误,对这个错误最准确的描述是______。
选择题 关于运算符重载,下列表述中正确的是______。
选择题 下列程序的执行结果为______。
#include<iostream. h>
void main()
{
int a=3, b=0;
int*P=a;
b=+a++;
cout<<*P<<','<<b<<endl;
选择题 有如下类声明:
class MyBASE {
int k;
public:
void set(int n) {k=n;}
int get()const {return k; }
};
class MyDERIVED: protected MyBASE {
Protected:
int j;
public:
void set(int m,int n){MyBASE:: set(m);j=n;}
int get () const {return MyBASE:: get ()+j; }
};
则类MyDERIVED 中保护的数据成员和成员函数的个数是______ 。
选择题 在数据处理中,其处理的最小单位是______。
选择题 以下程序的执行结果为______。
#include<iostream.h>
class Sample
{
int n;
public:
Sample(int i){n=i;}
operator++(){n++;} //前缀重载运算符
operator++(int){n+=2;} //后缀重载运算符
void disp()
{
cout<<'n='<<n<<endl;
}
};
void main()
{
Sample A(2),B(2);
A++;
++B;
A.disp();
B.disp();
}
选择题 若已知char str [20];,且有语句cin>>str;,此时输入为“This is a program',则所得的结果是str= 。
选择题 有如下程序:
class Base{
public:
int data;
};
class Derived1:public Base{};
class Derived2:proteced Base{};
int main()
{
Derived1 d1;
Derived2 d2;
d1.data=0; //①
d2.data=0; //②
return 0;
}
下列关于程序编译结果的描述中,正确的是______。
选择题 执行下列语句段后,输出字符“*”的个数是______。
for(int i=50; i>1; --i)
cout <<'*';
选择题 有如下程序:
#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;
}
运行这个程序的输出结果是______。