电大面向对象的程序设计试题库参考资料汇总【电大期末必备考试资料】 .doc

上传人:椰子壳 文档编号:5067639 上传时间:2020-01-31 格式:DOC 页数:12 大小:62KB
返回 下载 相关 举报
电大面向对象的程序设计试题库参考资料汇总【电大期末必备考试资料】 .doc_第1页
第1页 / 共12页
电大面向对象的程序设计试题库参考资料汇总【电大期末必备考试资料】 .doc_第2页
第2页 / 共12页
电大面向对象的程序设计试题库参考资料汇总【电大期末必备考试资料】 .doc_第3页
第3页 / 共12页
电大面向对象的程序设计试题库参考资料汇总【电大期末必备考试资料】 .doc_第4页
第4页 / 共12页
电大面向对象的程序设计试题库参考资料汇总【电大期末必备考试资料】 .doc_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《电大面向对象的程序设计试题库参考资料汇总【电大期末必备考试资料】 .doc》由会员分享,可在线阅读,更多相关《电大面向对象的程序设计试题库参考资料汇总【电大期末必备考试资料】 .doc(12页珍藏版)》请在三一文库上搜索。

1、电大面向对象的程序设计一、单项选择题1、下面那种结构不是C的控制结构 ( )A 顺序结构 B 选择结构 C 循环结构 D 判断结构答: D2、下列是C+语言中合法标识符的是()。A3threeB.ifC._1oneD.while答:C3、下列是合法的C+语言语句的是()。A.if(x0) then x=x-1;else x=x+1;B.if(x0) x=x-1;else x=x+1;C.if x0 x=x-1;else x=x+1;D.if x0 x=x-1;答:B4、下面那一种不是计算机内部表示整数的方法( )A 二进制码 B原码 C 补码 D反码答: A 5、在C+语言中,下列数为合法的实

2、数的是()。A.5E-3B.5E-3.5C. E5D.-3.5E答:A6、C+语言中数据类型最大的是( )A long B float C int D char答: B7、如果一个函数可以在定义中直接或间接的调用自己,这样的函数称为()。A.函数声明 B.嵌套函数 C.定义函数 D.递归函数答:D8、表达式0x550xB4的结果为()。A.0xF5B.0x15C.0xE1D.0x1E答:C9、C中,源代码文件后缀为 ( )A .cpp B .obj C .exe D .c答: A 10、0X5A&0XB7结果是 ( )A 0X13 B 0X12 C 0X14 D 0X15答: B二、填空题1、

3、程序的基本控制结构包括()、()和()。答:顺序结构,选择结构,循环结构2、用来解决问题的,与有限多个步骤组成的具体过程称为( )。答: 算法3、整数类型变量a和b被初始化为3和10,则循环语句while(a=b) a=a+2;共执行()次,执行完语句后a的值为(),b的的值为()。答:4,11,104、在程序编译阶段的错误主要分为两类()和()。答:警告信息,致命错误5、计算机中的数据可以分为( )和( )两大类。答: 数值型、字符型6、字符型数据有两种编码方法:( )和( ) 答: 有美国国家标准局制定的ASCII码、IBM公司提出的EBCDIC码7、通过 C+ 语言中的 ( ) 机制,可

4、以从现存类中构建其子类。 答: 继承(或派生)8、 封装要求一个对象应具备明确的功能,并具有 ( ) 以便和其它对象相互作用。答: 接口或界面、或公有成员9、软件工程中认为影响一个程序质量的主要因素包括()、()、()、()和()等方面。而面向对象的程序设计特别强调软件质量的两个方面()和()。答:正确性,健壮性,可扩展性,可重用性,有效性,语法与语义的可靠性,结构方面的可扩展性与可重用性10、15/3=( ) , 16/3=( ) , 15%3=( ), 16%3=( )答: 5、5、0、111、 0XB42即10110100向右连移动两次,逻辑右移的结果为( ),即0X2D答: 11010

5、000、0010110112、一种语言主要由( )和( )两部分组成。答: 语法、语义13、为了让编译程序了解数据所属的类型,同常程序设计语言都尊循“( )”的原则。答: 先申明,后使用14、C+语言中的数据可分为( )和( )两大类。答: 常量、变量三、判断题1、结构化程序设计方法的主要技术是自顶向下、逐步求精,采用单入口/单出口的控制结构。( )答: 对2、程序中以“/”开头直至该行行尾的内容成为注释,用于说明或者解释程序的功能。( )答: 对3、组成C+程序的最小单位是单词,C程序有5种单词,保留字,标志符、常量、运算符和分界符。( )答: 对4、C中,对基本数据类型的常量与变量进行加工

