版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、电大面向对象程序设计期末复习指导小抄一、单顼选题1.字符串a+b=12n”的长度为(A. 6B. 7)C.8D.92.x0| y=5的相反表达式为( A. x0 | y!=53.4.B. x0 & y=5循环体有可能一次都不执行的语句为(A.for 循环B. switch 循环C. do循环D.任一种循环函数调用func(exp1,exp2,exp3),exp4,exp5)中所含实参的个数为(A. 1B.2C. 3D.5)个。5.假定p是具有int,类型的指针变量,则给p赋值的正确语句为( A. p=new int;C. p=new int*;)。6.a34=(3,4,(2,8,6;A. 2B
2、.4B. p=new int10);D. p=new int*;假定一个二维数组的定义语句为 ,则元素a的值为()。C.6D.0int假定一个类的构造函数为 A(int aa=1, int bb=O) (a=aa; b=bb;,则执行A7.x(0);”语句后,x.a和x.b的值分别为()。A. 0 和 08.假定AA为一个类,inta()为该类的一个成员函数.若该成员函数在类定义体外定义,则函数头为(A . int AA:a()B . int AA:a()C . AA:a()D . AA:int a()9 .关于插入运算符 的重载.下列说法不正确的是(A. 运算符函数的返回值类型是ostrea
3、m &。B. 重载的运算符必须定义为类的成员函数。C. 运算符函数的第一个参数的类型是ostream &。D. 运算符函数有两个参数。10.假定AB为一个类,px为指向该类的一个含有该类析构函数的次数为()A. 0B. 1B. 0 和 1C. 1 和 0 D. 1 和 1C. n)o)。n个对象的动态数组的指针,则执行delete px;语句时共调用D. n+1二、填空题1-当使用保留字作为函数类型时,该函数不返回任何值。2. 执行char*p=new char( x*)操作后,p所指向的数据对象的值为。3. 当在程序中执行到语句时,将结束木次循环,执行下一次循环语句。4. 一个指针类型的对象
4、占用内存的个字节的存储空间。5. 假定用户为类AB定义了一个构造函数AB(intaa) (a=aa;,则系统(会/不会)为该类自动定义一个无参构造函数AB() %6. 已知语句coutsr的输出是hello,world ”,则执行语句 coutvs+%;”的输出结果为-7. 如果一个派生类的基类不止一个.则这种继承称为。8. 重载一个函数的条件是:该函数必须在参数的个数或参数对应的上与其它同名函数不相同。9. 假定用户为类AB定义了一个构造函数AB(intaa)(a=aa;)”,则系统(会/不会)为该类自动定义一个无参构造函数AB() %10 .假定用户为类AB定义了一个构造函数AB(inta
5、a=O):a(aa)0,则定义该类的对象时,可以有种不同的定义格式。三、程序填充题,根据题意在横线上填写合适的内容。1. 已知一个类的定义如下:#includeclass AA (int a10);int n;public:void SetA(int aa, int nn); / 初始化函数int MaxA();从数组a中前n个元素中查找最大值void SortA();”采用选择排序的方法对数组a中前n个元素进行从小到大排序;该类中MaxA()函数的实现如下,清在标号位置补充适当的内容。inKDint x=a0);for(int i=1; ix)-(2)-;T3);(1)(2)2.类A的定义
6、class A ( int *a; int n; int MaxLen;public:A(): a(0), n(0), MaxLen(O) ( A(int *aa, int nn, int MM)( n=nn;MaxLen=MM; if(nMaxLen) exit(1); a=new intMaxLen; forfint i=0; in; i+) A(X(2) ;(1)(2)(3)无参构造函数带参构造函数;3.在下面一段类定义中,Derived类公有继承了基类Base。需要填充的函数由注释内容给出了功能。class Baseprivate:int mem1,mem2;“基类的数据成员publi
7、c:Base(int m1,int m2) (mem1=m1; mem2=m2;void output()(coutmem1 ,mem2;class Derived: public Base(private:int mem3;派生类木身的数据成员public:”构造函数,由ml和m2分别初始化mem 1和mem2.由m3初始化mem3 Derived(int m1,int m2, int m3);输出mem1,mem2和mem3数据成员的值void output()(1: coutmem3endl;;Derived:Derived(int m1,int m2, int m3):(2)( 3);
8、(2)(3)四、理解问答题,写出程序运行结果或程序(或函数)所能实现的功能。1. #includedouble f1(int n)(double sign=1,s=1;for(int i=2;i=n; i+) ( s+=sign/(i*i); sign*1;)return s;void main()(int a;cina;coutf1(a)endl;函数功能:2. char* f8(char* str1, const char* str2)(int i=0,j=0;while(str1 i) i+;while(str2j) str1 i+=str2j+;str1(i=,O,;return st
9、r1;)函数功能:3. #includevoid 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;即,y);coutx,y=x, yendl;f3(&x,&y);coutx,y=,x, yendl;x+; y-;丘(y,x);coutx,y=x, yendl;运行结果:五、程序改借,清根据程序段或函数模块的功能改写个别地方的错误。下面是分数类fract的定义及测试主程序,在类定义及其友元函数
10、定义中有两处错误,更正错误后程序应显示41/28 ,请指出错误所在行的行号并给出改正意见。class fract(int den;分子int num; * 分母public:fract(int d=O,int n=1):den(d),num(n)(/1 行friend fract &operator+=(fract,fract&);112 行void show()( coutden7num;/3 行;/4行friend fract &operator+=(fract f1,fract f2)/5 行(/7行f1 .den=f1 .den*f2.num+f1 .num*f2.den;/8 行f1
11、.num,=f2.num;9行return f1;10 行void main()( fract fr(3,4); fr+=fract(5,7); fr.show();错误行的行号为和。(2分)分别改正为(4分)和(4分)参考答案:一、单选题1. B2. B3.A4.C5. D 6. D 7. A 8.A9. B 10. C二、填空题1. void 2. x 3.contiune 4. 45.不会6. pie 7.继承(或多重继承)8.类型9.不会10. 2三、程序填充题,根据题意在横线上填写合适的内容。评分标准:每空4分1. (1) AA:MaxA() (2) x=ai (3) return
12、x2. (1) a(i)=aai delete ga3. (1) Base:output() (2) Base(m1,m2)(3) mem3=m3四、理解问答题,写行结果或程序(或函数)所能实现的功能。1. 计算并输出1+,上*的值,其中a的值由键盘输入。2. 实现strcat函数0鱼血,把str2所指字符串连接到str1所指字符串的后面,并返回str1指针。3. x,y=10,26x,y=26,10x,y=10, 26x,y=25,11五、程序改销,清根据程序段或函数模块的功能改写个别地方的错误。25friend fract &operator+=(fract&.fract);fract &
13、operator+=(fract &f 1,fract f2);诺 您册I除“卜内容: O(rr)O 避避 11 Chinas 10 mustsee animations 】Ttw Chinese animation industry has seen 8nsiderabte Qrowth in th 包 last several yearsltlwentthrough(algoJdenlagelin!thellateli970sland(l980slwhensuccessively(bGlliant animatkxilworklwasIproduced.lHereiarellOIrnust
14、-seelclassicsIfrom Chinas_animationoutpouring_that-are-nofto-bemissed letsrecakthesecotoffurimagQsthafbroughfthecourrtry-QreafjoyCalabash-Rrothers CalabashBrothers) (Chinese:二糊芦姓 AslalChinesGlanimationITVIseriesIproducecflby Shanghai Animation Film_lStudio.A=lnthell980slthelserieslwas!oneofthelmost
15、p(ulartanimationslinlChina.lltZwaslrelGasedlatZa!potntZwhGnithelChineselanirnationlindustrytwasiinlalrGlatrvelyldownedlstatelcomparedltoltherestZofthe intemationallcommunity.lStill thelseriGslwasltranslatedlintol7ldifferent languages.lThelGpisodeslwGrelproducGdlwithlalvast amountlofpapef-cutlanimati
16、ons_2 RlackCaEDetectiveRlackZCatDetectiveZ (Chinese:黑猫警长)lislalChineselanimatk)nltelevisionlsGrieslproducedlbyttheShanghaLAnimationFiimlStudioJlt issometimes-known-as-Mr.-Rlack.The-series-was-originally-aired-from-1984-to-1987.-ln-June-2006.-a-rebroadcasting-of-the-o(iginaksenes-was-announced.Critic
17、sIbemoanlthelserieslviolence.landllackZofsuitability-for-childreas-education.-Proponents-ofthe-show-daim-that it-is-merely-fbcentertainment.Effendi Effendr.-meaning-sirand teacher-in-Turkish.-is-the-respectful-name-for-people-who-own-wisdom-andknowledge.-The-hGros-real-name-was-Nasreddin/sHe-was-wis
18、e-and-witty-and.-more-importantly.-he-had-the-courage-to-resist-theexploitation-of noblemen.-HG-was-ateo-fuikofcompassion-and-tried-his-best-tohelp-poor-people.Adventure-of-Shuke-and-Reita4善克乌 川塔】AdvcntwoW Sbuto and Roila (Chinoce;簿克MU齐4-祐 aGlas&iG animation by NhGnQ.YuaniiG who i&kno*n as Ki*of-Fai
19、ry-Tales-in-China.-Shuke-and-Reita-are-two-mice-who-don,t-want-to-steal-food-le-other-miCG.-Shuke-became-a-pitot-and-RedriveRan&thepairmetaccidentallynd-became ooodfriends. Thenthevbefrisndeda.boYnamedPipiiu.Withthe4wlpof PiPiluthev co-founded-an-air1ine-named-ShukG-Reta-Air1ines-to-heshowstheprecio
20、usnessoffriendship-andhoWpeoplAShouldbe-bravewhervfacin8difficulties.EvenadultAfBcallinqthis-animatknHeavenly-Rook to-as* Legend-of-the in- 1983.AAA=The combinatkn-of-music- lftefature-wPtng-Yao Feng-Ktenglong. holy- book4o-the of-a- white-cloud-cave- for-Sfe-by-the-jadG- 4. The-whole-animation-isGo
21、at-and-Rig-Rig-Wolftoday-can-still-feel-touched-by- Secrets-of-the-Heavenly-Rook. Sealed-Rook*-or-wTates-about- film-was-produced-with.- and-vivid- animations.-The Zhuan,-meaning-The : Yuangong.-the-deacon- humanworld .Hecarvedthe in-the-nountains.-He-was-then emprorforbreaking-heavens-law.ln9rdefto
22、-pass4hisholybook. tQhumanbeinQS,-hewouldhavetOQ 包 GbYtheantaQonistfox.太JB) -is-a-ChinGSG-animated-teievision-series. :GreGD-Pasture.-and-the-story-revolves-afOund-resklGnts.-The-story-primarily-rGvolves-around -death.-Through-bravery-and-wit.-Nezha-finally -defeated-him.The-fiim-shows-various-kinds
23、 -China.-such-as-spedacuiar-mountains.-elegant- has-received-a-variety-of-awards.Havoc-in-阁天) is-based-on-the-eariiest-chapters-of-th isSunWukong.akathe-Monkey-King.whosome-scenes.Secrets-of-the(Chinese:二天书奇谈)also-referred the-Heavenly-Rook*.-was- reieased ngorous-dibing-and-fluidSuppression-of-the-
24、Defnons,-by -7-r:77r-r. - epewed 膈md .Mposed charactenzed-by-charming-Chinese pamting.-inducfing-paviiions,- andent-architecture.-fppiing-streams-and-crcwded-markets.-which-出& book s*contentsont e-stone- fuly-demonstrate-the unique-beauty-of Chinasiatural-scenery.Pleasant:喜汗汗与灰太狼 Pleasant-Goat-and-R
25、ig-Rig-Woif (Chinese:.百羊羊 S灰 The-show-is-aboutma-group-of-goats-ving-on-the domestic-animation.seri 竺-anQhas-besKing 二 Chinese:二if死阁海)is-an-outstanding and-is-based-on-an-episode-from-the-ChinGse - gave-birth-to-a-ball-of-flGsh-shaped-like-a-lotus beautifu!-boy.-Nezha.-spnjng-out.-One-Dragon.animati
26、on*issued-by*the-MinistryofCulture*in1979 mythological-novel-Tengshen-Yanyi*.A-motherbud.Th-father.LiJingchopped-openthe-balL-andwh-nN-zhawaMsevenyears-old-hewenttotheson-of the-Dragon-King-who-was-persecuting-local the-Dragon-Kings-feud-with-Nezha-over-his-sonsbroke-into-the-underwater-palace-and-s
27、uccessfullyof-attractive-sceneriGs-and-the-traditonakculture-ofsea-waves-and-exquisite-ancientChinese-dothes.-lt- Heaven_The-story-of-Havoc-in-HeavenChinese:大 classic$iofy Jcneyto-th手West.Tbe-main-charactsr rebels-against-the-Jade-Emperor-of-heaven.-The-stylized-animation-and-drums-and-percussion-ac
28、companiment used-in-this-film-are-heavily-influenced by Reijing-Opera-traditions.- The-name-of-the-movie-became-a-coiloquialrsm-in-the-Chinese-language-to-describe-someonG-making-a-mess.-Regardless-that- it was-an-animated-film.-ft-stil-becamexie-of-the-most induerrtial-fi1ms-in-all-of-Asia.-Countie
29、ss-cartoon-adaptatkxis-that-foltowed-have-reused-the-same-classic story-Joumey-to-the-West.-yet-many-consider-this-1964-iteration-to-be-the-most-original.-fitting-and-memorabte,-Tbe-Goiden-Monkey-Defeats-a-Demon -【金孜碌妖】The-Goki8nMonkeyQefeatsaDemon(Chines。:会奏舜成).aisoreferredasThe-MonkQyKingConquers4
30、heDemon.isadapted4romchapters-of-the-Chinese-ciassics-,Joumey-to-the-West.w-or-,Monkey-in-the-Westem-wortd.- ThG-five-episode-animaton-series-tells-the-story-of Ktonkey-King Sun-Wukong,-who-foliowed-Monk-Xuan-Zang*s-trip-to-the-West-to4ake-the-Ruddhislic-sutra.-They-met-a-white-bone-evil.-and-the-eviktransformed-human appearances-three-times-to-seduce-the-monk.-Twice-K4onkey-King-recognized-it-and-brought it-down.-ThG-
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 一次性劳务外包合同
- 个人鱼塘外包合同
- 中药煎煮外包合同
- 二维动画外包合同
- 京东网店外包合同
- 会所服务员外包合同
- 代发仓储外包合同
- 传媒类外包合同
- 全屋定制外包合同
- 公司欠薪外包合同
- 中国牙外伤诊疗指南(2026版)
- 围手术期液体管理
- 2026年广东深圳市高三二模高考语文试卷试题(含答案)
- 基层老年痴呆防治管理指南(2025版)
- 2026河南三支一扶考试押题
- 2026年沈阳水务集团有限公司校园招聘笔试备考试题及答案解析
- YY/T 1992-2025采用机器人技术的辅助手术设备总结性可用性测试方法
- 广东省2026届高三下学期普通高等学校招生全国统一考试模拟测试(一)地理试卷(含答案)
- 棋牌室消防安全责任制度
- 青岛农商银行代理实物贵金属业务管理办法培训
- 国开2026年《新媒体产品策划》形考作业1-5答案
评论
0/150
提交评论