




已閱讀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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年工業互聯網平臺同態加密技術在工業設備數據安全防護中的創新實踐報告
- 2025網絡科技公司業務合作合同模板
- 探索數字插畫在遠程教育中的價值
- 醫療行業中的數字化博物館建設與推廣
- 綠色建材項目運營管理方案(參考范文)
- 康復醫療器械市場細分領域需求分析:2025年產品創新與市場布局報告
- 教育精準扶貧項目實施對農村師資隊伍建設的評估報告
- 內容創意與數字化營銷工具的配合
- 2025年文化遺產數字化保護與增強現實(AR)技術的融合應用報告
- 商業領域中的數字健康監測策略
- 畢業論文指導教師指導記錄6篇
- 石油化工設備維護檢修規程
- 貝氏體鋼軌超高周疲勞行為的研究課件
- 中國各鄉鎮名錄大全、街道名錄大全(甘肅省)
- GB∕T 2518-2019 連續熱鍍鋅和鋅合金鍍層鋼板及鋼帶
- 青海省部門統計數據直報系統
- 講人工智能的誕生課件
- 大氣商務勵志年終工作總結PPT模板課件
- 學校三年級24點競賽考試試卷
- 《林草種子生產經營許可證》申請表(種子類、苗木類)空表
- 硅膠安全技術說明書(MSDS)
評論
0/150
提交評論