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

上传人:fatcommittee260 文档编号:1324440 上传时间:2019-10-17 格式:DOC 页数:19 大小:62.50KB
下载 相关 举报
【计算机类职业资格】二级C++笔试-129及答案解析.doc_第1页
第1页 / 共19页
【计算机类职业资格】二级C++笔试-129及答案解析.doc_第2页
第2页 / 共19页
【计算机类职业资格】二级C++笔试-129及答案解析.doc_第3页
第3页 / 共19页
【计算机类职业资格】二级C++笔试-129及答案解析.doc_第4页
第4页 / 共19页
【计算机类职业资格】二级C++笔试-129及答案解析.doc_第5页
第5页 / 共19页
点击查看更多>>
资源描述

1、二级 C+笔试-129 及答案解析(总分:100.00,做题时间:90 分钟)一、选择题(总题数:35,分数:70.00)1.决定 C+语言中函数的返回值类型的是( )。(分数:2.00)A.return 语句中的表达式类型B.调用该函数时系统随机产生的类型C.调用该函数时的主调用函数类型D.在定义该函数时所指定的数据类型2.使用如 setw()的操纵符对数据进行格式输出时,应包含( )文件。(分数:2.00)A.iostream.hB.fstream.hC.iomanip.hD.stdliB.h3.面向对象程序设计将数据与( )放在一起,作为一个相互依存、不可分割的整体来处理。(分数:2.0

2、0)A.对数据的操作B.信息C.数据隐藏D.数据抽象4.当使用 fstream 流类定义一个流对象并打开一个磁盘文件时,文件的隐含打开方式为( )。(分数:2.00)A.ios:inB.ios: outC.ios:in lios:outD.以上都不对5.下面叙述错误的是( )。(分数:2.00)A.基类的 protected 成员在派生类中仍然是 protected 的B.基类的 protected 成员在 public 派生类中仍然是 protected 的C.基类的 protected 成员在 private 派生类中是 privated 的D.基类的 protected 成员不能被派生类

3、的对象访问6.有以下程序:#includeiostream.hvoid main()int x=10,y=10;for(int i=0;x8;y=+i)coutx-“,“y“,“;该程序运行后的输出结果是( )。(分数:2.00)A.10,1,9,2B.9,8,7,6C.10,9,9,0D.10,10,9,17.cin 是( )的一个对象,处理标准输入。(分数:2.00)A.istreamB.ostreamC.fstreamD.iostream8.下列程序的输出结果为( )。#includeiostream.h#includeiomanip.hvoidmain()coutprecision(4

4、);cout123.127;cout”12346:(分数:2.00)A.123.1 123.4B.123.1 123.46C.123.127 123.46D.123.1123.49.下列函数的运行结果是( )。#includeiostream.hintf( int a, int b)int c;if(ab) c=1;elseif(a=b)C=0;elsec=-1;return(c);void main()int i=2,j=3;int p=f(i,j);coutp;(分数:2.00)A.-1B.1C.2D.编译出错,无法运行10.C+语言中规定函数的返回值的类型是由( )。(分数:2.00)A

5、return 语句中的表达式类型所决定B.调用该函数时的主调用函数类型所决定C.调用该函数时系统临时决定D.在定义该函数时所指定的数据类型所决定11.下列描述中,( )是抽象类的特性。(分数:2.00)A.可以说明虚函数B.可以进行构造函数重载C.可以定义友元函数D.不能说明其对象12.下列关于析构函数的描述中,错误的是( )。(分数:2.00)A.类中有且仅有一个析构函数B.析构函数可以有形参C.析构函数没有函数类型D.析构函数对象消失时被自动执行13.类 MyClass 的定义如下:class MyClasspublic:MyClass()value=0;SetVariable(int

6、i)value=i;private:int value;则对下列语句序列正确的描述是( )。(分数:2.00)A.MyClass*p,my;p=i=*ptr;C.int*ptr;ptr=0;D.int i=5;int*ptr;*ptrfloat D.char d;char char*p=“ It is mine“;则以下不正确的叙述是( )。(分数:2.00)A.a+1 表示的是字符 t 的地址B.p 指向另外的字符串时,字符串的长度不受限制C.P 变量中存放的地址值可以改变D.a 中只能存放 10 个字符27.在多继承中,公有派生和私有派生对于基类成员在派生类中的可访问性与单继承的规则( )

