您好,欢迎访问三七文档
11.1Fillintheblanksineachofthefollowing:a.Thecompanythatpopularizedpersonalcomputingwas_Apple.__b.Thecomputerthatmadepersonalcomputinglegitimateinbusinessandindustrywasthe__IBMPersonalComputerc.Computersprocessdataunderthecontrolofsetsofinstructionscalledcomputer__programs_______.d.Thesixkeylogicalunitsofthecomputerarethe_inputunit_,__outputunit,__memoryunit__,_arithmeticandlogicunit__,_centralprocessingunit__andthe__secondarystorageunit___e.Thethreeclassesoflanguagesdiscussedinthechapterare_machinelanguages_,_assemblylanguages_,and__high-levellanguages__.f.Theprogramsthattranslatehigh-levellanguageprogramsintomachinelanguagearecalled___compilers___.g.Ciswidelyknownasthedevelopmentlanguageofthe_UNIX_operatingsystem.h.The_Pascal__languagewasdevelopedbyWirthforteachingstructuredprogramming.i.TheDepartmentofDefensedevelopedtheAdalanguagewithacapabilitycalled__multitasking.__,whichallowsprogrammerstospecifythatmanyactivitiescanproceedinparallel.1.2FillintheblanksineachofthefollowingsentencesabouttheC++environment.a.C++programsarenormallytypedintoacomputerusinga(n)_editor.__program.b.InaC++system,a(n)__preprocessor__programexecutesbeforethecompiler'stranslationphasebegins.c.The_linker_programcombinestheoutputofthecompilerwithvariouslibraryfunctionstoproduceanexecutableimage.d.The__loader.__programtransferstheexecutableimageofaC++programfromdisktomemory.1.3Fillintheblanksineachofthefollowingstatementsa.Objectshavethepropertyof__informationhiding_althoughobjectsmayknowhowtocommunicatewithoneanotheracrosswell-definedinterfaces,theynormallyarenotallowedtoknowhowotherobjectsareimplemented.b.C++programmersconcentrateoncreating_classes_,whichcontaindatamembersandthememberfunctionsthatmanipulatethosedatamembersandprovideservicestoclients.c.Classescanhaverelationshipswithotherclasses.Theserelationshipsarecalled__associations___.d.Theprocessofanalyzinganddesigningasystemfromanobject-orientedpointofviewiscalled__object-orientedanalysisanddesign(OOAD).___.e.OODalsotakesadvantageof_inheritance__relationships,wherenewclassesofobjectsarederivedbyabsorbingcharacteristicsofexistingclasses,thenadding2uniquecharacteristicsoftheirown.f.__TheUnifiedModelingLanguage(UML)__isagraphicallanguagethatallowspeoplewhodesignsoftwaresystemstouseanindustry-standardnotationtorepresentthem.g.Thesize,shape,colorandweightofanobjectareconsidered_attributes__oftheobject.1.7Whyissomuchattentiontodayfocusedonobject-orientedprogrammingingeneralandC++inparticular?ANS1:Object-orientedprogrammingenablestheprogrammertobuildreusablesoftwarecomponentsthatmodelitemsintherealworld.Buildingsoftwarequickly,correctly,andeconomicallyhasbeenanelusivegoalinthesoftwareindustry.Themodular,object-orienteddesignandimplementationapproachhasbeenfoundtoincreaseproductivitywhilereducingdevelopmenttime,errors,andcost.ANS2:Inobject-orientedprogramming,thesourcecodeisorganizedinclassesandobjects,whichiseasytobemappingintotheitemsinphysicalworld.Itiseasytodesign,reuseandmaintainsuchkindofsoftwareinlargescalesoftwaredevelopment,whichisfavoredbythesoftwareindustry.【参考教材的答案】面向对象的编程让编程者可以建立可重用的软件组件,这些组件是现实世界事物的抽象模型。软件工业的目标是快速、正确、有效率的开发软件。面向对象的设计和实现方法模型已经被事实证明是可以提高生产效率和减少开发时间、错误和代价。【参考讲义的答案】面向对象的编程方法中,以类和对象来组织源代码,可以方便的实现与现实物理世界事物的映射。采用这种方法,易于在大型软件开发中进行软件的设计、重用和维护,因此受到软件行业的支持和采用。1.10Youareprobablywearingonyourwristoneoftheworld'smostcommontypesofobjectsawatch.Discusshoweachofthefollowingtermsandconceptsappliestothenotionofawatch:object,attributes,behaviors,class,inheritance(consider,forexample,analarmclock),abstraction,modeling,messages,encapsulation,interface,informationhiding,datamembersandmemberfunctions.1.10可能现在你的手腕上就戴着世界上最普遍的对象类型之一——手表。论述以下这些术语和概念如何应用于手表这个概念上:对象、属性、行为、类、继承(例如,考虑闹钟)、封装、接口、信息隐藏、数据成员和成员函数。ANS:Theentirewatchisanobjectthatiscomposedofmanyotherobjects(suchasthemovingparts,theband,theface,etc.)Watchattributesaretime,color,band,style(digitaloranalog),etc.Thebehaviorsofthewatchincludesettingthetimeandgettingthetime,Awatchcanbeconsideredaspecifictypeofclock(ascananalarmclock),Withthatinmind,itispossiblethataclasscalledClockcouldexistfromwhichotherclassessuchaswatchandalarmclockcaninheritthebasicfeaturesintheclock.Thewatchisanabstractionofthemechanicsneededtokeeptrackofthetime.Theuserofthewatchdoesnotneedtoknowthemechanicsofthewatchinordertouseit;theuseronlyneedstoknowthatthewatchkeepsthepropertime.Inthissense,themechanicsofthewatchareencapsulated(hidden)insidethewatch.Theinterfacetothewatch(itsfaceandcontrolsforsettingthetime)allowstheusertosetandgetthetime.Theuserisnotallowedtodirectlytouchtheinternalmechanicsofthewatch.Allinteractionwiththeinternalmechanicsiscontrolledbytheinterfacetothewatch.The3datamembersstoredinthewatcharehiddeninsidethewatchandthememberfunctions(lookingatthefacetogetthetimeandsettingthetime)providetheinterfacetothedata.2.1Fillintheblanksineachofthefollowing.a.EveryC++programbeginsexecutionatthefunction_main_.b.The__leftbrace({)_beginsthebodyofeveryfunctionandthe__rightbrace(})_endsthebodyofeveryfunction.c.EveryC++statementendswitha(n)__semicolon___
本文标题:C++复习资料1
链接地址:https://www.777doc.com/doc-4013395 .html