选择题 语句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;
}
运行这个程序的输出结果是______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class TestClass
{public:
virtual void funl()
{cout<<'fun1TestClass';}
virtual void fun2()
{cout<<'fun2TestClass';)};
class TestClass1:public TestClass
{void fun()
{cout<<'fun1TestClass1';}};
int main()
{Tc stClass obj1,*p;
TestClass1 obj2;
p=&obj2;
p->fun1();
p->fun2();
return 0;}
该程序执行后的输出结果是______。
选择题 结构化程序设计的三种基本结构是______。
选择题 下列关于运算符重载的叙述中,错误的是______。
选择题 下列关于线性链表的叙述中,正确的是______。
选择题 有如下程序段:
int i=2;
do{
i*=i;
cout<<'#';
if(i>1000)break;
}while(1);
运行时,输出字符'#'个数是______。
