选择题 有如下程序:
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
cout<<setfill('#;)<<setw(4)<<'OK'<<123<<endl;
return 0;
}
选择题 对长度为n的线性表进行顺序查找,在最坏情况下所需要的比较次数为______。
选择题 下列关于类和对象的叙述中,错误的是 。
选择题 下列程序的运行结果是______。
#include<iostream.h>
int x=5;
int fun(int a)
{
int c;
c-x*a;
return C;
}
void main()
{
int x=3,a=4;
x=x+fun(a);
cout<<'x='<<x<<endl;
}
选择题 若调用一个函数,且此函数中没有return语句,则正确的说法是该函数 。
选择题 关于getline()函数的下列描述中, 是错误的。
选择题 关于关键字class和typename,下列表述中正确的是______。
选择题 若有以下函数调用语句:fun(m+n,x+y,f(m+n,z,(x,y)));在此函数调用语句中实参的个数是 。
选择题 以下哪个是软件测试的目的?______
选择题 进行文件操作需包含的头文件是 。
选择题 已知枚举类型声明语句为:
enumCOLOR{WHITE,YELLOW,GREEN=5,RED,BLACK=10};
则下列说法中错误的是______
选择题 有如下程序:
#include<iostream>
using namespace std;
int main(){
int i,s=0;
for(i=1;s<20;i+=2)s+=i*i;
cout<<i<<endl;
return 0;
}
运行这个程序的输出结果是______。
选择题 以下for语句中不是死循环的是______。
选择题 下列关于派生类的构造函数的叙述中,正确的是 。
选择题 若有以下程序:
#include <iostream>
using namespace std;
int main()
{
int a[4] [4] = {{1,2,3,-4},{0,-12,-13,14},
{-21,23,0,-24},{-31,32,-33,0}};
int i,j,s = 0;
for(i=0;i<4;i++)
{
for(j=O;j<4;j++)
{
if(a[i] [j] >=0)
continue;
s+=a [i] [j];
}
}
cout<<s<<end1;
return 0;
}
执行后的输出结果是______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class Instrument{
public:
virtual void Display()=0;
};
class Piano:public Instrument{
public:
void Display(){/*函数体略*/}
};
int main(){
Instrument s;
Instrument*p=0;
//…;
return 0;
}
下列叙述中正确的是______。
选择题 为了取代C中带参数的宏,在C++中使用______。
选择题 下列关于继承方式的描述中,错误的是______。
选择题 设有以下定义和程序:
#include<iostream.h>
class TestClass1
{
public:
void show1()
{
cout<<'TestClass1'<<endl;
}
};
class TestClass2:TestClass1
{
public:
void show2()
{
cout<<'TestClass2'<<endl;
}
};
class TestClass3:protected TestClass2
{
public:
void show3()
{
cout<<'TestClass3'<<endl;
}
};
void main()
{
TestClass1 obj1;
TestClass2 obj2;
TestClass3 obj3;
}
则以下不合语法的调用语句是______。
选择题 若定义cin>>str;当输入Hello World!,所得的结果是str= ______。