7、分数:2.00)A.完全相同B.完全不同C.部分相同,部分不同D.以上都不对28.假定 MyClass 为一个类,则执行 MyClassa3,*p2;语句时, 自动调用该类构造函数( )次。(分数:2.00)A.2B.3C.4D.529.在 C+语言中函数返回值的类型是由( )决定的;(分数:2.00)A.调用该函数时系统临时B.return 语句中的表达式类型C.定义该函数时所指定的函数类型D.调用该函数时的主调函数类型30.类模板 templateclass Tclass x(),其中,友元函数 f 成为从该类模板实例化的每个模板类的友元,则其说明应为( )。(分数:2.00)A.fr

8、iend void f();B.friend void f(xTD.friend void CT:f(xTC./D.35.下列程序的输出结果为( )。main()int a=4,b=3,c=1,d;da;class Bint b;public:void setb(int x) b=x;void showb()coutbend1;;class C: public A,private Bprivate:int c:public:voidsetc(intx,inty,intz)c=z;seta(x);setb(y);void showc()coutcend1;void main()Cc:Cseta(

9、1);Cshowa();Csetc(1,2,3);Cshowc();(分数:2.00)填空项 1:_49.在内存中,存储字符X要占用 1 个字节,存储字符串“X“要占用 1 个字节。(分数:2.00)填空项 1:_50.如果一个模板声明时有类型形参表,则多个参数之间必须使用 1 隔开,每个参数都必须重复使用关键字 2。(分数:2.00)填空项 1:_二级 C+笔试-129 答案解析(总分:100.00,做题时间:90 分钟)一、选择题(总题数:35,分数:70.00)1.决定 C+语言中函数的返回值类型的是( )。(分数:2.00)A.return 语句中的表达式类型B.调用该函数时系统随机产

10、生的类型C.调用该函数时的主调用函数类型D.在定义该函数时所指定的数据类型 解析:2.使用如 setw()的操纵符对数据进行格式输出时,应包含( )文件。(分数:2.00)A.iostream.hB.fstream.hC.iomanip.h D.stdliB.h解析:3.面向对象程序设计将数据与( )放在一起,作为一个相互依存、不可分割的整体来处理。(分数:2.00)A.对数据的操作 B.信息C.数据隐藏D.数据抽象解析:4.当使用 fstream 流类定义一个流对象并打开一个磁盘文件时,文件的隐含打开方式为( )。(分数:2.00)A.ios:inB.ios: outC.ios:in lio

11、s:outD.以上都不对 解析:5.下面叙述错误的是( )。(分数:2.00)A.基类的 protected 成员在派生类中仍然是 protected 的 B.基类的 protected 成员在 public 派生类中仍然是 protected 的C.基类的 protected 成员在 private 派生类中是 privated 的D.基类的 protected 成员不能被派生类的对象访问解析:6.有以下程序:#includeiostream.hvoid main()int x=10,y=10;for(int i=0;x8;y=+i)coutx-“,“y“,“;该程序运行后的输出结果是( )

12、分数:2.00)A.10,1,9,2B.9,8,7,6C.10,9,9,0D.10,10,9,1 解析:7.cin 是( )的一个对象,处理标准输入。(分数:2.00)A.istream B.ostreamC.fstreamD.iostream解析:8.下列程序的输出结果为( )。#includeiostream.h#includeiomanip.hvoidmain()coutprecision(4);cout123.127;cout”12346:(分数:2.00)A.123.1 123.4 B.123.1 123.46C.123.127 123.46D.123.1123.4解析:9.下列

13、函数的运行结果是( )。#includeiostream.hintf( int a, int b)int c;if(ab) c=1;elseif(a=b)C=0;elsec=-1;return(c);void main()int i=2,j=3;int p=f(i,j);coutp;(分数:2.00)A.-1 B.1C.2D.编译出错,无法运行解析:10.C+语言中规定函数的返回值的类型是由( )。(分数:2.00)A.return 语句中的表达式类型所决定B.调用该函数时的主调用函数类型所决定C.调用该函数时系统临时决定D.在定义该函数时所指定的数据类型所决定 解析:11.下列描述中,( )

14、是抽象类的特性。(分数:2.00)A.可以说明虚函数B.可以进行构造函数重载C.可以定义友元函数D.不能说明其对象 解析:12.下列关于析构函数的描述中,错误的是( )。(分数:2.00)A.类中有且仅有一个析构函数B.析构函数可以有形参 C.析构函数没有函数类型D.析构函数对象消失时被自动执行解析:13.类 MyClass 的定义如下:class MyClasspublic:MyClass()value=0;SetVariable(int i)value=i;private:int value;则对下列语句序列正确的描述是( )。(分数:2.00)A.MyClass*p,my;p=i=*pt

15、r; C.int*ptr;ptr=0;D.int i=5;int*ptr;*ptrfloat D.char d;char char*p=“ It is mine“;则以下不正确的叙述是( )。(分数:2.00)A.a+1 表示的是字符 t 的地址B.p 指向另外的字符串时,字符串的长度不受限制C.P 变量中存放的地址值可以改变D.a 中只能存放 10 个字符 解析:27.在多继承中,公有派生和私有派生对于基类成员在派生类中的可访问性与单继承的规则( )。(分数:2.00)A.完全相同 B.完全不同C.部分相同,部分不同D.以上都不对解析:28.假定 MyClass 为一个类,则执行 MyCla

16、ssa3,*p2;语句时, 自动调用该类构造函数( )次。(分数:2.00)A.2B.3 C.4D.5解析:29.在 C+语言中函数返回值的类型是由( )决定的;(分数:2.00)A.调用该函数时系统临时B.return 语句中的表达式类型C.定义该函数时所指定的函数类型 D.调用该函数时的主调函数类型解析:30.类模板 templateclass Tclass x(),其中,友元函数 f 成为从该类模板实例化的每个模板类的友元,则其说明应为( )。(分数:2.00)A.friend void f(); B.friend void f(xTD.friend void CT:f(xTC./D.解

17、析:35.下列程序的输出结果为( )。main()int a=4,b=3,c=1,d;da;class Bint b;public:void setb(int x) b=x;void showb()coutbend1;;class C: public A,private Bprivate:int c:public:voidsetc(intx,inty,intz)c=z;seta(x);setb(y);void showc()coutcend1;void main()Cc:Cseta(1);Cshowa();Csetc(1,2,3);Cshowc();(分数:2.00)填空项 1:_ (正确答案:1 3)解析:49.在内存中,存储字符X要占用 1 个字节,存储字符串“X“要占用 1 个字节。(分数:2.00)填空项 1:_ (正确答案:2)解析:50.如果一个模板声明时有类型形参表,则多个参数之间必须使用 1 隔开,每个参数都必须重复使用关键字 2。(分数:2.00)填空项 1:_ (正确答案:, class)解析:

展开阅读全文
相关资源
猜你喜欢
  • EN 3373-002-2009 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 002 General and list of product standard《航空航天系列 导线压接用终端接线片和直插式接头.pdf EN 3373-002-2009 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 002 General and list of product standard《航空航天系列 导线压接用终端接线片和直插式接头.pdf
  • EN 3373-007-2012 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 007 Nickel plated aluminium terminal lugs for crimping on nickel.pdf EN 3373-007-2012 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 007 Nickel plated aluminium terminal lugs for crimping on nickel.pdf
  • EN 3373-008-2012 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 008 Copper lugs nickel plated ring shaped for copper conductors .pdf EN 3373-008-2012 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 008 Copper lugs nickel plated ring shaped for copper conductors .pdf
  • EN 3373-010-2009 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 010 Terminal lugs ring shaped tin plated for crimping on copper .pdf EN 3373-010-2009 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 010 Terminal lugs ring shaped tin plated for crimping on copper .pdf
  • EN 3373-011-2009 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 011 Terminal lugs ring shaped nickel plated for crimping on copp.pdf EN 3373-011-2009 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 011 Terminal lugs ring shaped nickel plated for crimping on copp.pdf
  • EN 3373-012-2005 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 012 In-line splices insulated and sealed for crimping on copper .pdf EN 3373-012-2005 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 012 In-line splices insulated and sealed for crimping on copper .pdf
  • EN 3373-013-2005 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 013 In-line splices insulated and moisture resistant for crimpin.pdf EN 3373-013-2005 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 013 In-line splices insulated and moisture resistant for crimpin.pdf
  • EN 3373-014-2009 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 014 In-line splices insulated and sealed for crimping on copper .pdf EN 3373-014-2009 en Aerospace series - Terminal lugs and in-line splices for crimping on electric conductors - Part 014 In-line splices insulated and sealed for crimping on copper .pdf
  • EN 3375-001-2007 en Aerospace series - Cable electrical for digital data transmission - Part 001 Technical specification《航空航天系列 数字数据传输用电缆 第001部分 技术规范》.pdf EN 3375-001-2007 en Aerospace series - Cable electrical for digital data transmission - Part 001 Technical specification《航空航天系列 数字数据传输用电缆 第001部分 技术规范》.pdf
  • 相关搜索

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

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