6、的过程成为运算,表示各种不同运算的符号成为运算符,参与运算的数据成为操作数。( )答: 对5、表达式a ?b=0:b1,的求值次序是(a ?(b=0):b)1) ( )答: 对四、简答题1、面向对象的程序设计有那些基本特征?答:在面向对象程序中,将现实世界的实体抽象成为对象,不同对象之间的相互作用和相互通信构成了完整的客观世界。它的基本特征包括:(1)数据的封装,数据封装将一类数据和与这类数据有关的操作集合封装在一起,形成一个能动的实体成为对象。用户不必知道对象行为的实现细节,只需根据对象提供的外部特性接口访问对象,这反映了数据抽象数据类型的思想。(2)继承,类支持层次的模型结构,低层次的类(

7、子类)可以从他的高层次类(基类、父类)中继承所有的数据或操作,并扩充自己的特殊数据和操作。继承可以使不同的对象的共同性质只需定义一次,用户可以充分利用已有的类,符合软件重用的目标。(3)多态性,用户在使用函数或对象编程时,关心的是该函数或对象的功能和使用界面,并不需要了解该函数或对象的使用与哪一种实现方法匹配,在面向对象程序设计中,程序员可为同一函数或对象提供多种不同的实现,以适合不同的场合。2、什么是内联函数?使用内联函数有什么好缺点?答:(1)内联函数:在编译时将所调用的函数代码直接嵌入到调用函数的调用处,而不是将程序流程转出去,这种嵌入到调用函数中的函数就称为内联函数。(2)优点:避免小

8、规模函数调用的开销(参数传递、上下文切换、空间开销),提高程序的执行效率;(3)缺点:如果内联函数的开销不是整个程序执行时间的主要部分,它的优点就不明显;内联函数加大了可执行程序,可能导致额外的内存交换而实际降低了执行速度。3、什么是程序断言?在程序中使用断言主要有什么作用?答:(1)程序断言:为在程序中反映程序编译运行的正确性与需求说明的一致性,而在程序中加入描述程序需求说明的表达式称为程序断言。(2)作用:保证程序的正确性与健壮性;断言可用于形成程序的文档;支持程序的动态调试;构成异常处理的基础。4、简述实体、对象和类的概念以及他们之间的关系。答:(1)概念:实体,现实世界中的物理实体;对

9、象:具有类类型的变量称为对象,也就是现实世界中某个具体的物理实体在计算机逻辑中的映射和体现。类:对一组具有相同属性、表现相同行为的对象的描述。(2)关系:实体与对象,是现实与计算机的逻辑映射;对象与类,类是具有一定共性的对象的抽象,类的某一个实例就是对象。5、什么是变量的作用域和生存期?什么是局部变量和全局变量?答:(1)作用域:在变量被创建之后,变量的名字能被引用的地方。(2)生存期:在程序的执行过程中变量实际占用内存或寄存器的时间。变量的生存期是由声明变量时选择的存储类别决定的。(3)局部变量:在函数内(块作用域中)声明的变量。只有在定义他们的函数(块语句中)才可见并允许修改,如果不使用特

10、殊的访问方式,任何其他函数都不能访问或修改变量。(4)全局变量:在文件作用域中声明的变量。在函数定义外声明,从不属于任何函数,从被定义开始,在整个文件范围内有效,可以被不同的函数使用。五、应用题1、讲用户输入的24小时制时间转换为12小时制时间,写出其算法解答:include Void mian( )Int hour;Char noo=A;Couthour;If (hour12)Hour=hour-12;Noon=P;Cout”the hour is “ hour noon”.M.n;2、设a=1,b=0,c=1,试计算下列逻辑表达式的值。(8分)(1)!a&!b答:0(2)a&b|c答:13

11、、给出数学、英语、语文这样的菜单供用户选择,依据用户选择的序号显示其结果,写出其算法解答:include Void mian( )Cout”1.数学n”;Cout”1.英语n”;Cout”1.语文n”;Coutchoice;Switch (choise)Case 1 cout”you choice is 数学.n”;Break;Case 2 cout”you choice is 英语.n”;Break;Case 3 cout”you choice is 语文.n”;Break;Default: cout”you did not make choice.n”;Break;4、指出下列程序的输出结

