选择题 下列关于虚函数与函数重载区别的叙述中不正确的是______。
选择题 己知基类Employee只有一个构造函数,其定义如下:
Employee::Employee(int n):id(n){}
Manager是Employee的派生类,则下列对Manager的构造函数的定义中,正确的是______。
选择题 下列程序的执行结果为
#include<iostream.h>
void main( )
{
int a=3,b=0;
int * p=a;
b=+a++;
cout < < * p < < ',' < < b < < endl;
}
选择题 有如下程序:
#include<iostream>
using namespace std;
class Point{
public:
static int number;
public:
Pointo{number++;}
~Point(){number--;)
};
int Point::number--0;
void main0{
Point*ptr;
PointA,B;
{
Point*ptr_point=new Point[3];
ptx=ptr_point;
}
Point C;
Gout+Point::number+endl;
delete[]ptr;
}
运行时输出的结果是______。
选择题 数据库系统与文件系统的最主要区别是 。
选择题 有如下程序:
#include<iostream>
using namespace std;
void fl(int8,.x,tnt8-y) {int z=x;x=y;y=z;}
void f2(int x,int y) {int z=x;x=y;y=z;}
int main(){
int x=10,y= 26;
f1(x,y);
f2(x,y);
cout<<y<<endl;
return 0;
}
运行时的输出结果是______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class Toy{
public:
Toy(char*_n){strcpy(name,_n);count++;}
~Toy(){count--;}
char*GetName(){return name;}
static int getCount(){return count;}
private:
char name[10];
static int count;
};
int Toy::count=0;
int main(){
Toy t1('Snoopy'),t2('Mickey'),t3('Barbie');
cout<<t1.getCount()<<endl;
return 0;
}
运行时的输出结果是______。
选择题 若有函数原型声明为“void fun(int*x,int y,int z=3);”,下列叙述中,错误的是______。
选择题 在下列字符中,不允许作为C++标以符的是______。
选择题 在下列程序的横线处填上适当的内容,使程序执行后的输出结果为ABCD______。
#include<iostream>
using namespace std;
class A
{
public:A(){cout<<'A';}
};
class B:______
{
public:B(){cout<<'B';}
};
classC: virtua1 pubtic A
{
public:C(){cout<<'C';}
};
class D:public B,public D
{
public:D(){cout<<'D';}
};
void main() {D obj;}
选择题 下列叙述中正确的是______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class GA {
public:
virtual int f() {return 1;}
};
class GB: public GA {
public:
virtual intf() {return 2;}
};
void show(GA g) {cout<<g. f();}
void display(GA g) {cout<<g. f();}
int main()
{
GA a; show(a); display(a);
GB b; show(b); display(b);
return 0;
{
执行这个程序的输出结果是______。
选择题 堆栈s进行下列操作:push(1);push(2);pop();pop();后,此时的栈顶元素为 。
选择题 定义静态成员函数的主要目的是______
选择题 有如下程序:
#include<iostream>
using namespace std;
class B{
public:
virtual void show( ){cout<<'B';}
};
class D:public B{
public:
void show( ){cout<<'D';}
};
void funl(B*ptr){ptr->show( );}
void fun2(Bamp;ref);ref.show( );}
void fun3(B b){b.show( );}
int nlain( ){
B b,*P=Dew D;
D d;
funl(p);
fun2(b);
fun3(d);
return 0;
}
程序的输出结果是______
选择题 以下程序企图把从键盘终端输入的字符输出到名为abc.txt的文件中,当从终端读到字符'#'时,结束输入和输出操作。但该程序有错。
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream ofile; char ch;
ofile.open('d:\\abc.txt', 'W');
do{
cin>>ch;
ofile.put(ch);
}while(ch!='#');
ofile.close();
return 0;
}
程序出错的原因是______。
选择题 若有定义语句“double x[5]={1.0, 2.0, 3.0, 4.0, 5.0},* p=x”,则错误引用x数组元素的是______。
选择题 下列程序的执行结果是______。
#include
class Sample
{
int x,y;
public:
Sample(){x=y=0;}
Sample(int a,int b){x=a;y=b;}
~Sample()
{
if(x==y)
cout<<'x=y'<<endl;
else
cout<<'x!=y'<<endl;
}
void disp()
{
cout<<'x='<<x<<',y='<<y<<endl;
}
};
void main()
{
Sample s1(2,3);
s1.disp();
}
填空题若有以下程序:
#include <iostream>
using namespace std;
#define PI 3.14
class Point
{
private:
int x,y;
public:
Point (int a,int b)
{
x=a;
y=b;
}
int getx ()
{
return x;
}
int gety()
{
return y;
}
};
class Circle : public Point
{
int r;
public:
Circle(int' a, int b,int C) : Point (a, b)
{
r=c;
}
int getr()
{
return r;
}
double area()
{
return PI*r*r;
}
};
int main()
{
Circle c1(5,7,10);
cout<<c1.area()<<end1;
return 0;
}
程序执行后的输出结果是{{U}} 【15】 {{/U}}。
