平纳科(上海)信息咨询有限公司

平纳科(上海)信息咨询有限公司

ID:38630475

大小:277.50 KB

页数:8页

时间:2019-06-16

上传者:U-2441
平纳科(上海)信息咨询有限公司_第1页
平纳科(上海)信息咨询有限公司_第2页
平纳科(上海)信息咨询有限公司_第3页
平纳科(上海)信息咨询有限公司_第4页
平纳科(上海)信息咨询有限公司_第5页
资源描述:

《平纳科(上海)信息咨询有限公司》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

选择题1:1.Give the following method:  2. public void method( ){  3. String a,b;  4. a=new String(“hello world”);  5. b=new String(“game over”);  6. System.out.println(a+b+”ok”);  7. a=null;  8. a=b;  9. System.out.println(a);  10. }   11.In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection.  Givethefollowingmethod:publicvoidmethod(){Stringa,b;a=newString(“helloworld”);b=newString(“gameover”);System.out.println(a+b+”ok”);a=null;a=b;System.out.println(a);}Intheabsenceofcompileroptimization,whichistheearliestpointtheobjectareferedisdefinitelyelibiletobegarbagecollection.A.beforeline5B.beforeline6C.beforeline7D.beforeline92:在软件生命周期中,下列哪个说法是不准确的?A.软件生命周期分为计划、开发和运行三个阶段B.在计划阶段要进行问题焉醛和需求分析C.在开发后期要进行编写代码和软件测试D.在运行阶段主要是进行软件维护3:Whichofthefollowingansweriscorrecttoexpressthevalue8inoctalnumber?A.010B.0x10C.08D.0x84:Usetheoperator“>>”and“>>>”.Whichstatementistrue? A.10100000000000000000000000000000>>4give00001010000000000000000000000000B.10100000000000000000000000000000>>4give11111010000000000000000000000000C.10100000000000000000000000000000>>>4give00000000000000000000000000000000D.10100000000000000000000000000000>>>4give111110100000000000000000000000005:Whichstatementaboutthegarbagecollectionmechanismaretrue?A.Garbagecollectionrequireadditionalprogramecodeincaseswheremultiplethreadsarerunning.B.Theprogrammercanindicatethatareferencethroughalocalvariableisnolongerofinterest.C.TheprogrammerhasamechanismthatexplicityandimmediatelyfreesthememoryusedbyJavaobjects.D.ThegarbagecollectionmechanismcanfreethememoryusedbyJavaObjectatexplectiontime.6:鉴于Java的特点,它最适合的计算环境是A.并行计算环境B.分布式计算环境C.高强度计算环境D.开放式计算环境7:在下述选项时,没有构成死循环的程序是A.inti=100while(1){i=i%100+1;if(i>100)break;}B.for(;;);C.intk=1000;do{++k;}while(k>=10000);D.ints=36;while(s);--s;8: 1.Give the following java source fragement:  2.//point x  3.public class Interesting{  4.//do something  5.}  6.Which statement is correctly Java syntax at point x?   Givethefollowingjavasourcefragement://pointxpublicclassInteresting{//dosomething}WhichstatementiscorrectlyJavasyntaxatpointx?A.publicclassMyClass{//dootherthing…}B.staticintPI=3.14C.classMyClass{//dosomething…}D.none9:1.What will happen when you attempt to compile and run the following code?   2.  3.class Base   4.  5.{  6.  7.int i = 99;   8.  9.public void amethod()  10.  11.{  12.  13.       System.out.println("Base.amethod()");  14.  15.     }  16.  17.     Base()  18.  19.{  20.  21.     amethod();  22.  23.     }  24.  25.}   26.  27.public class Derived extends Base  28.   1.{  2.  3.int i = -1;  4.  5.         6.  7.public static void main(String argv[])  8.  9.{  10.  11.     Base b = new Derived();  12.  13.       System.out.println(b.i);  14.  15.       b.amethod();  16.  17.     }   18.  19.     public void amethod()  20.  21.{  22.  23.       System.out.println("Derived.amethod()");  24.  25.     }   26.  27.}   28.  29.Choices:  Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?classBase{inti=99;publicvoidamethod(){System.out.println("Base.amethod()");}Base(){amethod();}}publicclassDerivedextendsBase{inti=-1;publicstaticvoidmain(Stringargv[]){Baseb=newDerived();System.out.println(b.i);b.amethod();}publicvoidamethod(){System.out.println("Derived.amethod()");}}Choices:A.Derived.amethod()-1Derived.amethod()B.Derived.amethod()99C.CompiletimeerrorD.Derived.amethod()10:1.public class OuterClass {  2.private double d1 = 1.0;  3.//insert code here  4.}   1.You need to insert an inner class declaration at line 3. Which two inner class declarations are  2.valid?  publicclassOuterClass{privatedoubled1=1.0;//insertcodehere}Youneedtoinsertaninnerclassdeclarationatline3.Whichtwoinnerclassdeclarationsarevalid?A.classInnerOne{publicstaticdoublemethoda(){returnd1;}}B.publicclassInnerOne{staticdoublemethoda(){returnd1;}}C.privateclassInnerOne{doublemethoda(){returnd1;}}D.staticclassInnerOne{protecteddoublemethoda(){returnd1;}}11:1.What will happen when you attempt to compile and run the following code?   2.  3.public class Static  4.  5.{  6.  7.static  8.  9.{  10.  11.int x = 5;  12.  13.}   14.  15.static int x,y;  16.  17.public static void main(String args[])  18.  19.{  20.  21.       x--;  22.  23.       myMethod();  24.  25.       System.out.println(x + y + ++x);  26.  27.}   28.  29.public static void myMethod()  30.  31.{   1.  2.y = x++ + ++x;  3.  4.}  5.  6.}   7.  8.Choices:  Whatwillhappenwhenyouattempttocompileandrunthefollowingcode?publicclassStatic{static{intx=5;}staticintx,y;publicstaticvoidmain(Stringargs[]){x--;myMethod();System.out.println(x+y+++x);}publicstaticvoidmyMethod(){y=x+++++x;}}Choices:A.prints:2B.prints:3C.prints:7D.prints:812:1.Give the code fragment:  2.if(x>4){  3.System.out.println(“Test 1”);}  4.else if (x>9){  5.System.out.println(“Test 2”);}  6.else {  7.System.out.println(“Test 3”);}  8.Which range of value x would produce of output “Test 2”?   Givethecodefragment:if(x>4){System.out.println(“Test1”);}elseif(x>9){System.out.println(“Test2”);}else{System.out.println(“Test3”);}Whichrangeofvaluexwouldproduceofoutput“Test2”?A.x<4B.x>4C.x>9D.None13:1.In the following code, which is the earliest statement, where the object originally held in e, may be garbage collected:  2.  1.public class Test {   3.  4.  2.  public static void main (String args []) {   5.  6.  3.    Employee e = new Employee("Bob", 48);    1.  2.  4.    e.calculatePay();   3.  4.  5.    System.out.println(e.printDetails());   5.  6.  6.    e = null;   7.  8.  7.    e = new Employee("Denise", 36);   9.  10.  8.    e.calculatePay();   11.  12.  9.    System.out.println(e.printDetails());   13.  14. 10.  }   15.  16. 11.}  17.Only One:   Inthefollowingcode,whichistheearlieststatement,wheretheobjectoriginallyheldine,maybegarbagecollected:1.publicclassTest{2.publicstaticvoidmain(Stringargs[]){3.Employeee=newEmployee("Bob",48);4.e.calculatePay();5.System.out.println(e.printDetails());6.e=null;7.e=newEmployee("Denise",36);8.e.calculatePay();9.System.out.println(e.printDetails());10.}11.}OnlyOne:A.Line10B.Line11C.Line7D.Line814:关于垃圾收集的哪些叙述是对的。A.程序开发者必须自己创建一个线程进行内存释放的工作。B.垃圾收集将检查并释放不再使用的内存。C.垃圾收集允许程序开发者明确指定并立即释放该内存。D.垃圾收集能够在期望的时间释放被java对象使用的内存。15:Math.round(-11.5)等於多少?A.-11B.-12C.-11.5D.none 16:1.What results from attempting to compile and run the following code?   2.  3.public class Ternary  4.  5.{  6.  7.public static void main(String args[])  8.  9.{  10.  11.int a = 5;  12.  13.System.out.println("Value is - " + ((a < 5) ? 9.9 : 9));  14.  15.}  16.  17.}   18.  19.Choices:  Whatresultsfromattemptingtocompileandrunthefollowingcode?publicclassTernary{publicstaticvoidmain(Stringargs[]){inta=5;System.out.println("Valueis-"+((a<5)?9.9:9));}}Choices:A.prints:Valueis-9B.CompilationerrorC.prints:Valueis-5D.Noneofthese简答题17:写一个方法,在JAVA,C/C++源代码中,检查花括弧(是“(”与“)”,“{”与“}”)是否匹配,若不匹配,则输出不匹配花括弧所在的行与列。18:abstractclass和interface有什么区别?19:spring中Bean的作用域有哪几种?20:Jdo是什么?21:比较两个字符串,用O(n)时间和恒量空间。22:两种不同的方法计算unsignedx有多少1bits,如x=3,为00000011,有2个123:在java中一个类被声明为final类型,表示了什么意思?24:如何给weblogic指定大小的内存?25:Error与Exception有什么区别?

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

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

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