[计算机类试卷]国家二级(C++)机试模拟试卷83及答案与解析.doc
《[计算机类试卷]国家二级(C++)机试模拟试卷83及答案与解析.doc》由会员分享,可在线阅读,更多相关《[计算机类试卷]国家二级(C++)机试模拟试卷83及答案与解析.doc(30页珍藏版)》请在麦多课文档分享上搜索。
1、国家二级( C+)机试模拟试卷 83及答案与解析 一、选择题 1 在软件开发中,需求分析阶段产生的主要文档是 ( )。 ( A)可行性分析报告 ( B)软件需求规格说明书 ( C)概要设计说明书 ( D)集成测试计划 2 在函数中,可以用 auto、 extern、 register和 static这四个关键字中的一个来说明变量的存储类型,如果不说明存储类型,则默认的存储类型是 ( )。 ( A) auto ( B) extern ( C) register ( D) static 3 有如下程序: #include using namespace std; class Sample frie
2、nd long fun(Sample s); public: Sample(long a) x = a; private: long x; ; long fun(Sample s) if (s.x using namespace std; class Point public: Point(int xx=0,int yy=0):x(xx),y(yy) void SetX(int xx) x=xx; void SetY(int yy) y=yy; private: int x,y; ; class Circle:public Point public: Circle(int r):radius(
3、r) int GetRadius() return radius; private: void SetRadius(int r) radius=r; int radius; ; int main() Circle c1(5); c1.SetX(1); / c1.SetY(2); / c1.SetRadius(10); / cout #include using namespace std; class Animal public: virtual string GetType() const return “Animal“; virtual string GetVoice() const re
4、turn “Voice“; ; class Dog:public Animal public: string GetType() const return “Dog“; string GetVoice() const return “Woof“; ; class Cat:public Animal public: string GetType() const return “Cat“; string GetVoice() const return “Miaow“; ; void Type(Animal 若执行函数调用表达式 P(1.3,2),函数 P被调用的次数是 ( A) 1 ( B) 2
5、( C) 3 ( D) 4 12 若目前 E盘根目录下不存在 data.txt文件,则下列打开文件 方式不会自动创建data.txt文件的是 ( A) ifstreamfin;fin.open(“e:data.txt“,ios_base:in); ( B) fstreamfio;fio.open(“e:data.txt“,ios_base:out); ( C) ofstreamfout;fout.open(“e:data.txt“,ios_base:out); ( D) ofstreamfout;fout.open(“e:data.txt“,ios_base:app); 13 已知数组 arr
6、的定义如下: int arr5 = 1,2,3,4,5; 下列语句中输出结果不是 5的是 ( A) cout using namespace std; class Base public: void output() coutoutput(); ptr-Print(); delete ptr; return 0; 执行这个程序的输出结果是 ( )。 ( A) 1B ( B) 1D ( C) 2B ( D) 2D 23 有如下程序: #include using namespace std; int main() int sum; for(int i = 0; i using namespace
7、 std; class Base public: void fun() coutfun(); ( C) Base:fun(); ( D) fun(); 25 下列关于栈的叙述中,正确的是 ( A)栈底元素一定是最后入栈的元素 ( B)栈顶元素一定是最先入栈的元素 ( C)栈操作遵循先进后出的原则 ( D)以上说法均错误 26 计算斐波那契数列第 n 项的函数定义如下: int fib(int n) if (n = 0) return 1; else if (n = 1) return 2; else return fib(n-1)+fib(n-2); 若执行函数调用表达式 fib(4),函数
8、fib 被调用的次数是 ( A) 6 ( B) 7 ( C) 8 ( D) 9 27 有如下程序: #include using namespace std; class Appliance public: Appliance() Appliance() cout using namespace std; class A public: virtual void func1() coutfunc1(); p-func2(); delete p; return 0; 执行这个程序的输出结果是 ( )。 ( A) B1B2 ( B) A1A2 ( C) B1A2 ( D) A1B2 35 语句 i
9、nt*p=定义了指针 p,与这个语句等效的语句序列是 ( )。 ( A) int*p;p= ( B) int*p;p=k; ( C) int*p;*p= ( D) int*p;*p=k; 36 有如下类定义: class MyClass int value; public: MyClass(int n): value (n) int getValue()const return value; ; 则类 MyClass的构造函数的个数是 ( )。 ( A) 1个 ( B) 2个 ( C) 3个 ( D) 4个 37 下面不属于需求分析阶段任务的是 ( )。 ( A)确定软件系统的功能需求 ( B
10、)确定软件系统的性能需求 ( C)需求规格说明书评审 ( D)制定软件集成测试计划 38 下列关于派生类构造函数和析构函数的叙述中,错误的是 ( A)如果基类中没有缺省构造函数,那么派生类必须定义构造函数 ( B)派生类的构造函数会隐含调用基类的构造函数 ( C)在建立派生类对象时,先调用基类的构造函数,再调用派生类的构造函数 ( D)在销毁派生类对象时,先调用基类的析构函数,再调用派生类的析构函数 39 下面属于白盒测试方法的是 ( A)等价类划分法 ( B)逻辑覆盖 ( C)边界值分析法 ( D)错误推测法 40 有如下类声明: class Wd int a; public: int b;
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 试卷 国家 二级 模拟 83 答案 解析 DOC
