[计算机类试卷]国家二级(C++)机试模拟试卷73及答案与解析.doc
《[计算机类试卷]国家二级(C++)机试模拟试卷73及答案与解析.doc》由会员分享,可在线阅读,更多相关《[计算机类试卷]国家二级(C++)机试模拟试卷73及答案与解析.doc(31页珍藏版)》请在麦多课文档分享上搜索。
1、国家二级( C+)机试模拟试卷 73及答案与解析 一、选择题 1 下列语句中,错误的是 ( )。 ( A) constintbuffer=256; ( B) constinttemp; ( C) constdouble*point; ( D) constdouble*rt=newdouble(5.5); 2 由于常对象不能被更新,因此 ( )。 ( A)通过常对象只能调用它的常成员函数 ( B)通过常对象只能调用静态成员函数 ( C)常对象的成员都是常成员 ( D)通过常对象可以调用任何不改变对 象值 3 在 C+中, cin是一个 ( )。 ( A)类 ( B)对象 ( C)模板 ( D)函
2、数 4 执行下列语句段后,输出字符 “*“的个数是 ( )。 for (int i=50; i1; i-=2) cout using namespace std; class Shape /图形类 public: /图形绘制函数(用显示字母模拟) virtual void draw()const coutdraw(); int main() Shape s; Triangle t; plot( plot( s=t; s.draw(); return 0; 运行这个程序的输出是 ( A) STT ( B) STS ( C) TSS ( D) TTT 18 下列函数声明中,错误的是 ( A) vo
3、idfun(intx=0,inty=0); ( B) voidfun(intx,inty=0); ( C) voidfun(intx=0,inty); ( D) voidfun(intx,inty); 19 若 Pay 是一个类名,则执行语句 Pay p1,p22,*p3; 时 Pay 的构造函数被调用的次数是 ( A) 1 ( B) 2 ( C) 3 ( D) 4 20 下列语句中,错误的是 ( )。 ( A) constintbuffer=256; ( B) constdouble*point; ( C) intconstbuffer=256; ( D) double*constpoint
4、; 21 下列关于派生类构造函数和析构函数的说法中,错误的是 ( )。 ( A)派生类的构造函数会隐含调用基类的构造函数 ( B)如果基类中没有缺省构造函数,那么派生类必须定义构造函数 ( C)在建立派生类对象时,先调用基类的构造函数, 再调用派生类的构造函数 ( D)在销毁派生类对象时,先调用基类的析构函数,再调用派生类的析构函数 22 下列叙述中正确的是 ( )。 ( A)栈是一种先进先出的线性表 ( B)队列是一种后进先出的线性表 ( C)栈与队列都是非线性结构 ( D)以上三种说法都不对 23 若已经声明了函数原型 “boolfun(boola,intb=0);“,则下列重载函数声明中
5、正确的是 ( A) boolfun(boola=true,intb=0); ( B) intfun(boola,intB); ( C) voidfun(doublea,intB); ( D) voidfun(boola,intb=0); 24 有如下程序: #include #include using namespace std; class Person public: Person(string n):name(n) Person() cout using namesapce std; int return r; int main() int a=1,3,5,7; cout using
6、namespace std; class GA public: virtual int f() return 1; ; class GB: public GA public: virtual int f() return 2; ; void show(GA g) cout using namespace std; class Point public: Point(int xx=0,int yy=0):x(xx),y(yy) protected: void SetXY(int xx,int yy) x=xx; y=yy; private: int x,y; ; class Circle:pub
7、lic Point public: Circle(int r):radius(r) void Set(int r,int x,int y) radius=r; SetXY(x,y); / void Print() const cout using namespace std; int main() int a6=27,57,20,42,56,18; int s1,s2; s1=s2=a0; for(int* p=a+1;p-a*p?*p:s1; s2=s2 using namespace std; class TV public: TV(int s=41):size(s) void Print
8、() cout #include usingnamespacestd; clasSPoint doublex, y; public: Point(doublex=0 0, doubley=0 0) ERROR*found* x=x; y=y; ) doublegetX()constreturnx; doublegetY()constreturny; ) ERROR*found* voidshow()constcoutusingnamespacestd; classDate日期类 intyear, month, day;年、 A、日 public: Date(intyear, intmonth,
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 试卷 国家 二级 模拟 73 答案 解析 DOC
