基础阶段综合模拟题

基础阶段综合模拟题

ID:38712354

大小:86.00 KB

页数:14页

时间:2019-06-18

基础阶段综合模拟题_第1页
基础阶段综合模拟题_第2页
基础阶段综合模拟题_第3页
基础阶段综合模拟题_第4页
基础阶段综合模拟题_第5页
资源描述:

《基础阶段综合模拟题》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、基础阶段综合模拟测试题一:单选题1.Whichstatementaboutthegarbagecollectionmechanismaretrue?(B)A.Garbagecollectionrequireadditionalprogramcodeincaseswheremultiplethreadsarerunning.B.Theprogrammercanindicatethatareferencethroughalocalvariableisnolongerofinterest.C.Theprogramme

2、rhasamechanismthatexplicitandimmediatelyfreesthememoryusedbyJavaobjects.D.ThegarbagecollectionmechanismcanfreethememoryusedbyJavaObjectatexpectabletime.E.Thegarbagecollectionsystemneverreclaimsmemoryfromobjectswhilearestillaccessibletorunninguserthreads.2.Gi

3、vethefollowingmethod:1)publicvoidmethod(){2)Stringa,b;3)a=newString(“helloworld”);4)b=newString(“gameover”);5)System.out.println(a+b+”ok”);6)a=null;7)a=b;8)System.out.println(a);9)}Intheabsenceofcompileroptimization,whichistheearliestpointtheobjectareferredi

4、sdefinitelyhandtobegarbagecollection.(D)A.beforeline3B.beforeline5C.beforeline6D.beforeline7E.Beforeline9 3.Givethefollowingcode:DFpublicclassExample{publicstaticvoidmain(Stringargs[]){intl=0;do{System.out.println(“Doingitforlis:”+l);}while(--l>;0)System.out

5、.println(“Finish”);}}Whichwellbeoutput:A.Doingitforlis3B.Doingitforlis1CDoingitforlis2D.Doingitforlis0E.Doingitforlis–1F.Finish1.以下(C)是JAVA的保留字。(选择一项)A.Java  B.HelloC.classD.Class5.欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?BA、ArrayListmyList=newObject();B、Li

6、stmyList=newArrayList();C、ArrayListmyList=newList();D、ListmyList=newList();6.指出正确的表达式CDA、byte=128;B、Boolean=null;C、longl=0xfffL;D.double=0.9239d;7下面程序运行之后,变量x的值是(B).(选择一项)......//swap方法的声明publicstaticvoidswap(inta,intb){intt=a;a=b;b=t;}//main方法publicstaticvo

7、idmain(Stringargs[]){intx=2;inty=3;swap(x,y);}A、2B、3C、4D、68下面变量var的作用域范围是(D)。(选择一项)2.//....3.intx;4.switch(x){5.case0:6.{7.intvar;8.//process9.}10.break;11.case1:12.{13.intvar1;14.//process15.}16.break;1.}A、1和16行之间B、4和8行之间C、6和8行之间D、6和14行之间9指出下列程序运行的结果Bpublic

8、classExample{  Stringstr=newString("good");  char[]ch={'a','b','c'};  publicstaticvoidmain(Stringargs[]){    Exampleex=newExample();    ex.change(ex.str,ex.ch);    System.out.print(ex.str+"and")

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。