JAVA题库-格林模拟试题三(上)_第1页
JAVA题库-格林模拟试题三(上)_第2页
JAVA题库-格林模拟试题三(上)_第3页
JAVA题库-格林模拟试题三(上)_第4页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、姓名:_ 班级:_ 学号:_-密-封 -线- java题库:格林模拟试题三(上)考试时间:120分钟 考试总分:100分题号一二三四五总分分数遵守考场纪律,维护知识尊严,杜绝违纪行为,确保考试结果公正。questions question1) whichofthefollowingarelegalstatements? 1)floatf=1/3; 2)inti=1/3; 3)floatf=1.01; 4)doubled=999d; question2) whichofthefollowingarejavakeywords? 1)null 2)new 3)instanceof 4)wend qu

2、estion3) whichofthefollowingarevalidstatements? 1)system.out.println(1+1); 2)inti=2+2; 3)strings=“on”+one; 4)byteb=255; question4) whichofthefollowingstatementsaretrue? 1)thegarbagecollectionalgorithminjavaisvendorimplemented 2)thesizeofprimitivesisplatformdependent 3)thedefaulttypeforanumericallite

3、ralwithdecimalcomponentisafloat. 4)youcanmodifythevalueinaninstanceoftheintegerclasswiththesetvaluemethod question5) whichofthefollowingaretruestatements? 1)i/oinjavacanonlybeperformedusingthelistenerclasses 2)therandomaccessfileclassallowsyoutomovedirectlytoanypointafile. 3)thecreationofanamedinsta

4、nceofthefileclasscreatesamatchingfileintheunderlyingoperatingsystemonlywhentheclosemethodiscalled. 4)thecharacteristicsofaninstanceofthefileclasssuchasthedirectoryseparator,dependonthecurrentunderlyingoperatingsystem question6) whichofthefollowingstatementsaretrue? 1)theinstanceofoperatorcanbeusedto

5、determineifareferenceisaninstanceofaclass,butnotaninterface. 2)theinstanceofoperatorcanbeusedtodetermineifareferenceisaninstanceofaparticularprimitivewrapperclass 3)theinstanceofoperatorwillonlydetermineifareferenceisaninstanceofaclassimmediatelyaboveinthehierarchybutnofurtheruptheinheritancechain 4

6、)theinstanceofoperatorcanbeusedtodetermineifonereferenceisofthesameclassasanotherreferencethus question7) whichofthefollowingstatementsaretrue? 1)aninterfacecanonlycontainmethodandnotvariables 2)interfacescannothaveconstructors 3)aclassmayextendonlyoneotherclassandimplementonlyoneinterface 4)interfa

7、cesarethejavaapproachtoaddressingitslackofmultipleinheritance,butrequireimplementingclassestocreatethefunctionalityoftheinterfaces. question8) whichofthefollowingarevalidstatements 1)publicclassmycalcextendsmath 2)math.max(s); 3)math.round(9.99,1); 4)math.mod(4,10); question9) whichofthefollowingare

8、methodsoftherunnableinterface 1)run 2)start 3)yield 4)stop转 question10) whichofthefollowingstatementsaretrue? 1)abytecanrepresentbetween-128to127 2)abytecanrepresentbetween-127to128 3)abytecanrepresentbetween-256to256 4)acharcanrepresentbetween-2x2pow162x2pow16-1 question11) whatwillhappenwhenyouatt

9、empttocompileandrunthefollowingcode classbase publicvoidbase() system.out.println(“base”); publicclassinextendsbase publicstaticvoidmain(stringargv) ini=newin(); 1)compiletimeerrorbaseisakeyword 2)compilationandnooutputatruntime 3)outputofbase 4)runtimeerrorbasehasnovalidconstructor question12) youh

10、aveapublicclasscalledmyclasswiththemainmethoddefinedasfollows publicstaticvoidmain(stringparm) system.out.println(parm0); ifyouattempttocompiletheclassandruntheprogramasfollows javamyclasshello whatwillhappen? 1)compiletimeerror,mainisnotcorrectlydefined 2)runtimeerror,mainisnotcorrectlydefined 3)co

11、mpilationandoutputofjava 4)compilationandoutputofhello question13) whichofthefollowingstatementsaretrue? 1)ifaclasshasanyabstractmethodsitmustbedeclaredabstractitself. 2)allmethodsinanabstractclassmustbedeclaredasabstract 3)whenappliedtoaclass,thefinalmodifiermeansitcannotbesub-classed 4)transientan

