欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOC文档下载  

    电大《面向对象程序设计C++》考试复习题资料小抄【电大考试不愁】.doc

    • 资源ID:4104204       资源大小:62KB        全文页数:8页
    • 资源格式: DOC        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    电大《面向对象程序设计C++》考试复习题资料小抄【电大考试不愁】.doc

    一、选择题1、重载函数在调用时选择的依据中,错误的是A参数个数 B参数类型 C函数名字 D.函数类型2、有关构造函数的说法不正确的是A.构造函数名字和类的名字一样 B.构造函数在说明变量时自动执行C.构造函数无任何函数类型 D.构造函数有且只有一个3、下列关于C+函数的叙述中,正确的是( )。 A)每个函数至少要具有一个参数 B)每个函数都必须返回一个值 C)函数在被调用之前必须先声明 D)函数不能自己调用自己4、下列关于类和对象的叙述中,错误的是( )。 A)一个类只能有一个对象 B)对象是类的具体实例 C)类是对某一类对象的抽象 D)类和对象的关系是一种数据类型与变量的关系5、在C+中,用于实现运行时多态性的是( )。 A)内联函数 B)重载函数 C)模板函数 D)虚函数6、下列关于运算符重载的叙述中,正确的是( )。 A)通过运算符重载,可以定义新的运算符 B)有的运算符只能作为成员函数重载 C)若重载运算符+,则相应的运算符函数名是+ D)重载二元运算符时,必须声明两个形参7、对于语句 cout<<x<<endl;错误的是描述是( )。 A)“cout”是一个输出流对象 B)“endl”的作用是输出回车换行 C)“x”是一个变量 D)“<<”称作提取运算符8、有如下类声明,则类MyDERIVED中保护的数据成员和成员函数的个数是( )。 class MyBASE private: int k; public: void set(int n) k=n; int get( )const return k; ; class MyDERIVED: protected MyBASE protected: int j; public: void set(int m, int n) MyBASE:set(m); j=n; int get( ) const return MyBASE:get( )+j; ;A)4 B)3 C)2 D)19、下列关于派生类构造函数的描述中,错误的是A派生类构造函数应包含直接基类和所有间接基类的构造函数B派生类构造函数仅包含直接基类构造函数和其他(如子对象)类构造函数等C派生类构造函数通常带有成员初始化表D派生类默认构造函数中隐含包括直接基类的默认构造函数10、已知在一个类体中包含如下函数原型: Volume operator-(Volume)const;,下列关于这个函数的叙述中,错误的是( )。 A)这是运算符-的重载运算符函数 B)这个函数所重载的运算符是一个一元运算符 C)这是一个成员函数 D)这个函数不改变类的任何数据成员的值11、执行如下的程序段后,输出结果是( )。 cout.fill('*'); cout.width(6); cout.fill('#'); cout << 123 << endl; A)#123 B)123# C)*123 D)123*12、在下列函数原型中,可以作为类AA构造函数的是( )。 A)void AA(int); B)int AA(); C)AA(int)const; D)AA(int);13、下面四个选项中,( )是用来声明虚函数的。 A)virtual B)public C)include D)using namespace14、实现运行时的多态性要使用( )。 A)重载函数 B)构造函数 C)析构函数 D)虚函数15、要实现动态联编,必须通过( )调用虚函数。 A)对象指针 B)成员名限定 C)对象名 D)派生类名16、以下( )成员函数表示纯虚函数。 A)virtual int vf(int); B)void vf(int)=0; C)virtual void vf()=0; D)virtual void vf(int)17、在每个C+程序中都必须包含有这样一个函数,该函数的函数名为              。A. main           B. MAIN           C. name           D. function18、设x和y均为bool量,则x&&y为真的条件是                。A. 它们均为真    B. 其中一个为真    C. 它们均为假     D. 其中一个为假19、下面的哪个保留字不能作为函数的返回类型?                。A. void           B. int              C. new             D. long20、假定a为一个整型数组名,则元素a4的字节地址为                 。A. a+4            B. a+8             C. a+16            D. a+3221、假定AB为一个类,则执行“AB  a(4) , b3 , * p2 ”语句时,自动调用该类构造函数的次数为                 。A. 3              B. 4               C. 6               D. 922、假定要对类AB定义加号操作符重载成员函数,实现两个AB类对象的加法,并返回相加结果,则该成员函数的声明语句为:                 。A.  AB  operator+(AB  & a , AB  & b)       B.  AB  operator+(AB  & a)C.  operator+(AB  a)                   D.  AB  & operator+( )23、有如下类声明:class XA private: int x; public: XA(int n) x=n; ; class XB: public XA private: int y; public: XB(int a,int b); ; 在构造函数XB的下列定义中,正确的是( )。 A)XB:XB(int a,int b): x(a),y(b) B)XB:XB(int a,int b): XA(a),y(b) C)XB:XB(int a,int b): x(a),XB(b) D)XB:XB(int a,int b): XA(a),XB(b) 24、在表达式 x+y*z中, + 是作为成员函数重载的运算符,* 是作为非成员函数重载的运算符。则 operator+ 有 个参数,operator* 有 参数。( ) A)2、2 B)2、1 C)1、2 D)1、125、应在下列程序划线处填入的正确语句是( )。 class Base public: void fun()cout<<"Base:fun"<<endl; ;class Derived:public Base void fun() /显示调用基类的函数fun() cout<<"Derived:fun"<<endl; ; A)fun(); B)Base.fun(); C)Base:fun(); D) Base->fun();26、下列关于继承的描述中,正确的是A.继承不是类之间的一种关系 B.C+语言仅支持单一继承C.继承会增加程序的冗余性 D.继承是面向对象方法中一个很重要的特性27、在int b3=1,3,2,4,5,6,0中,a22的值是A. 0 B. 5 C.6 D.2 28、下列给字符数组进行的初始化中,正确的是A. char s1="abcd" B.char s23="xyz"C. char s3='a','x','y' D.char s423="xyz","mnp"29、已知:int a,&ra=a;关于ra的描述中正确的是A. ra是int型变量a的地址值 B.a是int型变量ra的地址值C. ra是int型变量a的引用 D. ra是int型变量a的指针30、对于int *pa5;的描述,正确的是A. pa是一个指向数组的指针,所指向的数组是5个int型元素B. pa是一个指向某数组中第5个元素的指针,该元素是int型变量C. pa5表示某个数组中的第5个元素的值D. pa是一个具有5个元素的指针数组,每个元素是一个int型指针31、有关类的说法不正确的是A类是一种用户自定义的数据类型B. 类中的成员函数可以存取类中的私有数据C. 在类中,如果不作特别说明,所有的数据均为私有类型D. 在类中,如果不作特别说明,所有的成员函数均为公有类型32、C+语言中规定函数的返回值的类型是由A return语句中的表达式类型所决定 B 调用该函数时的主调用函数类型所决C 调用该函数时系统临时决定 D 在定义该函数时所指定的函数类型所决定33、有一个int类型变量,在程序中频繁使用,最好定义它为Aregister B auto C extern Dstatic 34、如果a=1,b=2,c=3,d=4,则条件表达式a<b?a:c<d?c:d的值为A1 B2 C3 D435、下列运算符中,在C+中不能重载运算符是A?: B+ C- D=36、如果一个类至少有一个纯虚函数,那么就称该类为A抽象类 B虚基类 C派生类 D以上都不对37、在下列关键字中,用以说明类中公有成员的是Apublic Bprivate Cprotected Dfriend38、要求通过函数来实现一种不太复杂的功能,并且要求加快执行速度,选用A内联函数 B重载函数 C递归调用 D嵌套调用39、功能为对对象进行初始化的是A析构函数 B数据成员 C构造函数 D静态成员函数40、下述静态数据成员的特性中,错误的是 A说明静态数据成员时前边要加修饰符staticB静态数据成员要在类体外进行初始化C引用静态数据成员时,要在静态数据成员前加类名和作用域运算符D静态数据成员不是所有对象所共有的41、在C+中,关于下列设置参数默认值的描述中,正确的是A不允许设置参数的默认值B设置参数默认值只能在定义函数时设置C设置参数默认值时,应该是先设置右边的再设置左边的D设置参数默认值时,应该全部参数都设置42、print()函数是一个类的常成员函数,它无返回值,下列表示中,正确的是 Avoid print() const Bconst void print()Cvoid const print() Dvoid print(const)二、填空题1、面向对象程序设计有四个主要特点,即抽象、封装、_和_。2、非成员函数应声明为类的_函数才能访问这个类的private成员。3、派生类中的成员不能直接访问基类中的_成员。4、在用class定义一个类时,数据成员和成员函数的默认访问权限是_。5、运算符重载函数可能是类的_函数,也可以是类的_函数,还可以是普通函数。6、用流对象的成员函数控制输出格式时,用于设置字段宽度的流成员函数的名称是_,与之作用相同的控制符名称是_。7、含有纯虚函数的类称为_。8、使用cin和cout进行输入输出操作的程序必须包含头文件_ ,其语句格式为_ 。9、C+语言中使用const定义常量时需要指出_ 、_ 和 _ 。10、派生类的构造函数的初始化表中,通常应包含_ 构造函数和_ 构造函数。11、C+语言支持两种多态性,分别是_ 和_ 。12、函数调用excc(v1,v2),(v3,v4,v5),v6);语句中实参的个数是_ 。 13、C+语言中的每条基本语句以             作为结束符,每条复合语句以            作为结束符。14、执行“cout  <<char('A'+2)<<endl;”语句后得到的输出结果为                 。15、float 和 double 类型的大小分别为            和            。16、算术表达式对应的C+表达式为                             。17、关系表达式x+y>5的相反表达式为                          。18、假定一个一维数组的定义为“char  * a8 ”,则该数组所含元素的个数为          ,所占存储空间的字节数为            。19、变量分为全局和局部两种,              变量没有赋初值时,其值是不确定的。20、假定a是一个二维数组,则aij的指针访问方式为                         。21、假定一个结构类型定义为“struct  D  int  a   union  int  b  double  c    D  * d2   ” ,则该类型的大小为              字节。22、对一个类中的数据成员的初始化可以通过构造函数中的              实现,也可以通过构造函数中的                    实现。23、假定AB为一个类,则执行“AB  a10;”语句时,系统自动调用该类的构造函数的次数为                       。 242、假定类AB中有一个公用属性的静态数据成员bb,在类外不通过对象名访问该成员bb的写法为                                    。三、程序的填空、程序的执行1、以下程序是定义一个计数器类counter,对其重载运算符“+”,请填空。class counter private: int n; public: counter() n=0; counter(int i)n=i; _ /运算符重载函数 counter t; t.n=n+c.n; return t; void disp() cout<<"n="<<n<<endl;void main() counter c1(5),c2(10),c3; c3=c1+c2; c1.disp(); c2.disp(); c3.disp(); 2、下列程序的输出结果为2,请将程序补充完整。class Base public: _ void fun() cout<<1; ;class Derived: public Base public: void fun( ) cout<<2; ;int main( ) Base *p= new Derived; p->fun( ); delete p; return 0; 3、写出执行下面程序的输出结果。void fun(int &x, int y) int t=x; x=y; y=t; int main( ) int a2 = 23, 42; fun(a1,a0); std:cout<<a0<<","<<a1<<std:endl; return 0; 27、写出执行下面程序的输出结果。class A public: A() cout<<"A" ;class B public: B() cout<<"B" ;class C : public A B b; public: C() cout<<"C" ;int main( ) C obj; return 0; 4、写出执行下面程序的输出结果。class Base private: char c; public: Base(char n):c(n) virtual Base()cout<<C; ; class Der:public Base private: char c; public: Der(char n):Base(n+1),c(n) Der()cout<<C; ; int main() Der("X"); return 0; 5. #include <iostream.h>void fun(int *s,int n1,int n2)int i,j,t;i=n1;j=n2;待添加的隐藏文字内容2while (i<j)t=*(s+i); *(s+i)=*(s+j); *(s+j)=t;i+; j-;void main()int a10=1,2,3,4,5,6,7,8,9,0,i,*p=a; 输出结果为:fun(p,0,3);fun (p,4,9);fun(p,0,9);for (i=0;i<10;i+)cout << *(a+i);cout << endl;6. 有如下程序#include <iostream.h>#include <string.h>class Girl char *name , *dial;public:Girl(char *n, char *d) name=new charstrlen(n)+1; strcpy(name, n);dial= new charstrlen(d)+1; strcpy(dial,d);friend void disp(Girl &);Girl() delete name; delete dial;void disp(Girl &x) cout<<”Girl s name is:”<<x.name<<”,tel:”<<x.dial<<endl; void main() Girl e(“Liping”,”0379-5515179”);disp(e);其输出结果为: 程序中突出介绍了C+中用于对私有成员访问的什么概念。7. #include <iostream.h>class basepublic:virtual void who()cout<<"base class"<<endl;class derive1:public basepublic:void who()cout<<"derivel class "<<endl;class derive2:public base public:void who()cout<<"derive2 class "<<endl; void main() 输出结果为: base obj1,*p;derive1 obj2;derive2 obj3;p=&obj1;p->who(); p=&obj2;p->who(); p=&obj3;p->who(); 四、编程题1、 编写一个程序,设计一个满足如下要求的Cdate类: 用下面的格式输出日期: 日/月/年; 输出在当前日期上加一天后的日期; 设置日期。2、编写一个程序设计一个栈操作类,包含入栈和出栈成员函数,然后入栈一组数据,出栈并显示出栈顺序。3、编写一个程序计算“三角形、正方形、圆形”三种图形的面积,要求:a)抽象出一个基类base;b)在其中说明一个虚函数用来求面积;c)利用派生类定义“三角形、正方形、圆形”;d)编写主函数。4、编写程序,把从键盘上输入的一批整数(以-1作为终止输入的标志)保存到文本文件“a:xxk1.dat”中。O(_)O谢谢!【China's 10 must-see animations】The Chinese animation industry has seen considerable growth in the last several years. It went through a golden age in the late 1970s and 1980s when successively brilliant animation work was produced. Here are 10 must-see classics from China's animation outpouring that are not to be missed. Let's recall these colorful images that brought the country great joy. Calabash Brothers Calabash Brothers (Chinese: 葫芦娃) is a Chinese animation TV series produced by Shanghai Animation Film Studio. In the 1980s the series was one of the most popular animations in China. It was released at a point when the Chinese animation industry was in a relatively downed state compared to the rest of the international community. Still, the series was translated into 7 different languages. The episodes were produced with a vast amount of paper-cut animations. Black Cat Detective Black Cat Detective (Chinese: 黑猫警长) is a Chinese animation television series produced by the Shanghai Animation Film Studio. It is sometimes known as Mr. Black. The series was originally aired from 1984 to 1987. In June 2006, a rebroadcasting of the original series was announced. Critics bemoan the series' violence, and lack of suitability for children's education. Proponents of the show claim that it is merely for entertainment. Effendi "Effendi", meaning sir and teacher in Turkish, is the respectful name for people who own wisdom and knowledge. The hero's real name was Nasreddin. He was wise and witty and, more importantly, he had the courage to resist the exploitation of noblemen. He was also full of compassion and tried his best to help poor people. Adventure of Shuke and Beita【舒克与贝塔】 Adventure of Shuke and Beita (Chinese: 舒克和贝塔) is a classic animation by Zheng Yuanjie, who is known as King of Fairy Tales in China. Shuke and Beita are two mice who don't want to steal food like other mice. Shuke became a pilot and Beita became a tank driver, and the pair met accidentally and became good friends. Then they befriended a boy named Pipilu. With the help of PiPilu, they co-founded an airline named Shuke Beita Airlines to help other animals. Although there are only 13 episodes in this series, the content is very compact and attractive. The animation shows the preciousness of friendship and how people should be brave when facing difficulties. Even adults recalling this animation today can still feel touched by some scenes. Secrets of the Heavenly Book Secrets of the Heavenly Book, (Chinese: 天书奇谈) also referred to as "Legend of the Sealed Book" or "Tales about the Heavenly Book", was released in 1983. The film was produced with rigorous dubbing and fluid combination of music and vivid animations. The story is based on the classic literature "Ping Yao Zhuan", meaning "The Suppression of the Demons" by Feng Menglong. Yuangong, the deacon, opened the shrine and exposed the holy book to the human world. He carved the book's contents on the stone wall of a white cloud cave in the mountains. He was then punished with guarding the book for life by the jade emperor for breaking heaven's law. In order to pass this holy book to human beings, he would have to get by the antagonist fox. The whole animation is characterized by charming Chinese painting, including pavilions, ancient architecture, rippling streams and crowded markets, which fully demonstrate the unique beauty of China's natural scenery. Pleasant Goat and Big Big Wolf【喜洋洋与灰太狼】 Pleasant Goat and Big Big Wolf (Chinese:喜羊羊与灰太狼) is a Chinese animated television series. The show is about a group of goats living on the Green Pasture, and the story revolves around a clumsy wolf who wants to eat them. It is a popular domestic animation series and has been adapted into movies. Nezha Conquers the Dragon King(Chinese: 哪吒闹海) is an outstanding animation issued by the Ministry of Culture in 1979 and is based on an episode from the Chinese mythological novel "Fengshen Yanyi". A mother gave birth to a ball of flesh shaped like a lotus bud. The father, Li Jing, chopped open the ball, and beautiful boy, Nezha, sprung out. One day, when Nezha was seven years old, he went to the nearby seashore for a swim and killed the third son of the Dragon King who was persecuting local residents. The story primarily revolves around the Dragon King's feud with Nezha over his son's death. Through bravery and wit, Nezha finally broke into the underwater palace and successfully defeated him. The film shows various kinds of attractive sceneries and the traditional culture of China, such as spectacular mountains, elegant sea waves and exquisite ancient Chinese clothes. It has received a variety of awards. Havoc in Heaven The story of Havoc in Heaven(Chinese: 大闹天宫)is based on the earliest chapters of the classic story Journey to the West. The main character is Sun Wukong, aka the Monkey King, who rebels against the Jade Emperor of heaven. The stylized animation and drums and percussion accompaniment used in this film are heavily influenced by Beijing Opera traditions. The name of the movie became a colloquialism in the Chinese language to describe someone making a mess. Regardless that it was an animated film, it still became one of the most influential films in all of Asia. Countless cartoon adaptations that followed have reused the same classic story Journey to the West, yet many consider this 1964 iteration to be the most original, fitting and memorable, The Golden Monkey Defeats a Demon【金猴降妖】 The Golden Monkey Defeats a Demon (Chinese: 金猴降妖)

    注意事项

    本文(电大《面向对象程序设计C++》考试复习题资料小抄【电大考试不愁】.doc)为本站会员(仙人指路1688)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开