[计算机类试卷]国家二级(C++)笔试模拟试卷101(无答案).doc

上传人:bonesoil321 文档编号:846952 上传时间:2019-02-21 格式:DOC 页数:13 大小:41.50KB
下载 相关 举报
[计算机类试卷]国家二级(C++)笔试模拟试卷101(无答案).doc_第1页
第1页 / 共13页
[计算机类试卷]国家二级(C++)笔试模拟试卷101(无答案).doc_第2页
第2页 / 共13页
[计算机类试卷]国家二级(C++)笔试模拟试卷101(无答案).doc_第3页
第3页 / 共13页
[计算机类试卷]国家二级(C++)笔试模拟试卷101(无答案).doc_第4页
第4页 / 共13页
[计算机类试卷]国家二级(C++)笔试模拟试卷101(无答案).doc_第5页
第5页 / 共13页
点击查看更多>>
资源描述

1、国家二级( C+)笔试模拟试卷 101(无答案)1 类 MyClass 的定义如下: class MyClass public: MyClass() MyClass(int i)value=new int(i); int * value; ; 若要对 value 赋值,则下面语句正确的是( ) 。(A)MyClass my ;my.value=10 ;(B) MyClass my;*my;*value=10 ;(C) MyClass my;my.*value=10;(D)MyClass my(10);2 对以下说明语句的正确理解是( )。 int a1=6,7,8,9,10 ;(A)将 5 个

2、初值依次赋给 a1至 a5(B)将 5 个初值依次赋给 a0至 a4(C)将 5 个初值依次赋给 a6至 a10(D)因为数组长度与初值的个数不相同,所以此语句不正确3 下列对类的构造函数和析构函数的描述中,正确的是( )。(A)构造函数可以重载,析构函数不能重载(B)构造函数不能重载,析构函数可以重载(C)构造函数可以重载,析构函数也可以重载(D)构造函数不能重载,析构函数也不能重载4 有关类和对象的说法不正确的是( )。(A)对象是类的一个实例(B)任何一个对象只能属于一个具体的类(C)一个类只能有一个对象(D)类与对象的关系和数据类型和变量的关系相似5 列对派生类的描述中,错误的是( )

3、。(A)一个派生类可以作为另一个派生类的基类(B)派生类至少有一个基类(C)派生类的缺省继承方式是 private(D)派生类只继承了基类的公有成员和保护成员6 以下程序的输出结果是( )。 #include iostream.h void main() int i, j,x=0 ; fof (i=0;i2;i+= x+; for(j=0;j 3;j+= if(j%2)continue: x+ ; x+; cout“x=“x;=(A)x=4(B) x=8(C) x6(D)x=127 下面的叙述中,不符合赋值兼容规则的是( )。(A)派生类的对象可以赋值给基类的对象(B)基类的对象可以赋值给派生

4、类的对象(C)派生类的对象可以初始化基类的引用(D)派生类的对象的地址可以赋值给指向基类的指针8 ( )不是构造函数的特征。(A)构造函数的函数名与类名相同(B)构造函数可以重载(C)构造函数可以设置默认参数(D)构造函数必须指定类型说明9 下列程序中,划线处正确的语句是( )。 #includeiostream.h Class Base Public: Void fun()cout“Base:fun“ endl; ; Class Derived:public Base void fun() _ /显示调用基类的函数 fun() Cout “Derived:fun“endl; ;(A)fun(

5、)(B) Base.fun()(C) Base:fun()(D)Base-fun();10 while 和 do-while 循环的主要区别是 ( )。(A)do-while 的循环体至少无条件执行一次(B) while 的循环控制条件比 do-while 的循环控制条件更严格(C) dowhile 允许从外部转到循环体内(D)do-while 的循环体不能是复合语句11 对虚函数的调用( ) 。(A)一定使用动态联编(B)必须使用动态联编(C)一定使用静态联编(D)不一定使用动态联编12 编译时的多态性可以通过使用( )获得。(A)虚函数和指针(B)重载函数和析构函数(C)虚函数和对象(D)

6、虚函数和引用13 以下程序的结果是( )。 #include iostream.h void main() char * p=“abcdefgh“,*r; long *q; q=(long*)P ; q+; r=(char*)q; coutrendl ;(A)defg(B) cdef(C) ghab(D)efgh14 假定 MyClass 为一个类,则该类的拷贝构造函数的声明语句为 ( ) 。(A)MyClass (A)hello(B) hel(C) hol(D)hlm35 C+中用 3 个保留字实现异常处理,除了 try 和 catch 外,还有( )。(A)if(B) class(C) t

7、hrow(D)return36 以下程序的执行结果是 _。#includeiostream.hvoid main()cout.filll(*);cout.width(10);cout123.45endl:cout.width(8);cout123.45endl;cout.width(4);cout123.45endl;37 有如下的程序:#includeiostream#includefstreamusing namespace std;int main()char s25=“Programming language“;ofstream f1(“DATA.TXT“);f1 “C+Program

