选择题 下列结构体类型说明和变量定义中正确的是______。
选择题 已知函数FA调用函数FB,若要把这两个函数定义在同一个文件中,则______。
选择题 己知函数print()没有返回值,如果在类中将之声明为常成员函数,正确的是______。
选择题 下列程序的输出结果是
main()
{int x=1,a=0,b=0;
switch(x){
case 0: b++;
case 1: a++;
case 2: a++;b++;
}
cout<<'a='<<a<<'b='<<b<<endl;
}
选择题 有如下程序:
#include<iostream>
using namespace std;
class Base{
public:
Base(int x=0){cout<<x;}
};
class Derived:public Base{
public:
Derived(int x=0){cout<<x;}
private:
Base val;
};
int main(){
Derived d(1);
return 0;
}
程序的输出结果是______。
选择题 将下面类TestClass中的函数fun()的对象成员n值修改为100的语句应该是 。
class TcstClass
{
public:
TestClass(int x){n=x;}
void SetNum(int n1){n=n1;}
private:
int n;
}
int fun()
{
TestClass*ptr=new TestClass(45);
______;
}
选择题 数据库关系模型中可以有三类完整性约束,下列选项中不属于三类完整性约束的是 。
选择题 对关系S和R进行集合运算,结果中既包含S中的所有元组也包含R中的所有元组,这样的集合运算称为______。
选择题 下列函数的运行结果是______。
#include<iostream.h>
int add(int a,int b);
void main()
{
extern int x,y;
cout<<add(x,y)<<endl;
}
int x(20),y(5);
int add(int a,int b)
{
int s=a+b;
return s;
}
选择题 有如下程序:
#include<iostream>
using namespace std;
class Boat;
class Car{
public:
Car(int i):weight(i){}
friend int Total(const Car c.const Boatb); //①
private:
int weight;
};
class Boat{
public:
Boat(int i):weight(i){}
friend int Total(const Car c, const Boat b);
private:
int weight;
};
int Total(const Car c, const Boat b){ //②
return c.weight+b.weight;
}
int main(){
Car c(10);
Boat b(8);
cout<<'The total weight is'<<Total(c, b)<<endl; //③
return 0;
}
下列关于程序的描述中,正确的是______。
选择题 下面程序的结果是
#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;}
选择题 包容类Contain和内嵌类Embed定义如下:
#include<iostream.h>
class Contain
{
private:
int x;
protected:
int z;
public:
class Embed
{
private:
int y;
public:
Embed(){y=100;}
int Embed_Fun();
}MyEmbed;
int Contain_Fun();
};
对上面的定义,正确的描述是 。
选择题 已知类CC以成员函数方式重载了二元运算符*,c1和c2是CC类的两个对象,则下列对该运算符的调用中错误的是
选择题 有如下程序:
#include<iostream>
using namespace std;
class B{
public:
virtual void f(){cout<<'B';}
void g(){cout<<'B';}
};
class D:public B{
public:
void f(){cout<<'D';}
void g(){cout<<'D';}
};
void h(B* p){p->f(); p->g();}
int main(){
D obj;
h(obj);
return 0;
}
运行这个程序的输出结果是______。
选择题 在面向对象方法中, 描述的是具有相似属性与操作的一组对象。
选择题 关系表中的每一行记录称为一个______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class Part{
public:
Part(int x =0):val(x){cout<<val;}
~Part(){cout<<val;}
private:
int val;
};
class Whole{
public:
Whole(int x,int y,int z=0):p2(x),p1(y),val(z){cout<<val;}
~Whole(){cout<<val;}
private:
Part p1,p2;
int val;
};
int main()
{
Whole obj(1,2,3);
return 0;
}
执行这个程序的输出结果是______。
选择题 下列关于模板的叙述中,错误的是______。
选择题 设有定义int x; float y;,则10+x+y值的数据类型是______。
选择题 下列控制格式输入/输出的操作符中,能够设置浮点数精度的是______。
