填空题由关系数据库系统支持的完整性约束是指{{U}} 【5】 {{/U}}和参照完整性。
填空题对具有n个结点的线性表进行顺序查找,最坏情况下需要的比较次数为 【1】 。
填空题有如下程序:
#include <iostream>
using namespace std;
class A {
public:
A() { cout << "A"; }
~A() {cout << "A"; }
};
class B {
A a;
public:
B() {cout << "B"; }
~B() { cout << "B"; }
};
int main() {
B b;
return 0;
}
程序的输出结果是{{U}} 【10】 {{/U}}。
填空题定义字符指针char *str="hello",已知sizeof(str)=4,则strlen(str)=______。
填空题C++语言的标识符是以字母或______开头的,由字母、数字、______组成的字符串。
填空题重载的运算符保持其原有的{{U}} 【14】 {{/U}}、优先级和结合性不变。
填空题下列程序的输出结果是{{U}} 【7】 {{/U}}。
# include<iostream. h>
void main() {
char a[]= "abcdabcabfgacd"
int i1=0,i2=0,i=0;
while (a[i])
{
if (a[i]="a") i1++;
if (a[i]=="b") i2++;
i++;
}
cout <<i1<<" "<<i2<<end1;
}
填空题线性表的存储结构主要分为顺序存储结构和链式存储结构。队列是一种特殊的线性表,循环队列是队列的{{U}} 【3】 {{/U}}存储结构。
填空题下面程序的输出结果为 【8】 。 #include<iostream.h) Void main() int num=0,i=8; do i--; num++ while(--i); cout<<num<<end1;
填空题创建对象数组时,对数组的每一个元素都将调用一次构造函数,如果没有显式给出数组元素的初值,则调用缺省构造函数。下列程序涉及到对象数组的创建和单个对象的创建,其输出结果是{{U}} 【9】 {{/U}}。
#include<iostream>
using namespace std;
class Foo{
public:
Foo(int x){cout<<'A';}
Foo(){}
};
int main()
{
Foo f[3], g(3);
return 0;
}
填空题以下程序段给数组A的所有元素输入数据,请填空。
# include<iostream. h>
void main () {
int a[10], i;
i=0;
while (i<10) cin>>{{U}} [8] {{/U}}
}
填空题下列程序的运行结果是{{U}} 【9】 {{/U}}。
# include <iostream. h>
class test
{
private:
int num;
public:
test()
int TEST() {return num+100;}
~test()
};
test::test(){num=0;}
test::~test(){cout<<"Destructor is active"<<endl;}
void main()
{
test x[3]
cout<<x[1]. TEST()<<endl;
}
填空题使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正其中的错误,使程序正常运行,并且输出以下结果:
(4,5) 7,8 (4,8)
注意:错误的语句在//******error******的下面,修改该语句即可。 试题程序:
#include<iostream.h> class TC0 {
public: TC0(int i,int j) {
x=i; y=j; }
//******error****** virtual void move(int a;int b)
{ X+=a; y+=b;
} void print() {
cout<<"("<<x<<","<<y<<")"<<end1; }
public: int x,y; }; class
TC1:public TC0 { public:
//******error****** TC1(int i,int j,int k):(i,j)
{ m=k; n=1;
} void print() {
cout<<m<<","<<n<<end1; } void func()
{ move(3,5); } void
display() { //******error******
print(); } private:
int m,n; }; void main()
{ TC0 obj(4,5); obj.print();
TC1 obj1(1,3,7,8); obj1.func();
obj1.print(); obj1.display(); }
填空题以下程序的执行结果为 【8】 。 #include<iostream> using namespace std; class base public: virtual void who( ) cout<<"base class"<<endl; ; class derivel:public base public: void who( ) cout<<"derivel class"<<endl; ; class derive2:public base public: void who( ) cout<<"derive2 class"<<endl; ; void main( ) base objl,*p; derivel obj2; derive2 obj3; P=&objl; p->who( ); p=&obj2; p->who( ); p=&obj3; p->who( );
填空题下列程序输出结果是 【13】 。 include <iostream> using namespace std; template <typename T> T fun(T a, T b) return (a<=b)?a:b; int main() cout<<fun(3,6)<<','<<fim(3.14F, 6.28F)<<end 1; return 0;
填空题以下程序的输出结果是【 】。
#include<iostream.h>
class object
{ private:
int va1;
public:
object( );
object(int i)
~object( );} ;
object::Object( )
{ va1=0;
cout < < "Default constructor for object" < < end1;}
object::object(int i)
{ va1=i
cout < < "Constructor for object" < < va1 < < end1;}
object::~object( )
{ cout < < "Destructor for object" < < va1 < < end1;}
class container { private:
object one;
object two;
int data;
public:
container( );
container(int i,int j,int k);
~container( );} ;
container::container( )
{ data=0;
cout < < "Default constructor for container" < < end1;}
container::container(int i,int j,int k):two(i),one(j)
{ data=k;
cout < < "Constructor for container" < < end1;}
container::~container( )
{ cout < < "Destructor for container" < < end1;}
void main( )
{ container anObj(5,6,10);}
填空题设置虚基类的目的是解决二义性问题,通过用关键字______表示虚基类。
填空题下面程序的结果为______。 #include<iostream.h> void main() int a=1,b=2; bool c=1; if((a>b)||c)cout<<"true"<<end1; else cout<<"false"<<end1;
填空题若从键盘输入70,则以下程序输出的结果是 【8】 。#include<iostream.h>void main()int a; cin>>a;if(a>50) cout<<a;if(a>40) cout<<a;if(a>30) cout<<a;
填空题十进制数28和3.26的类型分别为{{U}} {{U}} {{/U}} {{/U}}和{{U}} {{U}} {{/U}} {{/U}}。