选择题 有如下程序:
#include<iostream>
using namespace std;
class Sample{
public:
Sample(){}
~Sample(){cout<<'*';)
};
int main(){
Sample temp[2],*pTemp[2];
return 0:
}
执行这个程序输出星号(*)的个数为______。
选择题 执行下列语句:
#include<iostream>
using namespace std;
int main()
{
int x=3;
if(x=5)
cout<<x++<<endl;
else
cout<<x<<endl;
return 0;
}
程序的输出是______。
选择题 类模板的使用实际上是将类模板实例化为一个具体的______。
选择题对下列二叉树进行前序遍历的结果为______。
选择题 设有说明语句:
char a[]='ab\123cd\0',*p1=a;
int b[10]={1,2,3,4},*p2=b;
以下选项中,正确的是______。
选择题 假定int类型变量占用两个字节,其有定义int x[10]={0, 2, 4};,则数组x在内存中所占是______。
选择题 下列叙述中正确的是______。
选择题 下列程序的输出结果是 。
#include<iostream.h>
void main()
{
char*Str;
str='testI';
cout<<str[5];
}
选择题 下列程序中横线处应填入的语句是______。
class Base
{
public:
void fun(){cout<<'Base of fun'<<endl;}
};
class Derived: public Base
{
void fun()
{
______//显示基类的成员函数fun
cout<<'Derived of fun'<<endl;
}
};
选择题 下列与栈结构有关联的是______。
选择题 有以下程序:
#include<iostream>
#include<math>
using namespace std;
class point
{
private:
double x;
double y;
public:
point(double a,double B)
{
x=a;
y=b;
}
friend double distance (point a,point B) ;
};
double distance (point a,point B)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int main()
{
point p1(1,2);
point p2(5,2);
cout<<distance(p1,p2)<<end1;
return 0;
}
程序运行后的输出结果是
选择题 有如下类定义:
class Date{
public:
Date(int y=2014, int m=9, int d=9):year(y), month(m), day(d){}
______(ostreamstream, Dateddd); //运算符<<的声明
private:
int year, month, day;
};
若要使语句序列
Date GoodDay;
cout<<GoodDay<<endl;
能够正常运行,横线处的内容应为______。
选择题 有如下程序:
#include <iostream>
using namespace std;
class B{
public:
virtual void show(){cout<<'B';}
};
class D:public B{
public:
void show() {cout<<'D';}
};
void fun1(B*ptr){ptr->show();}
void fun2(Bref){ref.show();}
void fun3(B b){b.show();}
int main()
{
Bb,*p=new D;
Dd;
fun1(p);
fun2(b);
fun3(d);
delete p;
return 0;
}
执行这个程序的输出结果是______。
选择题 在结构化程序设计思想提出之前,在程序设计中曾强调程序的效率。与程序的效率相比,人们更重视程序的______
选择题 已知类Array的定义如下:
class Array{
public:
int data[2];
Array(int n=0){
int start;
if(n<=1)start=n-1; else start=n;
data[0]=start;
data[1]=start+1;
}
};
且有如下程序段:
Array arr(2);
cout<<arr.data[0]<<arr.data[1];
则执行这个程序段的输出是
选择题 以下有关析构函数的叙述不正确的是______
选择题有三个关系R、S和T如下:则由关系R和S得到T的操作是______。
选择题 下列字符串中不能作为C++标识符使用的是______。
选择题 已知函数func的原型为
int func(int,int);
则下列选项中,不能作为它的重载函数原型的是______。
选择题 数据结构主要研究的是数据的逻辑结构、数据的运算和______。