SCJP Mock Exam 2.docx

上传人:b****6 文档编号:5662714 上传时间:2022-12-30 格式:DOCX 页数:43 大小:30.91KB
下载 相关 举报
SCJP Mock Exam 2.docx_第1页
第1页 / 共43页
SCJP Mock Exam 2.docx_第2页
第2页 / 共43页
SCJP Mock Exam 2.docx_第3页
第3页 / 共43页
SCJP Mock Exam 2.docx_第4页
第4页 / 共43页
SCJP Mock Exam 2.docx_第5页
第5页 / 共43页
点击查看更多>>
下载资源
资源描述

SCJP Mock Exam 2.docx

《SCJP Mock Exam 2.docx》由会员分享,可在线阅读,更多相关《SCJP Mock Exam 2.docx(43页珍藏版)》请在冰豆网上搜索。

SCJP Mock Exam 2.docx

SCJPMockExam2

Question1)

Whichofthefollowingarelegalstatements?

1)floatf=1/3;

2)inti=1/3;

3)floatf=1.01;

4)doubled=999d;

AnswertoQuestion1)

--------------------------------------------------------------------------------

Question2)

WhichofthefollowingareJavakeywords?

1)NULL

2)new

3)instanceOf

4)wend

AnswertoQuestion2)

--------------------------------------------------------------------------------

Question3)

Whichofthefollowingarevalidstatements?

1)System.out.println(1+1);

2)inti=2+'2';

3)c

4)byteb=255;

AnswertoQuestion3)

--------------------------------------------------------------------------------

Question4)

Whichofthefollowingstatementsaretrue?

1)ThegarbagecollectionalgorithminJavaisvendorimplemented

2)Thesizeofprimitivesisplatformdependent

3)Thedefaulttypeforanumericalliteralwithdecimalcomponentisafloat.

4)YoucanmodifythevalueinanInstanceoftheIntegerclasswiththesetValuemethod

AnswertoQuestion4)

--------------------------------------------------------------------------------

Question5)

Whichofthefollowingaretruestatements?

1)I/OinJavacanonlybeperformedusingtheListenerclasses

2)TheRandomAccessFileclassallowsyoutomovedirectlytoanypointafile.

3)ThecreationofanamedinstanceoftheFileclasscreatesamatchingfileintheunderlyingoperatingsystemonlywhentheclosemethodiscalled.

4)ThecharacteristicsofaninstanceoftheFileclasssuchasthedirectoryseparator,dependonthecurrentunderlyingoperatingsystem

AnswertoQuestion5)

--------------------------------------------------------------------------------

Question6).

Whichofthefollowingstatementsaretrue?

1)Theinstanceofoperatorcanbeusedtodetermineifareferenceisaninstanceofaclass,butnotaninterface.

2)Theinstanceofoperatorcanbeusedtodetermineifareferenceisaninstanceofaparticularprimitivewrapperclass

3)Theinstanceofoperatorwillonlydetermineifareferenceisaninstanceofaclassimmediatelyaboveinthehierarchybutnofurtheruptheinheritancechain

4)Theinstanceofoperatorcanbeusedtodetermineifonereferenceisofthesameclassasanotherreferencethus

AnswertoQuestion6)

--------------------------------------------------------------------------------

Question7)

Whichofthefollowingstatementsaretrue?

1)Aninterfacecanonlycontainmethodandnotvariables

2)Interfacescannothaveconstructors

3)Aclassmayextendonlyoneotherclassandimplementonlyoneinterface

4)InterfacesaretheJavaapproachtoaddressingitslackofmultipleinheritance,butrequireimplementingclassestocreatethefunctionalityoftheInterfaces.

AnswertoQuestion7)

--------------------------------------------------------------------------------

Question8)

Whichofthefollowingarevalidstatements

1)publicclassMyCalcextendsMath

2)Math.max(s);

3)Math.round(9.99,1);

4)Math.mod(4,10);

AnswertoQuestion8)

--------------------------------------------------------------------------------

Question9)

WhichofthefollowingaremethodsoftheRunnableinterface

1)run

2)start

3)yield

4)stop

AnswertoQuestion9)

--------------------------------------------------------------------------------

Question10)

Whichofthefollowingstatementsaretrue?

1)Abytecanrepresentbetween-128to127

2)Abytecanrepresentbetween-127to128

3)Abytecanrepresentbetween-256to256

4)Acharcanrepresentbetween-2x2pow162x2pow16-1

AnswertoQuestion10)

--------------------------------------------------------------------------------

Question11)

Whatwillhappenwhenyouattempttocompileandrunthefollowingcode

classBase{

publicvoidBase(){

System.out.println("Base");

}

}

publicclassInextendsBase{

publicstaticvoidmain(Stringargv[]){

Ini=newIn();

}

}

1)CompiletimeerrorBaseisakeyword

2)Compilationandnooutputatruntime

3)OutputofBase

4)RuntimeerrorBasehasnovalidconstructor

AnswertoQuestion11)

--------------------------------------------------------------------------------

Question12)

Youhaveapublicclasscalledmyclasswiththemainmethoddefinedasfollows

publicstaticvoidmain(Stringparm[]){

System.out.println(parm[0]);

}

