选择题 有如下类定义:
class B{
public:void funl(){}
private:void fun2(){}
protected:void fun3(){}
};
class D:public B{
protected:void fun4(){}
};
若obj是类D的对象,则下列语句中不违反访问控制权限的是______。
选择题对下列二叉树进行中序遍历的结果是______。
选择题 下列模板声明中,有语法错误的是______。
选择题 执行下列语句段后,输出字符“*”的个数是______。
for(int i=50;i>1;I-=2)cout<<'*';
选择题 下列叙述正确的是______。
选择题 若有如下语句:
#include<iostream.h>
void main( )
{
int x=3;
do{
x=x-2;
cout < < x;
}while(!(--X) ) ;
}
则上面程序段______
选择题 下列各函数的说明中,表示纯虚函数的是 。
选择题 有如下程序:
#include<iostream>
using namespace std;
void f1(intx){x++;}
void f2(int x){++x;}
int main(){
int x=10,y=12;
f1(x);
f2(y);
cout<<x+y<<endl;
return 0;
}
运行这个程序的输出结果是______。
选择题 以下程序中调用cin函数给变量a输人数值的方法是错误的,其错误的原因是______。
#include<iostream.h>
void main()
{ int*p,*q,a,b;
p=&a;
cout<<'input a;';
cin>>p;
}
选择题 若目前D盘根目录下并不存在test.txt文件,则下列打开文件方式不会自动创建test.txt文件的是______。
选择题 设有定义charstr[80]以下不能将输人数据nrst\nsecond\<CR)读取到数组str的语句是 。
选择题 有如下程序:
#include<iostream>
using namespace std;
void function2(int n);
void function1(int n){
if(n<=0)return;
function2(n-2);
}
void function2(int n){
if(n<=0)return;
function1(n-1);
}
int main(){
function1(5);
return 0;
}
下列关于程序运行情况的描述中,正确的是______。
选择题 下列程序的输出结果是
#include<iostream.h>
void main()
{char*str='12123434';
int x1=0,x2=0,x3=0,x4=0,i;
for(i=0;str[i]!='\0';i++)
switch(str[i])
{case'1':x4++;
case'2':X3++;
case'3':X2++;
case'4':X1++;
}
cout<<X1<<','<<X2<<','<<X3<<','<<X4;
选择题 有定义语句“char s[10];”,若要从终端给s输入5个字符,错误的输入语句是______。
选择题 决定C++语言中函数的返回值类型的是______
选择题 有如下程序:
#include<iostream>
#include<iomnaip>
using namespace std;
int main(){
cout<<setfill('*')<<setw(6)<<123<<456;
return 0;
}
运行时的输出结果是______。
选择题 结构化程序设计方法的主要原则有下列4项,不正确的是______。
选择题 下列说法中,不属于数据模型所描述的内容的是______
选择题 若已定义了类Vehicle,则下列派生类定义中,错误的是______。
选择题 为完成下面的程序,在画线处应填入的语句是______。
#included<iostream>
using namespace std;
class Base
{
int x;
public:
Base(int i){x=i;}
~Base(){}
};
class Derived:public Base
{
public:
______//完成类Derived构造函数的定义
};
int main()
{
Derived obj(2);
return 0;
}
