选择题 有下列程序:
#include <stdio.h>
#define PT 3.5;
#define S(x) PT*x*x;
votd main()
{ int a=1;b=2; prinif('%4.If\n',S(a+b));}
程序运行后的输出结果是______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class CA{
public:
virtual int f(){return 1;}
};
class GB:public GA{
public:
virtual int f(){return 2;}
};
void show(GA g){cout<<g.f();}
void display(GA g){cout<<g.f();}
int main()
{
GA a;show(a);display(a);
CB b;show(b);display(b);
return 0;
}
执行这个程序的输出结果是______。
选择题 有如下程序:
#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;
}
程序的输出结果是______。
选择题 有以下程序:
#include <iostream>
using namespace std;
class count
{
static int n;
public:
count ( )
{
n++;
}
static int test()
{
for (int i = 0; i < 4; i++ )
n++;
return n;
}
};
int count :: n = 0;
int main()
{
cout<<count :: test()<<' ';
count c1, c2;
cout<<count :: test()<<end1;
return 0;
}
执行后的输出结果是 。
选择题 程序流程图中带有箭头的线段表示的是______。
选择题 结构化程序设计的3种结构是______。
选择题 已知递归函数fun的定义如下:
int fun(int n)
{ if(n<=1)return 1;//递归结束情况
else return n*fun(n-2);//递归
}
则函数调用语句fun(5)的返回值是______。
选择题 语句cout<<(a=2)(b=-2);的输出结果是______
选择题 下面有关类模板的说法中不正确的是 。
选择题 重载输入流运算符>>必须使用的原型为______。
选择题设有如下关系表:则下列操作正确的是______。
选择题 下面程序输出的结果为
#include' iostream.h'
class A
{
public:
A( ) { cout < < 'CLASS A' < < end1;}
~ A( ) { }
};
class B:public A
{
public:
B( ){ cout < < 'CLASS B' < < end1;}
~ B( ) { }
};
void main( )
{
A * p;
p=new B;
B * q;
q=new B;
}
选择题 下列的方法中,不属于软件调试技术的是 。
选择题 已知主函数中通过如下语句序列实现对函数模板swap的调用:
int a[10],b[io];
swap(a,b,10);
下列对函数模板swap的声明中,会导致上述语句序列发生编译错误的是______。
选择题 有如下程序:
# include<iostrcam>
using namespace std;
int main(){
int f,f1=0,f2=1;
for(int i=3;i<=6;i++){
f=f1+f2;
f1=f2;f2=f;
}
cout<<f<<endl;
return 0;
}
运行时的输出结果是______。
选择题 循环链表的主要优点是 。
选择题 下列叙述中,正确的是______
选择题 下列关于函数的描述中,错误的是______。
选择题 有如下程序:
#include<iostream>
#include<cstring>
using namespace std;
class Name{
char name[20];
public:
Name(){strcpy(name,''); cout<<'?';}
Name(char*fname){strcpy(name,fname);cout<<'?';}
};
int main(){
Name names[3]={Name('张三'),Name('李四')};
return 0;
}
运行此程序输出符号?的个数是______。
选择题 若有以下程序:
#include <iostream>
using namespace std;
class Base
{
private:
int a,b;
public:
Base(int x, int y)
{
a=x;
b=y;
}
void show()
{
cout<<a<<', '<<b<<end1;
}
};
class Derive : public Base
{
private:
int c, d;
public:
Derive(int x, int y, int z,int m):Base(x,y)
{
c=z;
d=m;
}
void show()
{
cout<<c<<', '<<d<<end1;
}
};
int main ( )
{
Base b(50,50) ,*pb;
Derive d(10,20,30,40);
pb=d;
pb->show {);
return 0;
}