Ifyouattempttocompiletheclassandruntheprogramasfollows

javamyclasshello

Whatwillhappen?

1)Compiletimeerror,mainisnotcorrectlydefined

2)Runtimeerror,mainisnotcorrectlydefined

3)Compilationandoutputofjava

4)Compilationandoutputofhello

AnswertoQuestion12)

--------------------------------------------------------------------------------

Question13)

Whichofthefollowingstatementsaretrue?

1)Ifaclasshasanyabstractmethodsitmustbedeclaredabstractitself.

2)Allmethodsinanabstractclassmustbedeclaredasabstract

3)Whenappliedtoaclass,thefinalmodifiermeansitcannotbesub-classed

4)transientandvolatileareJavamodifiers

AnswertoQuestion13)

--------------------------------------------------------------------------------

Question14)

Whichofthefollowingarevalidmethods?

1)publicstaticnativevoidamethod(){}

2)publicstaticvoidameticnativevoidamethod(){}

3)privateprotectedvoidamethod(){}

4)staticnativevoidamethod();

AnswertoQuestion14)

--------------------------------------------------------------------------------

Question15)

Whichofthefollowingstatementsaretrue?

1)Constructorscannothaveavisibilitymodifier

2)Constructorscanbemarkedpublicandprotected,butnotprivate

3)Constructorscanonlyhaveaprimitivereturntype

4)Constructorsarenotinherited

AnswertoQuestion15)

--------------------------------------------------------------------------------

Question16)

Whatwillhappenwhenyouattempttocompileandrunthefollowingclass?

classBase{

Base(inti){

System.out.println("Base");

}

}

classSevernextendsBase{

publicstaticvoidmain(Stringargv[]){

Severns=newSevern();

}

voidSevern(){

System.out.println("Severn");

}

}

1)Compilationandoutputofthestring"Severn"atruntime

2)Compiletimeerror

3)Compilationandnooutputatruntime

4)Compilationandoutputofthestring"Base"

AnswertoQuestion16)

--------------------------------------------------------------------------------

Question17)

Whichofthefollowingstatementsaretrue?

1)staticmethodsdonothaveaccesstotheimplicitvariablecalledthis

2)Astaticmethodmaybecalledwithoutcreatinganinstanceofitsclass

3)Astaticmethodmaynotbeoverridentobenon-static

4)Astaticmethodmaynotbeoverloaded

Answertoquestion17)

--------------------------------------------------------------------------------

Question18)

Whichofthefollowingwillcompilewithouterror?

1)

charc='1';

System.out.println(c>>1);

2)

Integeri=Integer("1");

System.out.println(i>>1);

3)

inti=1;

System.out.println(i<<<1);

4)

inti=1;

System.out.println(i<<1);

AnswertoQuestion18)

--------------------------------------------------------------------------------

Question19)

Whichofthefollowingaretrue?

1)Acomponentmayhaveonlyoneeventlistenerattachedatatime

2)Aneventlistenermayberemovedfromacomponent

3)TheActionListenerinterfacehasnocorrespondingAdapterclass

4)Theprocessingofaneventlistenerrequiresatry/catchblock

AnswertoQuestion19)

--------------------------------------------------------------------------------

Question20)

WhichofthefollowingareJavakeywords?

1)sizeof

2)main

3)transient

4)volatile

AnswertoQuestion20)

--------------------------------------------------------------------------------

Question21)

Whichofthefollowingstatementsaretrue?

1)Thedefaultconstructorhasareturntypeofvoid

2)Thedefaultconstructortakesaparameterofvoid

3)Thedefaultconstructortakesnoparameters

4)Thedefaultconstructorisnotcreatediftheclasshasanyconstructorsofitsown.

AnswertoQuestion21)

--------------------------------------------------------------------------------

Question22)

Whichofthefollowingstatementsaretrue?

1)Allofthevariablesinaninterfaceareimplicitlystatic

2)Allofthevariablesinaninterfaceareimplicitlyfinal

3)Allofthemethodsinaninterfaceareimplicitlyabstract

4)Amethodinaninterfacecanaccessclasslevelvariables

AnswertoQuestion22)

--------------------------------------------------------------------------------

Question23)

Whichofthefollowingstatementsaretrue?

1)TheStringclassisimplementedasachararray,elementsareaddressedusingthestringname[]convention

2)The+operatorisoverloadedforconcatenationfortheStringclass

3)StringsareaprimitivetypeinJavaandtheStringBufferisusedasthematchingwrappertype

4)Thesizeofastringcanberetrievedusingthelengthproperty

AnswertoQuestion23)

--------------------------------------------------------------------------------

Question24)

Whichofthefollowingstatementsaretrue?

1)Amethodinaninterfacemustnothaveabody

2)Aclassmayextendoneotherclassplusatmostoneinterface

3)Aclassmayextendsatmostoneotherclassplusimplementmanyinterfaces

4)Anclassaccessesaninterfaceviathekeyworduses

AnswertoQuestion24)

--------------------------------------------------------------------------------

Question25)

Whichofthefollowingstatementsaretrue?

1)Thefollowingstatementwillproducearesultof1.System.out.println(-1>>>2);

2)Performinganunsignedleftshift(<<<)on

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1