2015年電大面向?qū)ο蟪绦蛟O(shè)計(jì)期末復(fù)習(xí)題4及參考答案(經(jīng)典復(fù)習(xí)考試題)_第1頁(yè)
2015年電大面向?qū)ο蟪绦蛟O(shè)計(jì)期末復(fù)習(xí)題4及參考答案(經(jīng)典復(fù)習(xí)考試題)_第2頁(yè)
2015年電大面向?qū)ο蟪绦蛟O(shè)計(jì)期末復(fù)習(xí)題4及參考答案(經(jīng)典復(fù)習(xí)考試題)_第3頁(yè)
2015年電大面向?qū)ο蟪绦蛟O(shè)計(jì)期末復(fù)習(xí)題4及參考答案(經(jīng)典復(fù)習(xí)考試題)_第4頁(yè)
2015年電大面向?qū)ο蟪绦蛟O(shè)計(jì)期末復(fù)習(xí)題4及參考答案(經(jīng)典復(fù)習(xí)考試題)_第5頁(yè)
已閱讀5頁(yè),還剩2頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

PAGE1PAGE61.由C++源程序文件編譯而成的目標(biāo)文件的默認(rèn)擴(kuò)展名為(C)。A.cppB.exeC.objD.lik2.設(shè)x和y均為bool量,則x&&y為真的條件是(A)。A.它們均為真B.其中一個(gè)為真C.它們均為假D.其中一個(gè)為假3.在下面的二維數(shù)組定義中,正確的語(yǔ)句是(C)。A.inta[5][];B.inta[][5];C.inta[][3]={{1,3,5},{2}};D.inta[](10);4.在文件包含命令中,被包含文件的擴(kuò)展名(C)。A.必須是.hB.不能是.hC.可以是.h或.cppD.必須是.cpp5.要使語(yǔ)句“p=newint[10][20];”正確,p應(yīng)事先定義為(D)。A.int*p;B.int**p;C.int*p[20];D.int(*p)[20];6.在關(guān)鍵字public后面定義的成員為該類的(B)成員。A.私有B.公用C.保護(hù)D.任何7.假定AA為一個(gè)類,a為該類私有的數(shù)據(jù)成員,若要在該類的一個(gè)成員函數(shù)中訪問(wèn)它,則書寫格式最好為(A)。A.aB.AA::aC.a()D.AA::a()8.隊(duì)列具有(A)的操作特性。A.先進(jìn)先出B.先進(jìn)后出C.進(jìn)出無(wú)序D.僅進(jìn)不出9.假定AB為一個(gè)類,則執(zhí)行”ABa,b(3),*p;”語(yǔ)句時(shí)共調(diào)用該類構(gòu)造函數(shù)的次數(shù)為(D)次。A.5B.4C.3D.210.在重載一個(gè)運(yùn)算符時(shí),其參數(shù)表中沒(méi)有任何參數(shù),這表明該運(yùn)算符是(B)。A.作為友元函數(shù)重載的1元運(yùn)算符B.作為成員函數(shù)重載的1元運(yùn)算符C.作為友元函數(shù)重載的2元運(yùn)算符D.作為成員函數(shù)重載的2元運(yùn)算符1.當(dāng)執(zhí)行cout語(yǔ)句輸出endl數(shù)據(jù)項(xiàng)時(shí),將使C++顯示輸出屏幕上的光標(biāo)從當(dāng)前位置移動(dòng)到____下一行____的開(kāi)始位置。2.假定x和y為整型,其值分別為16和5,則x/y和double(x)/y的值分別為_(kāi)____3_____和______3.2____。3.strlen(”apple”)的值為_(kāi)___5____。4.C++程序運(yùn)行時(shí)的內(nèi)存空間可以分成全局?jǐn)?shù)據(jù)區(qū),堆區(qū),棧區(qū)和_____代碼_____區(qū)。5.假定a是一個(gè)一維指針數(shù)組,則a+i所指對(duì)象的地址比a大___4*i_____字節(jié)。6.如果一個(gè)派生類只有一個(gè)唯一的基類,則這樣的繼承關(guān)系稱為_(kāi)____單繼承_____。7.假定AA是一個(gè)類,“AA*abc()const;”是該類中一個(gè)成員函數(shù)的原型,在該函數(shù)體中_____不允許_____向*this或其成員賦值。8.假定用戶沒(méi)有給一個(gè)名為AB的類定義構(gòu)造函數(shù),則系統(tǒng)為其定義的構(gòu)造函數(shù)為_(kāi)___AB(){}______。9.假定用戶為類AB定義了一個(gè)構(gòu)造函數(shù)"AB(intaa){a=aa;}",該構(gòu)造函數(shù)實(shí)現(xiàn)對(duì)數(shù)據(jù)成員_____a____的初始化。10.作為類的成員函數(shù)重載一個(gè)運(yùn)算符時(shí),參數(shù)表中只有一個(gè)參數(shù),說(shuō)明該運(yùn)算符有____2____個(gè)操作數(shù)。三、程序填充題,對(duì)程序、函數(shù)或類中劃有橫線的位置,根據(jù)題意按標(biāo)號(hào)把合適的內(nèi)容填寫到程序下面相應(yīng)標(biāo)號(hào)的后面(每小題5分,共20分)1.打印出2至99之間的所有素?cái)?shù)(即不能被任何數(shù)整除的數(shù))。#include<iostream.h>#include<math.h>voidmain(){inti,n;for(n=2;___(1)___;n++){inttemp=int(sqrt(n));//求出n的平方根并取整for(i=2;___(2)___;i++)if(n%i==0)___(3)___;if(i>temp)cout<<n<<'';}cout<<'\n';}(1)n<=99(2)i<=temp(3)break2.下面是對(duì)按從小到大排列的有序數(shù)組a[n]中進(jìn)行二分查找x的算法,若查找成功返回該元素下標(biāo),否則返回-1。intBinarySearch(inta[],intn,intx){intlow=0,high=n-1;//定義并初始化區(qū)間下界和上界變量intmid;//定義保存中點(diǎn)元素下標(biāo)的變量while(low<=high){mid=___(1)___;if(x==a[mid])___(2)___;elseif(x<a[mid])high=mid-1;else___(3)___;}return-1;}(1)(low+high)/2(2)returnmid(3)low=mid+13.請(qǐng)補(bǔ)充完整如下的類定義:classA{char*a;public:___(1)___//定義無(wú)參構(gòu)造函數(shù),使a的值為空A(char*aa){a=___(2)___;//進(jìn)行動(dòng)態(tài)存儲(chǔ)分配strcpy(a,aa);//用aa所指字符串初始化a所指向的動(dòng)態(tài)存儲(chǔ)空間}___(3)___//定義析構(gòu)函數(shù),刪除a所指向的動(dòng)態(tài)存儲(chǔ)空間};(1)A(){a=0;}或A():a(0){}(2)newchar[strlen(aa)+1](3)~A(){delete[]a;}4.一種類定義如下:classGoods{private:chargd_name[20];//商品名稱intweight;//商品重量staticinttotalweight;//同類商品總重量public:Goods(char*str,intw){//構(gòu)造函數(shù)strcpy(gd_name,str);weight=w;totalweight+=weight;}~Goods(){totalweight-=weight;}char*GetN(){___(1)___;}//返回商品名稱intGetW(){returnweight;}___(2)___GetTotal_Weight(){//定義靜態(tài)成員函數(shù)返回總重量___(3)___;}}(1)returngd_name(2)staticint(3)returntotalweight四、理解問(wèn)答題,寫出前三小題的程序運(yùn)行結(jié)果和指出后兩小題的程序(或函數(shù))所能實(shí)現(xiàn)的功能。(每小題6分,共30分)1.#include<iostream.h>constintT=8;voidmain(){inti,s=0;for(i=1;i<=T;i+=2){s+=i*i;cout<<s<<’’;}cout<<endl;}運(yùn)行結(jié)果: 11035842.#include<iostream.h>classCE{private:inta,b;intgetmax(){return(a>b?a:b);}public:intc;voidSetValue(intx1,intx2,intx3){a=x1;b=x2;c=x3;}intGetMax();};intCE::GetMax(){intd=getmax();return(d>c?d:c);}voidmain(){intx=5,y=12,z=8;CEex;ex.SetValue(x,y,z);cout<<ex.GetMax()<<endl;}運(yùn)行結(jié)果: 123.#include<iostream.h>classA{inta,b;public:A(intaa,intbb){a=aa;b=bb;}floatMultip(charop){switch(op){case'+':returna+b;case'-':returna-b;case'*':returna*b;default:cout<<'\n'<<op<<"非法運(yùn)算符!"<<endl;exit(1);//退出程序運(yùn)行}}};voidmain(){Ax(10,4);chara[6]="+-*";inti=0;while(a[i]){cout<<x.Multip(a[i])<<'';i++;}cout<<endl;}運(yùn)行結(jié)果: 146404.#include<iostream.h>#include<stdlib.h>#include<time.h>constintN=10;intff(intx,inty){intz;cout<<x<<'+'<<y<<'=';cin>>z;if(x+y==z)return1;elsereturn0;}voidmain(){inta,b,c=0;srand(time(0));//初始化隨機(jī)數(shù)序列for(inti=0;i<N;i++){a=rand()%20+1;//rand()函數(shù)產(chǎn)生0-32767之間的一個(gè)隨機(jī)數(shù)b=rand()%20+1;c+=ff(a,b);}cout<<"得分:"<<c*10<<endl;}程序功能: 讓計(jì)算機(jī)隨機(jī)產(chǎn)生出10道20以內(nèi)整數(shù)的加法題供用戶計(jì)算,每道題10分,計(jì)算完成后打印出得分。5.char*f(char*s){intn=strlen(s);char*r=newchar[n+1];for(inti=0;i<n;i++)if(s[i]>='a'&&s[i]<='z')r[i]=s[i]-'a'+'A';elser[i]=s[i];r[n]=’\0’;returnr;}程序功能: 根據(jù)參數(shù)s所指向的字符串,生成一個(gè)由r所指向的新字符串并返回,該字符串使s字符串中的小寫字母均變?yōu)榇髮?。五、編程題(每小題5分,共10分)1.按照下面函數(shù)原型語(yǔ)句編寫一個(gè)遞歸函數(shù)求出并返回?cái)?shù)組a中n個(gè)元素的平方和。intf(inta[],intn);解: intf(inta[],intn) {if(n==0)return0; elsereturna[n-1]*a[n-1]+f(a,n-1);}2.根據(jù)下面類中Sum函數(shù)成員的原型和注釋寫出它的類外定義。classAA{int*a;intn;intMS;public:voidInitAA(intaa[],intnn,intms){if(nn>ms){cout<<"Error!"<<endl;exit(1);}MS=ms;n=nn;a=newint[MS];for(inti=0;i<n;i++)a[i]=aa[i];}intSum();//求出并返回?cái)?shù)組a中前n個(gè)元素之和};解: intAA::Sum() {ints=0;for(inti=1;i<n;i++)s+=a[i];returns;}