12、dvolatilearejavamodifiers question14) whichofthefollowingarevalidmethods? 1)publicstaticnativevoidamethod() 2)publicstaticvoidamethod() 3)privateprotectedvoidamethod() 4)staticnativevoidamethod(); question15) whichofthefollowingstatementsaretrue? 1)constructorscannothaveavisibilitymodifier 2)constru

13、ctorscanbemarkedpublicandprotected,butnotprivate 3)constructorscanonlyhaveaprimitivereturntype 4)constructorsarenotinheritedquestion16) whatwillhappenwhenyouattempttocompileandrunthefollowingclass? classbase base(inti) system.out.println(“base”); classsevernextendsbase publicstaticvoidmain(stringarg

14、v) severns=newsevern(); voidsevern() system.out.println(“severn”); 1)compilationandoutputofthestring”severn”atruntime 2)compiletimeerror 3)compilationandnooutputatruntime 4)compilationandoutputofthestring”base” question17) whichofthefollowingstatementsaretrue? 1)staticmethodsdonothaveaccesstotheimpl

15、icitvariablecalledthis 2)astaticmethodmaybecalledwithoutcreatinganinstanceofitsclass 3)astaticmethodmaynotbeoverridentobenon-static 4)astaticmethodmaynotbeoverloaded question18) whichofthefollowingwillcompilewithouterror? 1) charc=1; system.out.println(c1); 2) integeri=integer(“1”); system.out.print

16、ln(i1); 3) inti=1; system.out.println(i1); 4) inti=1; system.out.println(i1); question19) whichofthefollowingaretrue? 1)acomponentmayhaveonlyoneeventlistenerattachedatatime 2)aneventlistenermayberemovedfromacomponent 3)theactionlistenerinterfacehasnocorrespondingadapterclass 4)theprocessingofanevent

17、listenerrequiresatry/catchblockquestion20) whichofthefollowingarejavakeywords? 1)sizeof 2)main 3)transient 4)volatile question21) whichofthefollowingstatementsaretrue? 1)thedefaultconstructorhasareturntypeofvoid 2)thedefaultconstructortakesaparameterofvoid 3)thedefaultconstructortakesnoparameters 4)

18、thedefaultconstructorisnotcreatediftheclasshasanyconstructorsofitsown. question22) whichofthefollowingstatementsaretrue? 1)allofthevariablesinaninterfaceareimplicitlystatic 2)allofthevariablesinaninterfaceareimplicitlyfinal 3)allofthemethodsinaninterfaceareimplicitlyabstract 4)amethodinaninterfaceca

19、naccessclasslevelvariables question23) whichofthefollowingstatementsaretrue? 1)thestringclassisimplementedasachararray,elementsareaddressedusinglwhichofthefollowingstatementsaretrue? 1)amethodinaninterfacemustnothaveabody 2)aclassmayextendoneotherclassplusatmostoneinterface 3)aclassmayextendsatmosto

20、neotherclassplusimplementmanyinterfaces 4)anclassaccessesaninterfaceviathekeyworduses question25) whichofthefollowingstatementsaretrue? 1)thefollowingstatementwillproducearesultof1.system.out.println(-12); 2)performinganunsignedleftshift()onanegativenumberwillalwaysproduceanegativenumberresult 3)the

21、followingstatementwillproducearesultofzero,system.out.println(11); 4)allthejavaintegraltypesaresignednumbers question26) whichofthefollowingstatementsaretrue? 1)theelementsinajavaarraycanonlybeofprimitivetypes,notobjects 2)arrayselementsareinitializedtodefaultvalueswherevertheyarecreatedusingthekewo

22、rdnew 3)anarraymaybedynamicallyresizedusingthesetsizemethod 4)youcanfindoutthesizeofanarrayusingthesizemethod question27) giventhefollowingclass publicclassombersley publicstaticvoidmain(stringargv) booleanb1=true; if(b1=true)|place(true) system.out.println(“hellocrowle”); publicstaticbooleanplace(b

23、ooleanlocation) if(location=true) system.out.println(“borcetshire”); system.out.println(“powick”); returntrue; whatwillhappenwhenyouattempttocompileandrunit? 1)compiletimeerror 2)outputof”hellocrowle” 3)outputofborcetshireandpowickfollowedby”hellocrowle” 4)nooutput question28) youaregivenaclasshiera

24、rchywithaninstanceoftheclassdog.theclassdogisachildofmammalandtheclassmammalisachildoftheclassvertebrate.theclassvertebratehasamethodcalledmovewhichprintsoutthestring”move”.theclassmammaloverridesthismethodandprintsoutthestring”walks”.theclassdogoverridesthismethodandprintsoutthestring”walksonpaws”.givenaninstanceoftheclassdog,.howcanyouaccesstheance

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论