2015年电大面向对象程序设计期末复习指导参考小抄【精编版】 _第1页
2015年电大面向对象程序设计期末复习指导参考小抄【精编版】 _第2页
2015年电大面向对象程序设计期末复习指导参考小抄【精编版】 _第3页
2015年电大面向对象程序设计期末复习指导参考小抄【精编版】 _第4页
2015年电大面向对象程序设计期末复习指导参考小抄【精编版】 _第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

电大 面向对象程序设计期末复习指导 小抄 一、单项选题 1 字符串 a+b=12 n 的长度为( )。 A. 6 B. 7 C. 8 D. 9 2. x0 | y=5 的相反表达式为( )。 A. x=0 | y!=5 B. x0 | y!=5 D. x0 & y=5 3. 循环体有可能一次都不执行的语句为 ( ) 。 A. for 循环 B. switch 循环 C. do循环 D. 任一种循环 4. 函数调用 func(exp1,exp2,exp3),exp4,exp5)中所含实参的个数为 ( )个。 A. 1 B. 2 C. 3 D. 5 5. 假定 p是具有 int*类型的指针变量,则给 p赋值的正确语句为( )。 A. p=new 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. 0 7. 假定一个类的构造函数为 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 和 1 8. 假定 AA为一个类, int a()为该类的一个成员函数,若该成员函数在类定义体外定义,则函数头为( )。 A int AA:a() B int AA:a() C AA:a() D AA: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) 操作后, p所指向的数据对象的值为 _。 3. 当在程序中执行到 _语句时,将结束本次循环,执行下一次循环语句。 4. 一个指针类型的对象占用内存的 _个字节的存储空间。 5. 假定用户为类 AB定义了一个构造函数 AB(int aa) a=aa; ,则系统(会 /不会) _为该类自动定义一个无参构造函数 AB() 。 6 已知语句 couts; 的输出是 hello,world ,则 执行语句 couts+%; 的输出结果为 _。 7. 如果一个派生类的基类不止一个,则这种继承称为 _。 8. 重载一个函数的条件是:该函数必须在参数的个数或参数对应的 _上与其它同名函数不相同。 9. 假定用户为类 AB定义了一个构造函数 AB(int aa) a=aa; ,则系统(会 /不会) _为该类自动定义一个无参构造函数 AB() 。 10假定用户为类 AB 定义了一个构造函数 AB(int aa=0):a(aa) ,则定义该类的对象时, 可以有 _种不同的定义格式。 三、程序填充题,根据题意在横线上填写合适的内容。 1. 已知一个类的定义如下: #include class AA int a10; int n; public: void SetA(int aa, int nn); /初始化函数 int MaxA(); /从数组 a中前 n个元素中查找最大值 void SortA(); /采用选择排序的方法对数组 a中前 n个元素 进行从 小到大排序 ; 该类中 MaxA()函数的实现如下,请在标号位置补充适当的内容。 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) (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, 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; 函数功能: 2 char* f8(char* str1, const char* str2) int i=0,j=0; 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=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 &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. ple 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+aiii2 2)1(的值,其中 a的值由键盘输入。 2.实现 strcat函数的功能,把 str2所指字符串连接到 str1所指字符串的后面,并返回 str1指针。 3. x,y=10, 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谢谢! 2015年中央电大期末复习考试小抄大全,电大期末考试必备小抄,电大考试必过小抄 After earning his spurs in the kitchens of The Westin, The Sheraton, Sens on the Bund, and a sprinkling of other top-notch venues, Simpson Lu fi nally got the chance to become his own boss in November 2010. Sort of. The Shanghai-born chef might not actually own California Pizza Kitchen (CPK) but he is in sole charge of both kitchen and frontof- house at this Sinan Mansionsstalwart. Its certainly a responsibility to be the head chef, and then to have to manage the rest of the restaurant as well, the 31-year-old tells Enjoy Shanghai. In hotels, for example, these jobs are strictly demarcated, so its a great opportunity to learn how a business operates across the board. It was a task that management back in sunny California evidently felt he was ready for, and a vote of confi dence from a company that, to date, has opened 250 outlets in 11 countries. And for added pressure, the Shanghai branch was also CPKs China debut. For sure it was a big step, and unlike all their other Asia operations that are franchises, they decided to manage it directly to begin with, says Simpson. Two years ago a private franchisee took over the lease, but the links to CPK headquarters are still strong, with a mainland-based brand ambassador on hand to ensure the business adheres to its ethos of creating innovative, hearth-baked pizzas, a slice of PR blurb that Simpson insists lives up to the hype. They are very innovative, he says. The problem with most fast food places is that they use the same sauce on every pizza and just change the toppings. Every one of our 16 pizza sauces is a unique recipe that has been formulated to complement the toppings perfectly. The largely local customer base evidently agrees and on Saturday and Sunday, at least, the place is teeming. The kids-eat-for-free policy at weekends is undoubtedly a big draw, as well as is the spacious second-fl oor layout overlooked by a canopy of green from Fuxing Park over the road. The company is also focusing on increasing brand recognition and in recent years has taken part in outside events such as the regular California Week. Still, the sta are honest enough to admit that business could be better; as good, in fact, as in CPKs second outlet in the popular Kerry Parkside shopping mall in Pudong. Sinan Mansions has really struggled to get the number of visitors that were envisaged when it first opened, and it hasnt been easy for any of the tenants here, adds Simpson. Were planning a third outlet in the city in 2015, and we will probably choose a shopping mall again because of the better foot traffic. The tearooms once frequented by Coco Chanel and Marcel Proust are upping sticks and coming to Shanghai, Xu Junqian visits the Parisian outpost with sweet treats. One thing the century-old Parisian tearoom Angelina has shown is that legendary fashion designer Coco Chanel not only had style and glamor but also boasted great taste in food, pastries in particular. One of the most popular tearooms in Paris, Angelina is famous for having once been frequented by celebrities such as Chanel and writer Marcel Proust. Now Angelina has packed up its French ambience, efficient service, and beautiful, comforting desserts and flown them to Shanghai. At the flagship dine-in and take-out space in Shanghai, everything mimics the original tearoom designed from the beginning of the 20th century, in Paris, the height of Belle Epoque. The paintings on the wall, for example, are exactly the same as the one that depicts the landscape of southern France, the hometown of the owner; and the small tables are intentional imitations of the ones that Coco Chanel once sat at every afternoon for hot chocolate. The famous hot chocolate, known as LAfricain, is a luxurious mixture of four types of cocoa beans imported from Africa, blended in Paris and then shipped to Shanghai. Its sinfully sweet, rich and thick as if putting a bar of melting chocolate directly on the tongue and the fresh whipped cream on the side makes a light, but equally gratifying contrast. It is also sold in glass bottles as takeaway. The signature Mont-Blanc chestnut cake consists of three parts: the pureed chestnut on top, the vanilla cream like stuffing, and the meringue as base. Get all three layers in one scoop, not only for the different textures but also various flavors of sweetness. The dessert has maintained its popularity for a century, even in a country like France, perhaps the worlds most competitive place for desserts. A much overlooked pairing, is the Paris-New York choux pastry and N226 chocolate flavored tea. The choux pastry is a mouthful of airy pecan-flavored whipped cream, while the tea, a blend of black teas from China and Ceylon, cocoa and rose petals, offers a more subtle fragrance of flowers and chocolate. Ordering these two items, featuring a muted sweetness, makes it easier for you to fit into your little black dress. Breakfast, brunch, lunch and light supper are also served at the tearoom, a hub of many cultures and takes in a mix of different styles of French cuisines, according to the management team. The semi-cooked foie gras terrine, is seductive and deceptive. Its generously served at the size and shape of a toast, while the actual brioche toast is baked into a curved slice dipped with fig chutney. The flavor, however, is honest: strong, smooth and sublime. And you dont actually need the toast for crunchiness. This is the season for high teas, with dainty cups of fine china and little pastries that appeal to both visual and physical appetites. But there is one high tea with a difference, and Pauline D. Loh finds out just exactly why it is special. Earl Grey tea and macarons are all very well for the crucial recuperative break in-between intensive bouts of holiday season shopping. And for those who prefer savory to sweet, there is still the selection of classic Chinese snacks called dim sum to satisfy and satiate. High tea is a meal to eat with eye and mouth, an in-between indulgence that should be light enough not to spoil dinner, but sufficiently robust to take the edge off the hunger that strikes hours after lunch. The afternoon tea special at Shang-Xi at the Four Seasons Hotel Pudong has just the right elements. It is a pampering meal, with touches of luxury that make the high tea session a treat in itself. Whole baby abalones are braised and then topped on a shortcrust pastry shell, a sort of Chinese version of the Western vol-au-vent, but classier. Even classier is the dim sum staple shrimp dumpling or hargow, upgraded with the addition of slivers of midnight dark truffles. This is a master touch, and chef Simon Choi, who presides unchallenged at Shang-Xi, has scored a winner again. Sweet prawns and aromatic truffles whats not to love? His masterful craftsmanship is exhibited in yet another pastry a sweet pastry that is shaped to look like a walnut, but which you can put straight into the mouth. It crumbles immediately, and the slightly sweet, nutty morsel is so easy to eat youll probably reach straight for another. My favorite is the dessert that goes by the name yangzhi ganlu, or ambrosia from the gods. The hotel calls it chilled mango cream with sago, pomelo and birds nest made with ingredients that resonate with every female soul. It does taste like ambrosia, with the sweet-sour fragrance of the mango

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论