請(qǐng)您刪除一下內(nèi)容,O(∩_∩)O謝謝!??!2015年中央電大期末復(fù)習(xí)考試小抄大全,電大期末考試必備小抄,電大考試必過(guò)小抄AfterearninghisspursinthekitchensofTheWestin,TheSheraton,SensontheBund,andasprinklingofothertop-notchvenues,SimpsonLufinallygotthechancetobecomehisownbossinNovember2010.Sortof.TheShanghai-bornchefmightnotactuallyownCaliforniaPizzaKitchen(CPK)butheisinsolechargeofbothkitchenandfrontof-houseatthisSinanMansions'stalwart.

"It’scertainlyaresponsibilitytobetheheadchef,andthentohavetomanagetherestoftherestaurantaswell,"the31-year-oldtellsEnjoyShanghai."Inhotels,forexample,thesejobsarestrictlydemarcated,soit’sagreatopportunitytolearnhowabusinessoperatesacrosstheboard."

ItwasataskthatmanagementbackinsunnyCaliforniaevidentlyfelthewasreadyfor,andavoteofconfidencefromacompanythat,todate,hasopened250outletsin11countries.Andforaddedpressure,theShanghaibranchwasalsoCPK’sChinadebut.

"Forsureitwasabigstep,andunlikealltheirotherAsiaoperationsthatarefranchises,theydecidedtomanageitdirectlytobeginwith,"saysSimpson.

