电大面向对象程序设计期末复习指导参考小抄【精编版】.doc

上传人:仙人指路1688 文档编号:2385620 上传时间:2023-02-17 格式:DOC 页数:5 大小:47KB
返回 下载 相关 举报
电大面向对象程序设计期末复习指导参考小抄【精编版】.doc_第1页
第1页 / 共5页
电大面向对象程序设计期末复习指导参考小抄【精编版】.doc_第2页
第2页 / 共5页
电大面向对象程序设计期末复习指导参考小抄【精编版】.doc_第3页
第3页 / 共5页
电大面向对象程序设计期末复习指导参考小抄【精编版】.doc_第4页
第4页 / 共5页
电大面向对象程序设计期末复习指导参考小抄【精编版】.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《电大面向对象程序设计期末复习指导参考小抄【精编版】.doc》由会员分享,可在线阅读,更多相关《电大面向对象程序设计期末复习指导参考小抄【精编版】.doc(5页珍藏版)》请在三一办公上搜索。

1、电大面向对象程序设计期末复习指导小抄一、单项选题1字符串”a+b=12n”的长度为( )。A. 6 B. 7 C. 8 D. 92. x0 | y=5的相反表达式为( )。A. x=0 | y!=5 B. x0 | y!=5 D. x0 & y=53. 循环体有可能一次都不执行的语句为( )。A. for循环 B. switch循环C. do循环 D. 任一种循环4. 函数调用func(exp1,exp2,exp3),exp4,exp5)中所含实参的个数为( )个。 A. 1 B. 2 C. 3 D. 55. 假定p是具有int*类型的指针变量,则给p赋值的正确语句为( )。A. p=new

2、int; B. p=new int10;C. p=new int*; D. p=new int*;6假定一个二维数组的定义语句为“int a34=3,4,2,8,6;”,则元素a21的值为( )。 A. 2 B. 4 C. 6 D. 07. 假定一个类的构造函数为“A(int aa=1, int bb=0) a=aa; b=bb;”,则执行“A x(0);”语句后,x.a和x.b的值分别为( )。 A. 0和0 B. 0和1 C. 1和0 D. 1和18. 假定AA为一个类,int a()为该类的一个成员函数,若该成员函数在类定义体外定义,则函数头为( )。 Aint AA:a() Bint

3、AA:a() CAA:a() DAA:int a()9关于插入运算符的重载,下列说法不正确的是( )。 A. 运算符函数的返回值类型是ostream & 。 B. 重载的运算符必须定义为类的成员函数。 C. 运算符函数的第一个参数的类型是ostream & 。 D. 运算符函数有两个参数。10. 假定AB为一个类,px为指向该类的一个含有n个对象的动态数组的指针,则执行“delete px;”语句时共调用该类析构函数的次数为( )。 A. 0 B. 1 C. n D. n+1二、填空题1. 当使用_保留字作为函数类型时,该函数不返回任何值。2. 执行char *p=new char(x)操作后

4、,p所指向的数据对象的值为_。3. 当在程序中执行到_语句时,将结束本次循环,执行下一次循环语句。4. 一个指针类型的对象占用内存的_个字节的存储空间。5. 假定用户为类AB定义了一个构造函数“AB(int aa) a=aa;”,则系统(会/不会)_为该类自动定义一个无参构造函数AB() 。 6已知语句“couts;”的输出是“hello,world”,则执行语句“couts+%;”的输出结果为_。 7. 如果一个派生类的基类不止一个,则这种继承称为_。8. 重载一个函数的条件是:该函数必须在参数的个数或参数对应的_上与其它同名函数不相同。9. 假定用户为类AB定义了一个构造函数“AB(int

5、 aa) a=aa;”,则系统(会/不会)_为该类自动定义一个无参构造函数AB() 。10假定用户为类AB定义了一个构造函数“AB(int aa=0):a(aa)”,则定义该类的对象时,可以有_种不同的定义格式。三、程序填充题,根据题意在横线上填写合适的内容。1. 已知一个类的定义如下:#includeclass AA int a10;int n;public:void SetA(int aa, int nn); /初始化函数int MaxA(); /从数组a中前n个元素中查找最大值void SortA(); /采用选择排序的方法对数组a中前n个元素 进行从小到大排序 ; 该类中MaxA()函

6、数的实现如下,请在标号位置补充适当的内容。int _(1)_ int x=a0;for(int i=1; ix) _(2)_;_(3)_;(1) (2) (3)2. 类A的定义 class A int *a; int n; int MaxLen; public: A(): a(0), n(0), MaxLen(0) /无参构造函数 A(int *aa, int nn, int MM) /带参构造函数 n=nn; MaxLen=MM; if(nMaxLen) exit(1); a=new intMaxLen; for(int i=0; in; i+) _(1)_; A()_(2)_; ; (1)

7、 (2) 3在下面一段类定义中, Derived类公有继承了基类Base。需要填充的函数由注释内容给出了功能。class Base private: int mem1,mem2; /基类的数据成员 public: Base(int m1,int m2) mem1=m1; mem2=m2; void output()coutmem1 mem2 ; ;class Derived: public Base private: int mem3; /派生类本身的数据成员 public: /构造函数,由m1和m2分别初始化mem1和mem2,由m3初始化mem3 Derived(int m1,int m2

8、, int m3); /输出mem1,mem2和mem3数据成员的值 void output() _(1)_; coutmem3endl;Derived:Derived(int m1,int m2, int m3): _(2)_ _(3)_;(1) (2) (3) 四、理解问答题,写出程序运行结果或程序(或函数)所能实现的功能。1#include double f1(int n) double sign=1,s=1; for(int i=2;ia; coutf1(a)endl; 函数功能: 2char* f8(char* str1, const char* str2) int i=0,j=0;

