填空题在C++语言中,一个short型数据在内存中占用2个字节,则unsigned short型数据的取值范围为
________
。
填空题下列程序的运行结果是______。
#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()<<end1;
}
填空题阅读下面程序:#include <iostream.h>long fib(int n)if (n>2)return (fib(n-1) + fib(n-2));elsereturn (2);void main()cout<<fib(3)<<end1;则该程序的输出结果应该是 【12】 。
填空题给出下列二叉树的前序序列[1]。
填空题下面程序的输出结果是{{U}} 【8】 {{/U}}。
#include <iostream>
using namespace std;
int x;
void funA(int
void funB(int,int
int main()
{
int first;
int second=5;
x=6;
funA(first,second);
funB(first,second);
cout<<first<<" "<<second<<" "<<x<<endl;
return 0;
}
void funA(int
first=a+b;
a=2*b;
b=first+4;
}
void funB(int u,int
second=x;
v=second+4;
x=u+v;
}
填空题高度为h(h>0)的二叉树最少有{{U}} [3] {{/U}}个结点。
填空题下列程序的输出结果是 【8】 。 #include <iostream> #include <cstring> using namespace std; void fun(const char *s, char int main() char str[]="ABCDE"; char ch=str[1]; fun(str, ch); cout<<ch; return 0;
填空题下列程序的输出结果是______。
#include<iostream.h>
class base
{
int x,y;
public:
base(int i,int j){x=i;y=j;}
virtual int add( ){return x+y;}
};
class three:public base
{
int z;
public:
three(int i,int j,int k):base(i,j){z=k;)
int add( ){return(base::add( )+z);}
};
void main( )
{
three*q=new three(10,20,30);
cout<<q->add( )<<endl;
}
填空题将代数式转换成程序设计中的表达式为。
填空题请将下列类定义补充完整。 class Basepublic:void fun()cout<<"Base::fun"<<end1;; class Derived:public Base public: void fun() ______//显示调用基类的fun函数 cout<<"Derived::fun"<<end1; ;
填空题阅读下面的程序: #include<iomanip.h> void main() cout.fill('!'); cout<<setiosflags(ioS::left)< cout<<setw(6)<<1024<<endl; 写出该程序的输出结果: 【11】 。
填空题已知程序的结果为1 2 3,请填空。
#include<iostream.h>
template<class T>
class A
{
public:
T x,y,Z;
void display( ) {cout << x << " " << y << " " << z;}
};
void main( )
{
A<int>a1;
{{U}} 【12】 {{/U}}
{{U}} 【13】 {{/U}}
{{U}} 【14】 {{/U}}
a1.display( );
}
填空题每个以符号________开头的行,为编译预处理行。
填空题以下程序的输出结果是 。 #include<iostream.h> void fun( ) static int a=0; a+=2; cout < < a < < " "; void main( ) int cc; for(cc=1;cc<4;cc++) fun( ) ; cout < < endl;
填空题常用的黑箱测试有等价分类法、边值分析法、错误推测法和{{U}} 【4】 {{/U}}等4种。
填空题类time可以输出12小时或24小时制的时间,现需要设计一个缺省构造函数,缺省值为0时0分0秒。该缺省构造函数为 【14】 。 # include<iostream. h> class Time int h.m,s; public: Time(int hour=0 .int min=0 ,int sec=0) settime(hour,min,sec); void settime(int hour,int min,int sec) h=hour; m=min s=sec; void show24() cout<<(h<1O?"0":"")<<h<<":"<<(m<10?"0":"")<< m<<":"MM(s<10?"0":"")<<s<<end1 void show12( ) int temp=(h==‖h==12)? 12:h%12; cout<<(temp<10?"0":"")<<temp<<":"<<(m<10?"0":"") <<m<<":"<<(s<10? "0":"")<<s<<((temp>0 void main() Time t(15,43,21) t. show12(): t. show24()
填空题表达式operator++(x,int)其可以表示为{{U}} 【7】 {{/U}}。
填空题有如下定义: class MA int value: public: MA(int n=0):v;alut(n) ; MA * ta,tb: 其中MA类的对象名标识符是______。
填空题某二叉树有5个度为2的结点以及3个度为1的结点,则该二叉树中共有 {{U}} 【1】 {{/U}}个结点。
填空题构造函数与析构函数所调用的虚函烽是所在类的函数,因此调用时实现的是{{U}} [14] {{/U}}联编。