Twoyearsagoaprivatefranchiseetookoverthelease,butthelinkstoCPKheadquartersarestillstrong,withamainland-based'brandambassador’onhandtoensurethebusinessadherestoitsethosofcreating"innovative,hearth-bakedpizzas",asliceofPRblurbthatSimpsoninsistslivesuptothehype.

"Theyareveryinnovative,"hesays."Theproblemwithmostfastfoodplacesisthattheyusethesamesauceoneverypizzaandjustchangethetoppings.Everyoneofour16pizzasaucesisauniquerecipethathasbeenformulatedtocomplementthetoppingsperfectly."

ThelargelylocalcustomerbaseevidentlyagreesandonSaturdayandSunday,atleast,theplaceisteeming.Thekids-eat-for-freepolicyatweekendsisundoubtedlyabigdraw,aswellasisthespacioussecond-floorlayoutoverlookedbyacanopyofgreenfromFuxingParkovertheroad.

ThecompanyisalsofocusingonincreasingbrandrecognitionandinrecentyearshastakenpartinoutsideeventssuchastheregularCaliforniaWeek.Still,thestaarehonestenoughtoadmitthatbusinesscouldbebetter;asgood,infact,asinCPK’ssecondoutletinthepopularKerryParksideshoppingmallinPudong.

