您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 咨询培训 > 北京达内科技有限公司 Java培训讲师
选择题1:在软件生命周期中,下列哪个说法是不准确的?A.软件生命周期分为计划、开发和运行三个阶段B.在计划阶段要进行问题焉醛和需求分析C.在开发后期要进行编写代码和软件测试D.在运行阶段主要是进行软件维护2:Whichisthemostappropriatecodesnippetthatcanbeinsertedatline18inthefollowingcode?(Assumethatthecodeiscompiledandrunwithassertionsenabled)1.importjava.util.*;2.3.publicclassAssertTest4.{5.privateHashMapcctld;6.7.publicAssertTest()8.{9.cctld=newHashMap();10.cctld.put(in,India);11.cctld.put(uk,UnitedKingdom);12.cctld.put(au,Australia);13.//morecode...14.}15.//othermethods....16.publicStringgetCountry(StringcountryCode)17.{18.//Whatshouldbeinsertedhere?19.Stringcountry=(String)cctld.get(countryCode);20.returncountry;21.}22.}Whichisthemostappropriatecodesnippetthatcanbeinsertedatline18inthefollowingcode?(Assumethatthecodeiscompiledandrunwithassertionsenabled)1.importjava.util.*;2.3.publicclassAssertTest4.{5.privateHashMapcctld;6.7.publicAssertTest()8.{9.cctld=newHashMap();10.cctld.put(in,India);11.cctld.put(uk,UnitedKingdom);12.cctld.put(au,Australia);13.//morecode...14.}15.//othermethods....16.publicStringgetCountry(StringcountryCode)17.{18.//Whatshouldbeinsertedhere?19.Stringcountry=(String)cctld.get(countryCode);20.returncountry;21.}22.}A.assertcountryCode!=null;B.assertcountryCode!=null:Countrycodecannotbenull;C.assertcctld!=null:Nocountrycodedataisavailable;D.assertcctld:Nocountrycodedataisavailable;3:Givethefollowingcode:publicclassExample{publicstaticvoidmain(Stringargs[]){intl=0;do{System.out.println(“Doingitforlis:”+l);}while(--l0)System.out.println(“Finish”);}}Whichwellbeoutput:Givethefollowingcode:publicclassExample{publicstaticvoidmain(Stringargs[]){intl=0;do{System.out.println(“Doingitforlis:”+l);}while(--l0)System.out.println(“Finish”);}}Whichwellbeoutput:A.Doingitforlis3B.Doingitforlis1C.Doingitforlis2D.Doingitforlis04:Givethisclassoutline:classExample{privateintx;//restofclassbody…}AssumingthatxinvokedbythecodejavaExample,whichstatementcanmadexbedirectlyaccessibleinmain()methodofExample.java?Givethisclassoutline:classExample{privateintx;//restofclassbody…}AssumingthatxinvokedbythecodejavaExample,whichstatementcanmadexbedirectlyaccessibleinmain()methodofExample.java?A.ChangeprivateintxtopublicintxB.changeprivateintxtostaticintxC.ChangeprivateintxtoprotectedintxD.changeprivateintxtofinalintx5:Whichofthefollowingstatementsarenotlegal?A.longl=4990;B.inti=4L;C.doubled=34.4;D.doublet=0.9F.6:鉴于Java的特点,它最适合的计算环境是A.并行计算环境B.分布式计算环境C.高强度计算环境D.开放式计算环境7:Whatiswrittentothestandardoutputgiventhefollowingstatement:System.out.println(4|7);Selecttherightanswer:A.4B.5C.6D.78:1.publicclassX{2.publicobjectm(){3.objecto=newfloat(3.14F);4.object[]oa=newobject[1];5.oa[0]=o;6.o=null;7.oa[0]=null;8.returno;9.}10.}Whenisthefloatobjectcreatedinline3,eligibleforgarbagecollection?1.publicclassX{2.publicobjectm(){3.objecto=newfloat(3.14F);4.object[]oa=newobject[1];5.oa[0]=o;6.o=null;7.oa[0]=null;8.returno;9.}10.}Whenisthefloatobjectcreatedinline3,eligibleforgarbagecollection?A.Justafterline5B.Justafterline6C.Justafterline7D.Justafterline8(thatis,asthemethodreturns)9:Considertheclasshierarchyshownbelow:--------------------------------------------------------------------classFourWheelerimplementsDrivingUtilitiesclassCarextendsFourWheelerclassTruckextendsFourWheelerclassBusextendsFourWheelerclassCraneextendsFourWheeler----------------------------------------------------------------------Considerthefollowingcodebelow:1.DrivingUtilitiesdu;2.FourWheelerfw;3.TruckmyTruck=newTruck();4.du=(DrivingUtilities)myTruck;5.fw=newCrane();6.fw=du;Whichofthestatementsbelowaretrue?Choices:A.Line4willnotcompilebecauseaninterfacecannotrefertoanobject.B.Thecodewillcompileandrun.C.Thecodewillnotcompilewithoutanexplicitcastatline6,becausegoingdownthehierarchywithoutcastingisnotallowed.D.Thecodewillcompileifweputanexplicitcastatline6butwillthrowanexceptionatruntime.10:Givethefollowingmethod:publicvoidmethod(){Stringa,b;a=newString(“helloworld”);b=newString(“gameover”);System.out.println(a+b+”ok”);a=null;a=b;System.out.println(a);}Intheabsenceofcompileroptimization,whichistheearliestpointtheobjectareferedisdefinitelyelibiletobegarbagecollection.Givethefollowingmethod:publicvoidmethod(){Stringa,b;a=newString(“helloworld”);b=newString(“gameover”);System.out.println(a+b+”ok”);a=null;a=b;System.out.println(a);}Intheabsenceofcompileroptimization,whichistheearliestpointtheobjectareferedisdefinitelyelibiletobegarbagecollection.A.beforeline5B.beforeline6C.beforeline7D.beforeline911:Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?publicclassStatic{static{intx=5;}staticintx,y;publicstaticvoidmain(Stringargs[]){x--;myMethod();System.out.println(x+y+++x);}publicstaticvoidmyMethod(){y=x+++++x;}}Choices:Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?publicclassStatic{static{intx=5;}staticintx,y;publicstaticvoidmain(Stringargs[]){x--;myMethod();System.out.println(x+y+++x);}publicstaticvoidmyMethod(){y=x+++++x;}}Choices:A.prints:2B.prints:3C.prints:7D.prints:812:Whatwillbetheresultofexecutingthefollowingcode?publicstaticvoidmain(Stringargs[]
本文标题:北京达内科技有限公司 Java培训讲师
链接地址:https://www.777doc.com/doc-968703 .html