选择题 C++系统预定了4个用于标准数据流的对象,下列选项中不属于此类对象的是______。
选择题 下列叙述中正确的是______。
选择题 有如下程序:
#include<iostream>
using namespace std;
class Base
{
private:
void fun1() const{cout<<'fun1';}
protected:
void fun2() const{cout<<'fun2';}
public:
void fun3() const{cout<<'fun3';}
};
class Derived:protected Base
{
public:
void fun4() const{cout<<'fun4';}
};
int main()
{
Derived obj;
obj.fun1(); //①
obj.fun2(); //②
obj.fun3(); //③
obj.fun4(); //④
return 0;
}
其中有语法错误的语句是______。
选择题 以下程序的输出是 。
struct st
{
int x;int *y;
}
*p;
int dt[4]={10,20,30,40};
struct st aa[4]={50,dt[0],60,dt[0],60,dt[0],60,dt[0],};
main()
{
p=aa;
cout<+<+(p->x);
}
选择题 表示在输出时显示小数位,和在文件输入时判断文件尾的函数分别是 。
选择题 在计算机中,算法是指______。
选择题 下列各类函数中,不是类的成员函数的是 。
选择题 有以下程序:
#include<iostream>
using namespace std;
int f(int,int);
int main()
{
int i:1,x;
x=f(i,i+1);
cout<<x<<end1;
return 0;
}
int f(int a,int b)
{
int c;
c = a;
if(a>b)
c = 1;
else if(a==b)
c = 0;
else
c = -2;
return c;
}
运行后的输出结果是 。
选择题 下列程序的输出结果是
#include<iostream.h>
void main( )
{ double d=3.2;
int x,y;
x=1.2;
y=(x+3.8)/5.0;
cout < < y * d < < end1;}
选择题 有如下类定义:
class XX{
int xx;
public:
XX():xx(0){cout<<'A';)
XX(int n):xx(n){cout<<'B';}
};
class YY:public XX{
int yy;
public:
YY():yy(0){cout<<yy;}
YY(int n):XX(n+1),yy(n){cout<<yy;}
YY(int m,int n):XX(m),yy(n){cout<<yy;}
};
下列选项中,输出结果为AO的语句是______。
选择题 以下选项中合法的用户标识符是 。
选择题 若已定义过类A和B,并且定义类C如下:
class C{
public:
int val;
A aObj;
B bObj;
C*cObj;
C(): cObj(0), val(0){}
};
若要建立类C的对象object,则类成员val、aObj、bObj和cObj中最后被初始化的是______。
选择题 while和do-while循环的主要区别是______
选择题 打开文件时可单独或组合使用下列文件打开模式:
①ios_base::app ②ios_base::binary
③ios_base::in ④los_base::out
若要以二进制读方式打开一个文件,需使用的文件打开模式为______。
选择题 当使用fstream流类定义一个流对象并打开一个磁盘文件时,文件的隐含打开方式为 。
选择题 定义如下枚举类型:enum{Monday,Tuesday,Wednesday,Thursday,Friday=2};表达式 Wednesday= =Friday的值是 。
选择题 有如下程序
#include <iostream>
using namespace std;
class A{
public:
virtual void func1 (){ cout<<'A1'; }
void func2(){ cout<<'A2'; }
};
class B: public A{
public:
void func l(){ cout<<'B1'; }
void func2(){ cout<<'B2'; }
};
int main() {
A *p=new B;
p->func1();
p->func2();
return 0;
}
运行此程序,屏幕上将显示输出 。
选择题 下列叙述中正确的是______
选择题 如果算符函数调用格式的表达式:x.operator-(operator++(y,0)中的“—”是作为成员函数重载的,“++”是作为友元函数重载的,那么该表达式还可以表示为:______
选择题 某二叉树共有7个结点,其中叶子结点只有1个,则该二叉树的深度为(假设根结点在第1层) 。