"SinanMansionshasreallystruggledtogetthenumberofvisitorsthatwereenvisagedwhenitfirstopened,andithasn’tbeeneasyforanyofthetenantshere,"addsSimpson."We’replanningathirdoutletinthecityin2015,andwewillprobablychooseashoppingmallagainbecauseofthebetterfoottraffic."ThetearoomsoncefrequentedbyCocoChanelandMarcelProustareuppingsticksandcomingtoShanghai,XuJunqianvisitstheParisianoutpostwithsweettreats.Onethingthecentury-oldParisiantearoomAngelinahasshownisthatlegendaryfashiondesignerCocoChanelnotonlyhadstyleandglamorbutalsoboastedgreattasteinfood,pastriesinparticular.OneofthemostpopulartearoomsinParis,AngelinaisfamousforhavingoncebeenfrequentedbycelebritiessuchasChanelandwriterMarcelProust.NowAngelinahaspackedupitsFrenchambience,efficientservice,andbeautiful,comfortingdessertsandflownthemtoShanghai.Attheflagshipdine-inandtake-outspaceinShanghai,everythingmimicstheoriginaltearoomdesignedfromthebeginningofthe20thcentury,inParis,theheightof"BelleEpoque".Thepaintingsonthewall,forexample,areexactlythesameastheonethatdepictsthelandscapeofsouthernFrance,thehometownoftheowner;andthesmalltablesareintentionalimitationsoftheonesthatCocoChaneloncesatateveryafternoonforhotchocolate.Thefamoushotchocolate,knownasL’Africain,isaluxuriousmixtureoffourtypesofcocoabeansimportedfromAfrica,blendedinParisandthenshippedtoShanghai.It’ssinfullysweet,richandthickasifputtingabarofmeltingchocolatedirectlyonthetongueandthefreshwhippedcreamonthesidemakesalight,butequallygratifyingcontrast.Itisalsosoldinglassbottlesastakeaway.ThesignatureMont-Blancchestnutcakeconsistsofthreeparts:thepureedchestnutontop,thevanillacreamlikestuffing,andthemeringueasbase.Getallthreelayersinonescoop,notonlyforthedifferenttexturesbutalsovariousflavorsofsweetness.Thedesserthasmaintaineditspopularityforacentury,eveninacountrylikeFrance,perhapstheworld’smostcompetitiveplacefordesserts.Amuchoverlookedpairing,istheParis-NewYorkchouxpastryandN226chocolateflavoredtea.Thechouxpastryisamouthfulofairypecan-flavoredwhippedcream,whilethetea,ablendofblackteasfromChinaandCeylon,cocoaandrosepetals,offersamoresubtlefragranceofflowersandchocolate.Orderingthesetwoitems,featuringamutedsweetness,makesiteasierforyoutofitintoyourlittleblackdress.Breakfast,brunch,lunchandlightsupperarealsoservedatthetearoom,"ahubofmanycultures"andtakesin"amixofdifferentstylesofFrenchcuisines",accordingtothemanagementteam.Thesemi-cookedfoiegrasterrine,isseductiveanddeceptive.It’sgenerouslyservedatthesizeandshapeofatoast,whiletheactualbriochetoastisbakedintoacurvedslicedippedwithfigchutney.Theflavor,however,ishonest:strong,smoothandsublime.Andyoudon’tactuallyneedthetoastforcrunchiness.Thisistheseasonforhighteas,withdaintycupsoffinechinaandlittlepastriesthatappealtobothvisualandphysicalappetites.Butthereisonehighteawithadifference,andPaulineD.Lohfindsoutjustexactlywhyitisspecial.EarlGreyteaandmacaronsareallverywellforthecrucialrecuperativebreakin-betweenintensiveboutsofholidayseasonshopping.Andforthosewhoprefersavorytosweet,thereisstilltheselectionofclassicChinesesnackscalleddimsumtosatisfyandsatiate.Highteaisamealtoeatwitheyeandmouth,anin-betweenindulgencethatshouldbelightenoughnottospoildinner,butsufficientlyrobusttotaketheedgeoffthehungerthatstrikeshoursafterlunch.TheafternoonteaspecialatShang-XiattheFourSeasonsHotelPudonghasjusttherightelements.Itisapamperingmeal,withtouchesofluxurythatmakethehighteasessionatreatinitself.Wholebabyabalonesarebraisedandthentoppedonashortcrustpastryshell,asortofChineseversionoftheWesternvol-au-vent,butclassier.Evenclassieristhedimsumstapleshrimpdumplingorhargow,upgradedwiththeadditionofsliversofmidnightdarktruffles.Thisisamastertouch,andchefSimonChoi,whopresidesunchallengedatShang-Xi,hasscoredawinneragain.Sweetprawnsandaromatictruffles—what’snottolove?Hismasterfulcraftsmanshipisexhibitedinyetanotherpastry—asweetpastrythatisshapedtolooklikeawalnut,butwhichyoucanputstraightintothemouth.Itcrumblesimmediately,andtheslightlysweet,nuttymorselissoeasytoeatyou’llprobablyreachstraightforanother.Myfavoriteist

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論