12、果(8分)#includevoid main( )float a=2.5;int b=7;cout”a*b is:”a*b”n”;cout”(int)a*b is:”(int)a*b”n”;cout”a*(float)b is:”a*(float)b”n”;答:a*b is:17.5(int)a*b is:14a*(float)b is:17.55、给出下程序的输出结果(9分)#include int global_value=5;void display(void)int local_value=5;static int static_value=5;cout”The global valu

13、e is:”global_value”n”;cout”The local value is:”local_value”n”;cout”The static value is:”static_value”n”;global_value = global_value+2;local_value= local_value+2;static_value= static_value+2;return;int main( )while(global_value8) display( );return 0;答:The global value is:5The local value is:5The stat

14、ic value is:5The global value is:7The local value is:5The static value is:5The global value is:9The local value is:5The static value is:56、求1到100之间的数字平方相加之和的原始算法。解答:include Void mian( )Const int min=1;Const int max=100;Int sum;Int cnt;Sum=0;For (cnt=min:cnt=max;cnt=cnt+1) sum=sum+cnt*cnt;Cout“the su

15、nmming result is ”n”;7、编写一个程序,判断用户输入的年份是否为闰年。(提示:闰年年份要么能被4整除且不能被100整除,要么能被400整除,除此之外都不是闰年)(10分)答:(答案不唯一,主要是if的判断条件和输入语句对即可)#includevoid main( )int year;coutyear;if(year%400=0 | (year % 4=0 & year % 100!=0)cout”The year”year” is leap year”;elsecout”The year”year” isnt leap year”;8、输入三个数,求三数中最小的数,写出其算

16、法解答:include Void mian( )Float I,j,k;Float min;Cout ijk;Min=I;If (jmin) min=j;If(kmin) min=k;Cout ”minimum is ”min”n”;9、给定正整数n,求平方不超过n的最大整数,写出其算法解答:include Void mian( )Int n ;Int max;Coutn;If (n=0) cout“input error! n”;ElseMax=1;While (max*max=n) max=max+1;Cout“the maximu interger is:”max-1”/n”10、用10

17、0元钱,买100只鸡,其中母鸡每只5元,公鸡每只3元,而1元钱可以买3只小鸡,文可以买多少只母鸡、多少只公鸡、多少只小鸡?试写出其算法。解答:include Void mian( )Int hen ,cock,chicken;For (hen=0;hen=20;hen+) For (cock=0;cock=33;cock+)Chicken=100-hen-cock;If (chicken%3=0)&(5*hen+3*cock+chicken/3)=100)Cout”hen=”hen“then”cock“tchicken=”chickenendl;请您删除一下内容,O(_)O谢谢!【Chinas

18、 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 Chinas animation outpouring that are not

19、 to be missed. Lets recall these colorful images that brought the country great joy. Calabash Brothers Calabash Brothers (Chinese: 葫芦娃) 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

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

21、ve (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,

22、and lack of suitability for childrens education. Proponents of the show claim that it is merely for entertainment. Effendi Effendi, meaning 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 im

23、portantly, 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

24、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, 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 Bei

25、ta 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 tou

26、ched 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 st

27、ory 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 books contents on the stone wall of a white cloud cave in the mountains. He was then puni

28、shed 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 would have to get by the antagonist fox. The whole animation is characterized by charming Chinesepainting, including pavilions, ancient architecture, rippling stream

29、s and crowded markets, which fully demonstrate the unique beauty of Chinas 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

30、revolves around a clumsy wolf who wants to eat them. It is a popular domestic animation series and has been adapted intomovies. 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

31、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 w

32、as persecuting local residents. The story primarily revolves around the Dragon Kings feud with Nezha over his sons 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 cu

33、lture 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 storyJourney to the West. The main character is Sun

34、 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 byBeijingOpera traditions. The name of the movie became a colloquialism in the Chinese language to describe someone maki

35、ng 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 memorab

36、le, The Golden Monkey Defeats a Demon【金猴降妖】 The Golden Monkey Defeats a Demon (Chinese: 金猴降妖), also referred as The Monkey King Conquers 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

37、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 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 mons

38、ter and expelled Sun Wukong. Xuan Zang was then captured by the monster. Fortunately Bajie, another apprentice of Xuan Zang, escaped and 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, inc

39、luding the 6th Hundred Flowers Festival Award and the Chicago International Childrens Film Festival Award in 1989. McDull【麦兜】 McDull is 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 co

40、mics, 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. 第 12 页

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

当前位置:首页 > 绩效管理


经营许可证编号:宁ICP备18001539号-1