8、ming“;n.close();ifstream f2(“DATA.TXT“);if(f2.good()f2s;f2.close38 大多数 C+程序都要包含 _ 头文件。该文件中包含了所有输入/ 输出流操作所需要的基本信息。39 一个类可以从直接或间接的祖先中继承所有属性和方法。采用这个方法提高了软件的_。40 若有:int i=1000;int * ip=&i;void * VP;vp=ip ;其中,vp=ip 的含义是 _41 c+语言标识符是以字母或【 】开头的,由字母,数字和下划线组成的字符串。42 在内存中,存储字符X要占用 1 个字节,存储字符串“X“要占用【 】个字节。43 m

9、ystrlen 函数的功能是计算 str 所指字符中的长度,并作为函数值返回,请填空。int mystrlen(char * str) int i;for(i=0;【 】!=0 ;i+);return(i);44 如果一个类中定义了成员对象,则该类的对象和成员对象先被初始化的是【 】。45 请在 mian 函数中填空使下面程序的输出结果为 1 1。#includeiostreamhclass A private:int a;int b;public:A( ):a(0) ,b(1) void show( ) cout a “ “ b; ;class B private:int a;int c;p

10、ublic:B( ):a(1),46 已知:double A (double A) return +a;和 int A(int A) return +a;是一个函数模板的两个实例,则该模板定义为【 】。47 以下函数用来求出数组的最大元素在数组中的下标并存放在 k 所指的存储单元中。请填空。#includeiostreamhvoid fun(int * s,int t,int * k) int i;* k= 【 】;【 】if(s * k si) * k=i;void main( ) int al0= 876,675,896,101,301,401,980,431,451,777 ,k;fun(a,10,&k);48 C+在重载运算符中,如用成员函数重载一元运算符参数表中需要【 】个参数,如用友元函数重载一元运算符参数表中需要【 】个参数。

展开阅读全文
相关资源
猜你喜欢
  • EN 14277-2006 en Ventilation for buildings - Air terminal devices - Method for airflow measurement by calibrated sensors in or close to ATD plenum boxes《建筑物通风 空气终端装置 通过在或接近ATD 充气箱的.pdf EN 14277-2006 en Ventilation for buildings - Air terminal devices - Method for airflow measurement by calibrated sensors in or close to ATD plenum boxes《建筑物通风 空气终端装置 通过在或接近ATD 充气箱的.pdf
  • EN 14278-1-2004 en Textiles - Determination of cotton fibre stickiness - Part 1 Method using a manual thermodetection device《纺织品 棉纤维黏性的测定 第1部分 使用手工热检测设备的方法》.pdf EN 14278-1-2004 en Textiles - Determination of cotton fibre stickiness - Part 1 Method using a manual thermodetection device《纺织品 棉纤维黏性的测定 第1部分 使用手工热检测设备的方法》.pdf
  • EN 14278-2-2004 en Textiles Determination of cotton fibre stickiness Part 2 Method using an automatic thermodetection plate device《纺织品 棉纤维粘性的测定 第2部分 使用自动测温板式装置的方法》.pdf EN 14278-2-2004 en Textiles Determination of cotton fibre stickiness Part 2 Method using an automatic thermodetection plate device《纺织品 棉纤维粘性的测定 第2部分 使用自动测温板式装置的方法》.pdf
  • EN 14278-3-2004 en Textiles - Determination of cotton fibre stickiness - Part 3 Method using an automatic thermodetection rotating drum device《纺织品 棉纤维黏性的测定 第3部分 使用自动热检波旋转鼓设备的方法》.pdf EN 14278-3-2004 en Textiles - Determination of cotton fibre stickiness - Part 3 Method using an automatic thermodetection rotating drum device《纺织品 棉纤维黏性的测定 第3部分 使用自动热检波旋转鼓设备的方法》.pdf
  • EN 14279-2004 en Laminated Veneer Lumber (LVL) - Definitions classification and specifications (Incorporates Amendment A1 2009)《叠层胶合板材(LVL) 定义 分类和规范 包含修改件A1-2009》.pdf EN 14279-2004 en Laminated Veneer Lumber (LVL) - Definitions classification and specifications (Incorporates Amendment A1 2009)《叠层胶合板材(LVL) 定义 分类和规范 包含修改件A1-2009》.pdf
  • EN 14286-2008 en Aluminium and aluminium alloys - Weldable rolled products for tanks for the storage and transportation of dangerous goods《铝和铝合金 危险品的存储和运输槽罐用可焊接轧制产品》.pdf EN 14286-2008 en Aluminium and aluminium alloys - Weldable rolled products for tanks for the storage and transportation of dangerous goods《铝和铝合金 危险品的存储和运输槽罐用可焊接轧制产品》.pdf
  • EN 14287-2004 en Aluminium and aluminium alloys Specific requirements on the chemical composition of products intended to be used for the manufacture of packaging and packaging com.pdf EN 14287-2004 en Aluminium and aluminium alloys Specific requirements on the chemical composition of products intended to be used for the manufacture of packaging and packaging com.pdf
  • EN 1429-2013 en Bitumen and bituminous binders - Determination of residue on sieving of bituminous emulsions and determination of storage stability by sieving《沥青和沥青粘合剂 沥青乳剂筛分残留的测定和.pdf EN 1429-2013 en Bitumen and bituminous binders - Determination of residue on sieving of bituminous emulsions and determination of storage stability by sieving《沥青和沥青粘合剂 沥青乳剂筛分残留的测定和.pdf
  • EN 14290-2004 en Zinc and zinc alloys - Secondary raw material《锌和锌合金 二次原料》.pdf EN 14290-2004 en Zinc and zinc alloys - Secondary raw material《锌和锌合金 二次原料》.pdf
  • 相关搜索

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

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