欢迎来到天天文库
浏览记录
ID:55632193
大小:346.50 KB
页数:105页
时间:2020-05-21
《SCJP认证考试题集.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、310-055SCJIP认证考试题集Question1Given:11.publicinterfaceStatus{12./*insertcodehere*/intMY_VALUE=10;13.}Whichthreearevalidonline12?(Choosethree.)A.finalB.staticC.nativeD.publicE.privateF.abstractG.protectedAnswer:ABDQuestion2Given:10.publicclassBar{11.staticvoidfoo(int...x){12.//insertcodehere13.}14.}Wh
2、ichtwocodefragments,insertedindependentlyatline12,willallowtheclasstocompile?(Choosetwo.)A.foreach(x)System.out.println(z);B.for(intz:x)System.out.println(z);abcdC.while(x.hasNext())System.out.println(x.next());D.for(inti=0;i3、lassTest{12.publicstaticvoidmain(String[]args){13.intx=5;14.booleanb1=true;15.booleanb2=false;16.17.if((x==4)&&!b2)18.System.out.print(”l“);19.System.out.print(”2“);20.if((b2=true)&&b1)21.System.out.print(”3“);22.}23.}Whatistheresult?A.2B.3C.12D.23E.123F.Compilationfails.G.Auexceptionalisthrownatr4、untime.Answer:DQuestion44.Given:31.//somecodehere32.try{33.//somecodehere34.}catch(SomeExceptionse){35.//somecodehere36.}finally{37.//somecodehere38.}Underwhichthreecircumstanceswillthecodeonline37beexecuted?(Choosethree.)A.Theinstancegetsgarbagecollected.B.Thecodeonline33throwsanexception.C.Theco5、deonline35throwsanexception.D.Thecodeonline31throwsanexception.E.Thecodeonline33executessuccessfully.Answer:BCElQuestion5Given:10.interfaceFoo{}11.classAlphaimplementsFoo{}12.classBetaextendsAlpha{}13.classDeltaextendsBeta{14.publicstaticvoidmain(String[]args){15.Betax=newBeta();16.//insertcodeher6、e17.}18.}Whichcode,insertedatline16,willcauseajava.lang.ClassCastException?A.Alphaa=x;B.Foof=(Delta)x;C.Foof=(Alpha)x;D.Betab=(Beta)(Alpha)x;Answer:BQuestion6Given:?disavalid,non-nullDateobject?dfisavalid,non-nullDateFormatobjectsettothecurrentlocaleWhatoutputsthecurrentlocalescountrynameandtheapp7、ropriateversionofd’sdate?A.Localeloc=Locale.getLocale();System.out.println(loc.getDisplayCountry()+““+df.format(d));B.Localeloc=Locale.getDefault();System.out.println(loc.getDisplayCountry()+““+df.format(d));C.Lo
3、lassTest{12.publicstaticvoidmain(String[]args){13.intx=5;14.booleanb1=true;15.booleanb2=false;16.17.if((x==4)&&!b2)18.System.out.print(”l“);19.System.out.print(”2“);20.if((b2=true)&&b1)21.System.out.print(”3“);22.}23.}Whatistheresult?A.2B.3C.12D.23E.123F.Compilationfails.G.Auexceptionalisthrownatr
4、untime.Answer:DQuestion44.Given:31.//somecodehere32.try{33.//somecodehere34.}catch(SomeExceptionse){35.//somecodehere36.}finally{37.//somecodehere38.}Underwhichthreecircumstanceswillthecodeonline37beexecuted?(Choosethree.)A.Theinstancegetsgarbagecollected.B.Thecodeonline33throwsanexception.C.Theco
5、deonline35throwsanexception.D.Thecodeonline31throwsanexception.E.Thecodeonline33executessuccessfully.Answer:BCElQuestion5Given:10.interfaceFoo{}11.classAlphaimplementsFoo{}12.classBetaextendsAlpha{}13.classDeltaextendsBeta{14.publicstaticvoidmain(String[]args){15.Betax=newBeta();16.//insertcodeher
6、e17.}18.}Whichcode,insertedatline16,willcauseajava.lang.ClassCastException?A.Alphaa=x;B.Foof=(Delta)x;C.Foof=(Alpha)x;D.Betab=(Beta)(Alpha)x;Answer:BQuestion6Given:?disavalid,non-nullDateobject?dfisavalid,non-nullDateFormatobjectsettothecurrentlocaleWhatoutputsthecurrentlocalescountrynameandtheapp
7、ropriateversionofd’sdate?A.Localeloc=Locale.getLocale();System.out.println(loc.getDisplayCountry()+““+df.format(d));B.Localeloc=Locale.getDefault();System.out.println(loc.getDisplayCountry()+““+df.format(d));C.Lo
此文档下载收益归作者所有