为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

北京达内科技有限公司 Java培训讲师

2018-04-15 19页 doc 102KB 22阅读

用户头像

is_574951

暂无简介

举报
北京达内科技有限公司 Java培训讲师北京达内科技有限公司 Java培训讲师 选择题 1:在软件生命周期中,下列哪个说法是不准确的? A.软件生命周期分为计划、开发和运行三个阶段 B.在计划阶段要进行问题焉醛和需求分析 C.在开发后期要进行编写代码和软件测试 D.在运行阶段主要是进行软件维护 2: Which is the most appropriate code snippet that can be inserted at line 18 in the following code? (Assume that the code is...
北京达内科技有限公司 Java培训讲师
北京达内科技有限公司 Java培训讲师 选择 1:在软件生命周期中,下列哪个说法是不准确的? A.软件生命周期分为、开发和运行三个阶段 B.在计划阶段要进行问题焉醛和需求 C.在开发后期要进行编写代码和软件测试 D.在运行阶段主要是进行软件维护 2: Which is the most appropriate code snippet that can be inserted at line 18 in the following code? (Assume that the code is compiled and run with assertions enabled) 1. import java.util.*; 2. 3. public class AssertTest 4. { 5. private HashMap cctld; 6. 7. public AssertTest() 8. { 9. cctld = new HashMap(); 10. cctld.put("in", "India"); 11. cctld.put("uk", "United Kingdom"); 12. cctld.put("au", "Australia"); 13. // more code... 14. } 15. // other methods .... 16. public String getCountry(String countryCode) 17. { 18. // What should be inserted here? 19. String country = (String)cctld.get(countryCode); 20. return country; 21. } 22. } Which is the most appropriate code snippet that can be inserted at line 18 in the following code? (Assume that the code is compiled and run with assertions enabled) 1. import java.util.*; 2. 3. public class AssertTest 4. { 5. private HashMap cctld; 6. 7. public AssertTest() 8. { 9. cctld = new HashMap(); 10. cctld.put("in", "India"); 11. cctld.put("uk", "United Kingdom"); 12. cctld.put("au", "Australia"); 13. // more code... 14. } 15. // other methods .... 16. public String getCountry(String countryCode) 17. { 18. // What should be inserted here? 19. String country = (String)cctld.get(countryCode); 20. return country; 21. } 22. } A.assert countryCode != null; B.assert countryCode != null : "Country code can not be null" ; C.assert cctld != null : "No country code data is available"; D.assert cctld : "No country code data is available"; 3: Give the following code: public class Example{ public static void main(String args[] ){ int l=0; do{ System.out.println(“Doing it for l is:”+l); }while(--l>0) System.out.println(“Finish”); } } Which well be output: Give the following code: public class Example{ public static void main(String args[] ){ int l=0; do{ System.out.println(“Doing it for l is:”+l); }while(--l>0) System.out.println(“Finish”); } } Which well be output: A.Doing it for l is 3 B.Doing it for l is 1 C.Doing it for l is 2 D.Doing it for l is 0 4: Give this class outline: class Example{ private int x; //rest of class body… } Assuming that x invoked by the code java Example, which statement can made x be directly acces sible in main() method of Example.java? Give this class outline: class Example{ private int x; //rest of class body… } Assuming that x invoked by the code java Example, which statement can made x be directly accessible in main() method of Example.java? A.Change private int x to public int x B.change private int x to static int x C.Change private int x to protected int x D.change private int x to final int x 5:Which of the following statements are not legal? A.long l = 4990; B.int i = 4L; C.double d = 34.4; D.double t = 0.9F. 6:鉴于Java的特点,它最适合的计算环境是 A.并行计算环境 B.分布式计算环境 C.高强度计算环境 D.开放式计算环境 7:What is written to the standard output given the following statement:System.out.println(4|7); Select the right answer: A.4 B.5 C.6 D.7 8: 1. public class X { 2. public object m () { 3. object o = new float (3.14F); 4. object [] oa = new object [1]; 5. oa[0]= o; 6. o = null; 7. oa[0] = null; 8.return o; 9. } 10.} When is the float object created in line 3, eligible for garbage collection? 1. public class X { 2. public object m () { 3. object o = new float (3.14F); 4. object [] oa = new object [1]; 5. oa[0]= o; 6. o = null; 7. oa[0] = null; 8.return o; 9. } 10.} When is the float object created in line 3, eligible for garbage collection? A.Just after line 5 B.Just after line 6 C.Just after line 7 D.Just after line 8(that is, as the method returns) 9: Consider the class hierarchy shown below: -------------------------------------------------------------------- class FourWheeler implements DrivingUtilities class Car extends FourWheeler class Truck extends FourWheeler class Bus extends FourWheeler class Crane extends FourWheeler ---------------------------------------------------------------------- Consider the following code below: 1.DrivingUtilities du; 2.FourWheeler fw; 3.Truck myTruck = new Truck(); 4.du = (DrivingUtilities)myTruck; 5.fw = new Crane(); 6.fw = du; Which of the statements below are true? Choices: A.Line 4 will not compile because an interface cannot refer to an object. B.The code will compile and run. C.The code will not compile without an explicit cast at line 6, because going down the hierarchy without casting is not allowed. D.The code will compile if we put an explicit cast at line 6 but will throw an exception at runtime. 10: Give the following method: public void method( ){ String a,b; a=new String(“hello world”); b=new String(“game over”); System.out.println(a+b+”ok”); a=null; a=b; System.out.println(a); } In the absence of compiler optimization, which is the earliest point the object a refered is definitel y elibile to be garbage collection. Give the following method: public void method( ){ String a,b; a=new String(“hello world”); b=new String(“game over”); System.out.println(a+b+”ok”); a=null; a=b; System.out.println(a); } In the absence of compiler optimization, which is the earliest point the object a refered is definitely elibile to be garbage collection. A.before line 5 B.before line 6 C.before line 7 D.before line 9 11: What will happen when you attempt to compile and run the following code? public class Static { static { int x = 5; } static int x,y; public static void main(String args[]) { x--; myMethod(); System.out.println(x + y + ++x); } public static void myMethod() { y = x++ + ++x; } } Choices: What will happen when you attempt to compile and run the following code? public class Static { static { int x = 5; } static int x,y; public static void main(String args[]) { x--; myMethod(); System.out.println(x + y + ++x); } public static void myMethod() { y = x++ + ++x; } } Choices: A.prints : 2 B.prints : 3 C.prints : 7 D.prints : 8 12: What will be the result of executing the following code? public static void main(String args[]) { char digit = 'a'; for (int i = 0; i < 10; i++) { switch (digit) { case 'x' : { int j = 0; System.out.println(j); } default : { int j = 100; System.out.println(j); } } } int i = j; System.out.println(i); } Choices: What will be the result of executing the following code? public static void main(String args[]) { char digit = 'a'; for (int i = 0; i < 10; i++) { switch (digit) { case 'x' : { int j = 0; System.out.println(j); } default : { int j = 100; System.out.println(j); } } } int i = j; System.out.println(i); } Choices: A.100 will be printed 11 times. B.The code will not compile because the variable i cannot be declared twice within the main() method. C.The code will not compile because the variable j cannot be declared twice within the switch statement. D.None of these. 13:软件生命周期的瀑布模型把软件项目分为3个阶段、8个子阶段,以下哪一个是正常的开 发顺序? A.计划阶段、开发阶段、运行阶段 B.阶段、开发阶段、编码阶段 C.设计阶段、编码阶段、维护阶段 D.计划阶段、编码阶段、测试阶段 14:设有变量说明语句int a=1,b=0; 则执行以下程序段的输出结果为( )。 switch (a) { case 1: switch (b) { case 0:printf("**0**");break; case 1:printf("**1**");break; } case 2:printf("**2**");break; } printf("\n"); A.**0** B.**0****2** C.**0****1****2** D.有语法错误 15: What will happen when you attempt to compile and run the following code? class Base { int i = 99; public void amethod() { System.out.println("Base.amethod()"); } Base() { amethod(); } } public class Derived extends Base { int i = -1; public static void main(String argv[]) { Base b = new Derived(); System.out.println(b.i); b.amethod(); } public void amethod() { System.out.println("Derived.amethod()"); } } Choices: What will happen when you attempt to compile and run the following code? class Base { int i = 99; public void amethod() { System.out.println("Base.amethod()"); } Base() { amethod(); } } public class Derived extends Base { int i = -1; public static void main(String argv[]) { Base b = new Derived(); System.out.println(b.i); b.amethod(); } public void amethod() { System.out.println("Derived.amethod()"); } } Choices: A.Derived.amethod() -1 Derived.amethod() B.Derived.amethod() 99 C.Compile time error D.Derived.amethod() 简答题 16:写一个方法,删除JAVA源文件中的注释, 17:是否可以继承String类? 18:写一个程序做低于256位整数的运算,并有如下输出: 比如输入: 12,23 输出: 12 *23 ------ 36 24 ------ 276 19:abstract class Name { private String name; public abstract boolean isStupidName(String name) {} } 这有何错误? 20:hibernate有那些抓取策略, 21:请问你在什么情况下会在你的JAVA代码中使用可序列化,为什么放到HttpSession中的对象必须要是可序列化的, 22:说明Jsp中errorPage的作用,应用范围。 23:Overload和Override的区别。Overloaded的方法是否可以改变返回值的类型? 24:两个对象值相同(x.equals(y) == true),但却可有不同的hash code,这句话对不对? 25:耶稣有13个门徒,其中有一个就是出卖耶稣的叛徒,请用排除法找出这位叛徒:13人围坐一圈,从第一个开始报号:1,2,3,1,2,3……,凡是报到“3”就退出圈子,最后留在圈内的人就是出卖耶稣的叛徒,请找出它原来的序号。
/
本文档为【北京达内科技有限公司 Java培训讲师】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索