2012-2013(一)ssd3考试试卷B.docx
-
资源ID:824628
资源大小:71.88KB
全文页数:7页
- 资源格式: DOCX
下载积分:5金币
友情提示
2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
|
2012-2013(一)ssd3考试试卷B.docx
总分四五东北大学考试试卷(B卷)20122013学年第一学期课程名称:面向对象程序设计II.SingleChoice(20points,2pointeach)IConsiderthefollowingJavaprogramsegment.()intx=5;inty=2;System.out.println(x+"+y);(A) Theoutputcausedbythecodewillbe512.(B) Theoutputcausedbythecodewillbe512.(C) TheoutputcausedbythecodewillbeH.(D) Thecodewillcauseampilationerror.2UMLclassdiagramscandescribewhichofthefollowing?()I. TheinternalstructureofclassesII. Relationshipsbetweenclasses(八)11only(B)Ionly(C)IandIl(D)None3WhenasubclassdefinesaninstancemethodwiththeSalnereturn(yeandsignatureasaInelhodinitsparent,theparent'smethodissaidtobe:()(八)overridden(B)overloaded(C)private(D)hidden4Anobjectthatcontainsnwthodsthattraverseacollectionlinearlyfromstart(ofinishisknownasa(n)(八)loop(B)in(C)iterator(D)Exception5 WhichofthefollowingistrueaboutassociationandaggregationinUMLclassdiagrams?(A) Associationandaggregationhavenomeaningfulrelationship.(B) Associationisaspecialformofaggregation.(C) Associationistheoppositeofaggregation.(D) Aggregationisaspecialformofassociation.6 Inanobjectnxiel.thedatathatanobjectisresponsibleformaintainingarerepresentedby(八)generalizations(B)attributes(C)methods(D)SPCCialiZat沁ns7 Whenusingnoun-phraseanalysistomodelasoftwaresystem,whichofthefollowingshouldtypicallybeeliminatedfromthelistofpotentialclasses?()I. Referencesto(hesoftwaresystemitselfII. Nouns(hatimplyrolesbetweenobjectsIII. Synonymstoothernounsinthelist(八)Iand111only(B)111only(C)I,ILand111(D)11and111only8WhaiistherightwaytohandleabnormalitiesininputonJava?()(A) ByalwaysspecifyingthethrowsclauseineverymethodheaderwherefileI/Oisperformed(B) ByusingtheclassEiIeFiIterwhichgracefullyfiltersoutbadinputdata(C) Byhandlingtheseproblemsbyprovidingexceptionhandlers(D) Bywritingwhileloopstoguardagainstbadinput9Acomponentcanberesizedhorizontally,butnotvertically,whenitisplacesinwhichregionofaBorderLayout?()(八)NorthorSouth(B)EastorWest(C)Center(D)North.SouthorCenterIOWhichofthefollowingistrueregardingIhecontrollerpartintheModel-fiew-Cvninzller(MVC)paradigm?()(A) ,hecontrolleristheabstractdomainknowledgeofanapplication.(B) ThecontrolleristheautomaticmechanismbywhichIheuserinterfaceisdisplayedandbywhicheventsarecommunicatedbetweenthemodelandtheview.(C) Tecontrolleristhelistofabstractclassesinanapplication.(D) ThecontrolleristhewayinwhichtheabstractdomainknowledgeofanapplicationispresentedtotheuserII.Fillinblankandcopletethefollovingprograas.ClassFileSysteaonlyhasoneinstanceinantplication.(10points*2pointeach)publicclassFiIeSystemprivateHIeSystemSingIeFiIeSystem=null;RleSystem()(IpublicstaticFiIeSystemgetSingleFileSystem()if()(SingIeFiIeSystem=:Ireturn;)III. AccordingtoUMLclassdiagraa,seeFig1.IinplesentstheHunanResourceInformationsystem.Theiple>entationvillconsistofthreeclasses.(20points)Fig1HumanResourceInformationSystemClassDiagramNote:InclassEmployeetoString():overridesthemethodIoStringintheclassObject.ReturnsthestringrepresentationofanEmployeeobject.Thestringreturnedhasthefollowingformat: id,name,WeeklySalary ,hefieldsaresepa,atedbyacomma(,).Youcanassumethatthefieldsthemselvesdonotcontainanycommas.IV. Inthisexaa,youvillcreateanaddressbk)plicationvithaSvingGUI.Partoftheworkhasbeendoneforyou.Youvillimplementthecodethathandlesthebuttonevents.(20points)Fig2AddressBookGUI(1)Implenennetho<lactionPerfbmedin(heinnerclassOpenButtonListener:Beginbyremovingallentriesintheaddressbookifithasanyandclearingthestatusarea.Next,loadthedataintheSPCdfiedfileintothenow-emptyaddressbook.Everylinein(hefileshouldcontainexactlyoneaddressbkentrywiththefollowingformat:name_addressJelephonewhere: *nameisastringthatrepresentsthenameoftheentry.令addressisastringthatrepresentstheaddressoftheenty. telephonei$asiringthatrepresentsIhetelephoneoftheenry.Thefieldsaredelimitedbyanunderscore(_).Tosimplifyyourcode,youcanassumethatthefieldsthemselveswillnotcontainanyunderscores.UsetheclassStdngTCkeniZertoextracttheentryfields.Afterloadingthedataintotheaddressbk.displaythenamesofthepeopleintheJList.UsethemethodAddressBook.geNamestoobtainanarrayof(henames.Usethemeth<xiJLisLseiLisiDaiatopopulatethelistwithlhcarray.Finally,updatethelabel(hatdisplaysthenumberofpeopleintheaddressbookandclearsnamcTcxtFicld,UddrCSSTCXtHCkkandtoIephoncTcxtField.ThismethodshouldloadnoentriesanddisplayanerrormessageInthestatusareawhenItdetectsoneofthefollowingerrors: Thespecifiedfiledoesnotexist. Anerroroccurswhilereadingdatafromthespecifiedfile.(2)ImplementmethodactionPerfbnedoftheinnerclassDisplayButtonListener:DisplaythecontactintonnationIbrtheselectednan>eandthenoutputastatusmessagein(hes(a(usarea.Thismethodshoulddisplayanerrormessageinthestatusareawhenitdetectsoneof(hefollowingerrors:令Theaddressbookisempty.Theuserha$>tselectedaname.班级O*Thisinnerclasshandles<c<xic>dis