您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > scjp模拟试题(二)
------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话:023-65472521,65472523,65472526地址:重庆大学科技园欣阳广场G栋17-13号(400030)scjp模拟试题(二)来源:思达网校()QuestionNo:1publicclasstest(2.publicstaticvoidmain(Stringargs[]){3.inti=0xFFFFFFF1;4.intj=~i;5.6.}7.)Whatisthedecimalvalueofjatline5?A.0B.1C.14D.–15E.Anerroratline3causescompilationtofail.F.Anerroratline4causescompilationtofail.答案:C------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话:023-65472521,65472523,65472526地址:重庆大学科技园欣阳广场G栋17-13号(400030)QuestionNo:2Given:Integeri=newInteger(42);Long1=newLong(42);Doubled=newDouble(42.0);WhichtwoexpressionsevaluatetoTrue?(ChooseTwo)A.(i==1)B.(i==d)C.(d==1)D.(i.equals(d))E.(d.equals(i))F.(i.equals(42))答案:D,EQuestionNo:3Exhibit:1.publicclasstest(2.privatestaticintj=0;3.4.privatestaticbooleanmethodB(intk)(5.j+=k;------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话:023-65472521,65472523,65472526地址:重庆大学科技园欣阳广场G栋17-13号(400030)6.returntrue;6.)7.8.publicstaticvoidmethodA(inti){9.booleanb:10.b=i10|methodB(4);11.b=i10||methodB(8);12.}13.14.publicstaticvoidmain(Stringargs[])(15.methodA(0);16.system.out.printIn(j);17.)18.)Whatistheresult?A.Theprogramprints“0”B.Theprogramprints“4”C.Theprogramprints“8”D.Theprogramprints“12”E.Thecodedoesnotcomplete.答案:B------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话:023-65472521,65472523,65472526地址:重庆大学科技园欣阳广场G栋17-13号(400030)QuestionNo:4Given1.Publicclasstest(2.Publicstaticvoidmain(Stringargs[])(3.System.out.printIn(6^3);4.)5.)Whatistheoutput?答案:5QuestionNo:5Given:1.publicclassFoo{2.publicstaticvoidmain(String[]args){3.StringBuffera=newStringBuffer(“A”);4.StringBufferb=newStringBuffer(“B”);5.operate(a,b);6.system.out.printIn{a+“,”+b};7.}8.staticvoidoperate(StringBufferx,StringBuffery){------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话:023-65472521,65472523,65472526地址:重庆大学科技园欣阳广场G栋17-13号(400030)9.x.append{y};10.y=x;11.}12.}Whatistheresult?A.Thecodecompilesandprints“A,B”.B.Thecodecompilesandprints“A,A”.C.Thecodecompilesandprints“B,B”.D.Thecodecompilesandprints“AB,B”.E.Thecodecompilesandprints“AB,AB”.F.Thecodedoesnotcompilebecause“+”cannotbeoverloadedforStringBuffer.答案:DQuestionNo:6Exhibit:1.Publicclasstest(2.PublicstaticvoidstringReplace(Stringtext)(3.Text=text.replace(‘j’,‘i’);4.)5.------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话:023-65472521,65472523,65472526地址:重庆大学科技园欣阳广场G栋17-13号(400030)6.publicstaticvoidbufferReplace(StringBuffertext)(7.text=text.append(“C”)8.)9.10.publicstaticvoidmain(Stringargs[])(11.StringtextString=newString(“java”);12.StringBuffertextBufferString=newStringBuffer(“java”);13.14.stringReplace(textString);15.BufferReplace(textBuffer);16.17.System.out.printIn(textString+textBuffer);18.)19.)Whatistheoutput?答案:JAVAJAVAQuestionNo:7Exhibit:1.publicclasstest{------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话:023-65472521,65472523,65472526地址:重庆大学科技园欣阳广场G栋17-13号(400030)2.publicstaticvoidadd3(Integeri)}3.intval=i.intValue();4.val+=3;5.i=newInteger(val);6.)7.8.publicstaticvoidmain(Stringargs[]){9.Integeri=newInteger(0);10.add3(i);11.system.out.printIn(i.intValue());12.}13.)Whatistheresult?A.Compilationwillfail.B.Theprogramprints“0”.C.Theprogramprints“3”.D.Compilationwillsucceedbutanexceptionwillbethrownatline3.答案:BQuestionNo:8------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话:023-65472521,65472523,65472526地址:重庆大学科技园欣阳广场G栋17-13号(400030)Given:1.publicclassConstOver{2.publicConstOver(intx,inty,intz){3.}4.}WhichtwooverloadtheConstOverconstructor?(ChooseTwo)A.ConstOver(){}B.ProtectedintConstOver(){}C.PrivateConstOver(intz,inty,bytex){}D.PublicObjectConstOver(intx,inty,intz){}E.PublicvoidConstOver(bytex,bytey,bytez){}答案:A,CQuestionNo:9Given:1.publicclassMethodOver{2.publicvoidsetVar(inta,intb,floatc){3.}4.}WhichtwooverloadthesetVarmethod?(ChooseTwo)A.PrivatevoidsetVar(inta,floatc,intb){}------------------------------------------------------------------------------------------------------------------------------------------全国免费咨询热线:11698-65432大客户培训热线:023-65472526咨询电话
本文标题:scjp模拟试题(二)
链接地址:https://www.777doc.com/doc-4338208 .html