[计算机类试卷]国家二级C++机试(选择题)模拟试卷107及答案与解析.doc
《[计算机类试卷]国家二级C++机试(选择题)模拟试卷107及答案与解析.doc》由会员分享,可在线阅读,更多相关《[计算机类试卷]国家二级C++机试(选择题)模拟试卷107及答案与解析.doc(20页珍藏版)》请在麦多课文档分享上搜索。
1、国家二级 C机试(选择题)模拟试卷 107及答案与解析 一、选择题 1 下列关于 this指针的描述中,正确的是 ( )。 ( A)类的成员函数都有 this指针 ( B)类的友元函数都有 this指针 ( C)任何与类相关的函数都有 this指针 ( D)类的非静态成员函数都有 this指针 2 有如下程序: #include using namespace std; class Test public: Test() n2; Test() n- 3; static hat getNum()return n; private: static int n; ; hatTest: n 1; in
2、t main() Test*p newTest; delete p; cout ( A) n 0 ( B) n 1 ( C) n 2 ( D) n 3 3 有如下程序: #include using namespace std; class Obj static hat i; public: Obj()i; bj()i-; static int getVal()return i; ; int Obj i 0; void f()Obj oh2; cout*ob3 new Ohj; coutgetVal(); delete ob3; cout ( A) 232 ( B) 231 ( C) 222
3、( D) 221 4 有如下程序: #include using namespace std; class MyClass public: MyClass0 count; MyClass0一 count; static int getCount()return count; private: static hat count; ; int MyClass count 0; int main() MyClass obj; cout*prtnew MyClass; cout ( A) 121 ( B) 232 ( C) 221 ( D) 122 5 有如下类定义: class Point priv
4、ate; static int how_many; ; _how_many 0; 要初始化 point的静态成员 how_many,下划线处应填入的内容是 ( )。 ( A) ing ( B) static int ( C) int Point ( D) static int Point 6 有如下类和对象的定义: class Constants public; static double getPl0return 3 1416; ; Constants constants; 下列各组语句中,能输出 3 1416的是 ( )。 ( A) coutgetPI();和 coutgetPI();和
5、coutgetPl(); ( D) cout using namespace std; class XA int a; public: static int b; XA(int aa): a(aa)b; int getA()return a; ; int XA b 0; int main() XA d1(4), d2(5); cout using namespace std; int i 1; class Fun public: static int i; int value()return i-1; int value()constreturn i l; ; int Fun i 2; int
6、 main() int i 3; Fun fun1; const Fun fun2; return 0; 若程序的输出结果是: 123 则程序中下划线处遗漏的语句是 ( )。 ( A) cout using namespace std; class VAC public; int f() constreturn 3; ) int f()return 5; ) ; Int main() VAC v1; const VAC v2; cout using namespace std; class MyClass public: MyClass(int x): Val(x) void Set(int
- 1.请仔细阅读文档,确保文档完整性,对于不预览、不比对内容而直接下载带来的问题本站不予受理。
- 2.下载的文档,不会出现我们的网址水印。
- 3、该文档所得收入(下载+内容+预览)归上传者、原创作者;如果您是本文档原作者,请点此认领!既往收益都归您。
下载文档到电脑,查找使用更方便
2000 积分 0人已下载
下载 | 加入VIP,交流精品资源 |
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机 试卷 国家 二级 机试 选择题 模拟 107 答案 解析 DOC
