【计算机类职业资格】二级C++机试-135及答案解析.doc

上传人:孙刚 文档编号:1324314 上传时间:2019-10-17 格式:DOC 页数:2 大小:34KB
下载 相关 举报
【计算机类职业资格】二级C++机试-135及答案解析.doc_第1页
第1页 / 共2页
【计算机类职业资格】二级C++机试-135及答案解析.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、二级 C+机试-135 及答案解析(总分:100.00,做题时间:90 分钟)一、1改错题(总题数:1,分数:30.00)(分数:30.00)填空项 1:_填空项 1:_填空项 1:_二、2填空题(总题数:1,分数:40.00)1. (分数:40.00)_三、3综合应用题(总题数:1,分数:30.00)2. (分数:30.00)_二级 C+机试-135 答案解析(总分:100.00,做题时间:90 分钟)一、1改错题(总题数:1,分数:30.00)(分数:30.00)填空项 1:_ (正确答案:MyClass())解析:解析 析构函数是不带返回值类型的。填空项 1:_ (正确答案:int va

2、lue;)解析:解析 数据成员的初始化应放到构造函数中进行,在定义时不允许赋值。填空项 1:_ (正确答案:void MyClass:Print()const)解析:解析 Print()函数为 MyClass 类的常成员函数,在类体外实现时声明部分不能省略关键字const。二、2填空题(总题数:1,分数:40.00)1. (分数:40.00)_正确答案:()解析:解析 number.h:第一处“/*found*”下定义纯虚函数 toString(),根据其声明格式可得横线处代码。第二处“/*found*”下完成 HexNumber 类的构造函数,需要用列表的方式初始化从基类继承的数据 int

3、n。proj2.cpp:第一处“/*found*”下要求按既定的数制显示输出参数对象 number 的值,实际上该函数的形参中定义有基类 Number 的引用 number,在调用 show()函数时只要实参是派生类对象,就能实现纯虚函数 toString 的重载,正如主函数的使用情况一样。第二处“/*found*”要求以十六进制格式输出十进制数 11,只需使用 show()函数,并用十进制数 11 初始化一个 HexNumber 对象作为实参即可。三、3综合应用题(总题数:1,分数:30.00)2. (分数:30.00)_正确答案:()解析:解析 默认构造函数 MiniString (const char*s=“)中,需要用类的数据成员 char*sPtr 动态分配足够的存储空间来接收 s 所指向的字符串,可采用 strlen()函数求字符串长度,但分配空间时需要加1。在析构函数中应该将 sPtr 指向的存储空间释放。

展开阅读全文
相关资源
猜你喜欢
  • DIN EN 301848-1-2001 Integrated Service Digital Network (ISDN) Signalling System No 7 (SS7) Bearer Independent Call Control (BICC) - Signalling procedures in an ATM IP  backbone ne.pdf DIN EN 301848-1-2001 Integrated Service Digital Network (ISDN) Signalling System No 7 (SS7) Bearer Independent Call Control (BICC) - Signalling procedures in an ATM IP backbone ne.pdf
  • DIN EN 301850-1-2002 Integrated Services Digital Network (ISDN) - Signalling System No 7 (SS7) ISDN User Part (ISUP) Application transport mechanism Support of the generic addressi.pdf DIN EN 301850-1-2002 Integrated Services Digital Network (ISDN) - Signalling System No 7 (SS7) ISDN User Part (ISUP) Application transport mechanism Support of the generic addressi.pdf
  • DIN EN 301893-2017 5 GHz RLAN - Harmonised Standard covering the essential requirements of article 3 2 of Directive 2014 53 EU (Endorsement of the English version EN 301 893 V2 1 1.pdf DIN EN 301893-2017 5 GHz RLAN - Harmonised Standard covering the essential requirements of article 3 2 of Directive 2014 53 EU (Endorsement of the English version EN 301 893 V2 1 1.pdf
  • DIN EN 301905-2003 Corporate telecommunication Networks (CN) - Signalling interworking between QSIG and H 323 - Generic functional protocol for the support of supplementary servicef.pdf DIN EN 301905-2003 Corporate telecommunication Networks (CN) - Signalling interworking between QSIG and H 323 - Generic functional protocol for the support of supplementary servicef.pdf
  • DIN EN 301906-2003 Corporate telecommunication Networks (CN) - Signalling interworking between QSIG and H 323 - Call Diversion supplementary services (ISO IEC 21411 (2001) modifiedV.pdf DIN EN 301906-2003 Corporate telecommunication Networks (CN) - Signalling interworking between QSIG and H 323 - Call Diversion supplementary services (ISO IEC 21411 (2001) modifiedV.pdf
  • DIN EN 301907-2004 Corporate telecommunication Networks (CN) - Signalling interworking between QSIG and H 323 - Call transfer supplementary service (ISO IEC 21410 (2001) modified)  .pdf DIN EN 301907-2004 Corporate telecommunication Networks (CN) - Signalling interworking between QSIG and H 323 - Call transfer supplementary service (ISO IEC 21410 (2001) modified) .pdf
  • DIN EN 301908-1-2017 IMT cellular networks - Harmonised Standard covering the essential requirements of article 3 2 of the Directive 2014 53 EU - Part 1 Introduction and common req.pdf DIN EN 301908-1-2017 IMT cellular networks - Harmonised Standard covering the essential requirements of article 3 2 of the Directive 2014 53 EU - Part 1 Introduction and common req.pdf
  • DIN EN 301908-10-2017 Electromagnetic compatibility and Radio spectrum Matters (ERM) - Base Stations (BS) Repeaters and User Equipment (UE) for IMT-2000 Third-Generation cellular n.pdf DIN EN 301908-10-2017 Electromagnetic compatibility and Radio spectrum Matters (ERM) - Base Stations (BS) Repeaters and User Equipment (UE) for IMT-2000 Third-Generation cellular n.pdf
  • DIN EN 301908-11-2017 IMT cellular networks - Harmonised Standard covering the essential requirements of article 3 2 of the Directive 2014 53 EU - Part 11 CDMA Direct Spread (UTRA .pdf DIN EN 301908-11-2017 IMT cellular networks - Harmonised Standard covering the essential requirements of article 3 2 of the Directive 2014 53 EU - Part 11 CDMA Direct Spread (UTRA .pdf
  • 相关搜索

    当前位置:首页 > 考试资料 > 职业资格

    copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
    备案/许可证编号:苏ICP备17064731号-1