9、 while(str1i) i+; while(str2j) str1i+=str2j+ ; str1i=0; return str1; 函数功能:3#include void f2(int& x, int& y) int z=x; x=y; y=z; void f3(int* x, int* y) int z=*x; *x=*y; *y=z; void main() int x=10,y=26; coutx,y=x, yendl; f2(x,y); coutx,y=x, yendl; f3(&x,&y); coutx,y=x, yendl; x+; y-; f2(y,x); coutx,y=

10、x, yendl; 运行结果:五、程序改错,请根据程序段或函数模块的功能改写个别地方的错误。. 下面是分数类fract的定义及测试主程序,在类定义及其友元函数定义中有两处错误,更正错误后程序应显示41/28,请指出错误所在行的行号并给出改正意见。class fract int den; /分子 int num; /分母public: fract(int d=0,int n=1):den(d),num(n) /1行 friend fract &operator+=(fract,fract&); /2行 void show() coutden/num; /3行; /4行 friend fract

11、&operator+=(fract f1,fract f2) /5行 /7行 f1.den=f1.den*f2.num+f1.num*f2.den; /8行 f1.num*=f2.num; /9行 return f1; /10行void main() fract fr(3,4); fr+=fract(5,7); fr.show();错误行的行号为_和_。(2分)分别改正为_(4分) 和_(4分)参考答案:一、单选题1. B 2. B 3.A 4.C 5. D 6. D 7. A 8.A 9. B 10. C二、填空题1. void 2. x 3.contiune 4. 4 5. 不会6. pl

12、e 7. 多继承(或多重继承) 8. 类型 9. 不会 10. 2三、程序填充题,根据题意在横线上填写合适的内容。 评分标准:每空4分 1. (1) AA:MaxA() (2) x=ai (3) return x 2. (1)ai=aai (2)delete a 3. (1) Base:output() (2) Base(m1,m2) (3) mem3=m3四、理解问答题,写出程序运行结果或程序(或函数)所能实现的功能。1. 计算并输出1+的值,其中a的值由键盘输入。2.实现strcat函数的功能,把str2所指字符串连接到str1所指字符串的后面,并返回str1指针。 3. x,y=10,

13、26 x,y=26, 10 x,y=10, 26 x,y=25, 11 五、程序改错,请根据程序段或函数模块的功能改写个别地方的错误。2 5 friend fract &operator+=(fract&,fract); fract &operator+=(fract &f1,fract f2); O(_)O谢谢!【Chinas 10 must-see animations】The Chinese animation industry has seen considerable growth in the last several years. It went through a golden

14、 age in the late 1970s and 1980s when successively brilliant animation work was produced. Here are 10 must-see classics from Chinas animation outpouring that are not to be missed. Lets recall these colorful images that brought the country great joy. Calabash Brothers Calabash Brothers (Chinese: 葫芦娃)

15、 is a Chinese animation TV series produced byShanghaiAnimationFilmStudio. 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. Stil

16、l, 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

17、. 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 childrens education. Proponents of the show claim that it is merely for entertainment. Effendi Effendi, mea

18、ning sir andteacher in Turkish, is the respectful name for people who own wisdom and knowledge. The heros 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 pe

19、ople. 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 dont want to steal food like other mice. Shuke became a pilot and Beita became a tank driver

20、, 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

21、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

22、 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, op

23、ened the shrine and exposed the holy book to the human world. He carved the books 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 heavens law. In order to pass this holy book to human beings, he

24、would have to get by the antagonist fox. The whole animation is characterized by charming Chinesepainting, including pavilions, ancient architecture, rippling streams and crowded markets, which fully demonstrate the unique beauty of Chinas natural scenery. Pleasant Goat and Big Big Wolf【喜洋洋与灰太狼】 Ple

25、asant 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 intomovies. Nezha C

26、onquers 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 b

27、eautiful 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 Kings feud with Nezha over his sons death. Through brave

28、ry 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 aw

29、ards. Havoc in Heaven The story of Havoc in Heaven(Chinese: 大闹天宫)is based on the earliest chapters of the classic storyJourney 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 accompanim

30、ent used in this film are heavily influenced byBeijingOpera 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

31、 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: 金猴降妖), also referred as The Monkey King Conquer

32、s the Demon, is adapted from chapters of the Chinese classics Journey to the West, or Monkey in the Western world. The five-episode animation series tells the story of Monkey King Sun Wukong, who followed Monk Xuan Zangs trip to the West to take the Buddhistic sutra. They met a white bone evil, and

33、the evil transformed human appearances three times to seduce the monk. Twice Monkey King recognized it and brought it down. The monk was unable to recognize the monster and expelled Sun Wukong. Xuan Zang was then captured by the monster. Fortunately Bajie, another apprentice of Xuan Zang, escaped an

34、d persuaded the Monkey King to come rescue the monk. Finally, Sun kills the evil and saves Xuan Zang. The outstanding animation has received a variety of awards, including the 6th Hundred Flowers Festival Award and the Chicago International Childrens Film Festival Award in 1989. McDull【麦兜】 McDull is

35、 a cartoon pig character that was created inHong Kongby Alice Mak and Brian Tse. Although McDull made his first appearances as a supporting character in the McMug comics, McDull has since become a central character in his own right, attracting a huge following in Hong Kong. The first McDull movie McMug Story My Life as McDull documented his life and the relationship between him and his mother.The McMug Story My Life as McDull is also being translated into French and shown in France. In this version, Mak Bing is the mother of McDull, not his father.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号