各公司c++面试题

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

发信人:Leonix(Leon),信区:job标题:中兴面试过程发信站:饮水思源(2002年11月20日21:10:39星期三),站内信件面试我的一个男的和一个ppjj。ppjj不时微笑一下,另一位老沉着脸。我是学网络的,本来我想先介绍一下做的项目,后来都没有机会,只把其中两个附带介绍了一下。ppjj好像不太懂技术,只问我最后一个项目中担任具体工作,我刚好想说,因为这个项目我做总体设计和项目管理。另一个问我IPv6对V4的改进之处,IPv6的过渡技术,我们的改进方案的原理(这是我的研究方向),UDP的应用场合,ping的实现原理(让我ft)还让我写二分法的算法(太简单了,很ft,问了他几次证实,他有点不悦)我就很快写了一下,可能有些小错。最核然后问我想在哪儿工作,ppjj代我回答了,对他说上海深圳都可以的。他们就是问你项目然后逮住你自己说精通的或者他懂的东西深入问一下。--复旦大学网络乒协※来源:·饮水思源bbs.sjtu.edu.cn·[FROM:socks.fudan.edu.cn]E:\面试题\中兴面试过程.txt.mazC++object-orientedquestionsZZshury·¢±íÓÚ2004-12-517:40:00Q.Whatispurevirtualfunction?Aclassismadeabstractbydeclaringoneormoreofitsvirtualfunctionstobepure.Apurevirtualfunctionisonewithaninitializerof=0initsdeclarationQ.WriteaStructTimewhereintegerm,h,sareitsmembersstructTime{intm;inth;ints;};howdoyoutraverseaBtreeinBackwardin-order?ProcessthenodeintherightsubtreeProcesstherootProcessthenodeintheleftsubtreeQ.WhatisthetwomainrolesofOperatingSystem?AsaresourcemanagerAsavirtualmachineQ.Inthederivedclass,whichdatamemberofthebaseclassarevisible?Inthepublicandprotectedsections.Whatisamodifier?Amodifier,alsocalledamodifyingfunctionisamemberfunctionthatchangesthevalueofatleastonedatamember.Inotherwords,anoperationthatmodifiesthestateofanobject.Modifiersarealsoknownas¡®mutators¡¯.Example:Thefunctionmodisamodifierinthefollowingcodesnippet:classtest{intx,y;public:test(){x=0;y=0;}voidmod(){x=10;y=15;}};Whatisanaccessor?Anaccessorisaclassoperationthatdoesnotmodifythestateofanobject.TheaccessorfunctionsneedtobedeclaredasconstoperationsDifferentiatebetweenatemplateclassandclasstemplate.Templateclass:Agenericdefinitionoraparameterizedclassnotinstantiateduntiltheclientprovidestheneededinformation.It¡¯sjargonforplaintemplates.Classtemplate:Aclasstemplatespecifieshowindividualclassescanbeconstructedmuchlikethewayaclassspecifieshowindividualobjectscanbeconstructed.It¡¯sjargonforplainclasses.Whendoesanameclashoccur?Anameclashoccurswhenanameisdefinedinmorethanoneplace.Forexample.,twodifferentclasslibrariescouldgivetwodifferentclassesthesamename.Ifyoutrytousemanyclasslibrariesatthesametime,thereisafairchancethatyouwillbeunabletocompileorlinktheprogrambecauseofnameclashes.Definenamespace.ItisafeatureinC++tominimizenamecollisionsintheglobalnamespace.Thisnamespacekeywordassignsadistinctnametoalibrarythatallowsotherlibrariestousethesameidentifiernameswithoutcreatinganynamecollisions.Furthermore,thecompilerusesthenamespacesignaturefordifferentiatingthedefinitions.Whatistheuseof¡®using¡¯declaration.Ausingdeclarationmakesitpossibletouseanamefromanamespacewithoutthescopeoperator.WhatisanIteratorclass?Aclassthatisusedtotraversethroughtheobjectsmaintainedbyacontainerclass.Therearefivecategoriesofiterators:inputiterators,outputiterators,forwarditerators,bidirectionaliterators,randomaccess.Aniteratorisanentitythatgivesaccesstothecontentsofacontainerobjectwithoutviolatingencapsulationconstraints.Accesstothecontentsisgrantedonaone-at-a-timebasisinorder.Theordercanbestorageorder(asinlistsandqueues)orsomearbitraryorder(asinarrayindices)oraccordingtosomeorderingrelation(asinanorderedbinarytree).Theiteratorisaconstruct,whichprovidesaninterfacethat,whencalled,yieldseitherthenextelementinthecontainer,orsomevaluedenotingthefactthattherearenomoreelementstoexamine.Iteratorshidethedetailsofaccesstoandupdateoftheelementsofacontainerclass.Thesimplestandsafestiteratorsarethosethatpermitread-onlyaccesstothecontentsofacontainerclass.ListoutsomeoftheOODBMSavailable.GEMSTONE/OPALofGemstonesystems,ONTOSofOntos,ObjectivityofObjectivityInc,VersantofVersantobjecttechnology,ObjectstoreofObjectDesign,ARDENTofARDENTsoftware,POETofPOETsoftware.Listoutsomeoftheobject-orientedmethodologies.ObjectOrientedDevelopment(OOD)(Booch1991,1994),ObjectOrientedAnalysisandDesign(OOA/D)(CoadandYourdon1991),ObjectModellingTechniques(OMT)(Rumbaugh1991),ObjectOrientedSoftwareEngineering(Objectory)(Jacobson1992),ObjectOrientedAnalysis(OOA)(ShlaerandMellor1992),TheFusionMethod(Coleman1991).Whatisanincompletetype?Incompletetypesreferstopointersinwhichthereisnonavailabilityoftheimplementationofthereferencedlocationoritpointstosomelocationwhosevalueisnotavailableformodification.int*i=0x400//ipointstoaddress400*i=0;//setthevalueofmemorylocationpointedbyi.Incompletetypesareotherwisecalleduninitializedpointers.Whatisadanglingpointer?Adanglingpointerariseswhenyouusetheaddressofanobjectafteritslifetimeisover.Thismayoccurinsituationslikereturningaddressesoftheautomaticvariablesfromafunctionorusingtheaddressofthememoryblockafteritisfreed.Thefollowingcodesnippetshowsthis:classSample{public:int*ptr;Sample(inti){ptr=newint(i);}~Sample(){deleteptr;}voidPrintVal(){cout¡°Thevalueis¡±*ptr;}};voidSomeFunc(Samplex){cout¡°SayiaminsomeFunc¡±endl;}intmain(){Samples1=10;SomeFunc(s1);s1.PrintVal();}IntheaboveexamplewhenPrintVal()functioniscalleditiscalledbythepointerthathasbeenfreedbythedestructorinSomeFunc.Differentiatebetweenthemessageandmethod.Message:Objectscommunicatebysendingmessagestoeachother.Amessageissenttoinvokeamethod.MethodProvid

1 / 83
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功