《杭州天丽科技有限公司 面试 笔试题》由会员分享,可在线阅读,更多相关《杭州天丽科技有限公司 面试 笔试题(6页珍藏版)》请在金锄头文库上搜索。
1、选择题 1: 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 ext
2、ends Base 28. 29. 30. 31.int i = -1; 32. 33. 34. 35.public static void main(String argv) 36. 37. 38. 39. Base b = new Derived(); 40. 41. System.out.println(b.i); 42. 43. b.amethod(); 44. 45. 46. 47. public void amethod() 48. 49. 50. 51. System.out.println(Derived.amethod(); 52. 53. 54. 55. 56. 57.Ch
3、oices: Error! Reference source not found.A.Derived.amethod() -1 Derived.amethod() Error! Reference source not found.B.Derived.amethod() 99 Error! Reference source not found.C.Compile time error Error! Reference source not found.D.Derived.amethod() 2:使用 JDBC 可以做到的是 Error! Reference source not found.A
4、.把二进制代码传送到任何关系数据库中 Error! Reference source not found.B.把 Java 源代码传送到任何关系数据库中 Error! Reference source not found.C.把表单信息传送到任何关系数据库中 Error! Reference source not found.D.很容易地把 SQL 语句传送到任何关系数据库中 3: 1. String s=”Example String”;Which operation is not legal? Error! Reference source not found.A.int i=s.leng
5、th(); Error! Reference source not found.B.s3=”x”; Error! Reference source not found.C.String short_s=s.trim(); Error! Reference source not found.D.String t=”root”+s; 4: 1. public class X 2. 3. public Object m() 4. 5. Object o = new Float(3.14F);/line 3 6. 7. Object oa = new Object1;/line 4 8. 9. oa0
6、 = o;/line 5 10. 11. o=null;/line 6 12. 13. return oa0;/line 7 14. 15. 16. 17. 18.When is the Float object, created in line 3,eligible for garbage collection? Error! Reference source not found.A.just after line 5. Error! Reference source not found.B.just after line 6 Error! Reference source not foun
7、d.C.just after line 7(that is,as the method returns) Error! Reference source not found.D.never in this method 5:Which fragments are not correct in Java source file? Error! Reference source not found.A.package testpackage; public class Test/do something. Error! Reference source not found.B.import jav
8、a.io.*; package testpackage; public class Test/ do something. Error! Reference source not found.C.import java.io.*; class Person/ do something. public class Test/ do something. Error! Reference source not found.D.import java.io.*; import java.awt.*; public class Test/ do something. 6:在下述选项时,没有构成死循环的
9、程序是 Error! Reference source not found.A.int i=100 while (1) i=i%100+1; if (i100) break; Error! Reference source not found.B.for (;); Error! Reference source not found.C.int k=1000; do +k; while(k=10000); Error! Reference source not found.D.int s=36; while (s);-s; 7:Which is the main() method return
10、of a application? Error! Reference source not found.A.String Error! Reference source not found.B.byte Error! Reference source not found.C.char Error! Reference source not found.D.void 8:Use the operator “” and “”. Which statement is true? Error! Reference source not found.A.1010 0000 0000 0000 0000
11、0000 0000 0000 4 give 0000 1010 0000 0000 0000 0000 0000 0000 Error! Reference source not found.B.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000 Error! Reference source not found.C.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 0000 0000 0000 0000 0000 00
12、00 0000 Error! Reference source not found.D.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000 9: 1. What will happen when you attempt to compile and run the following code? 2. 3. (Assume that the code is compiled and run with assertions enabled.) 4. 5. public cla
13、ss AssertTest 6. 7. public void methodA(int i) 8. 9. assert i = 0 : methodB(); 10. 11.System.out.println(i); 12. 13. 14. 15.public void methodB() 16. 17.System.out.println(The value must not be negative); 18. 19. 20. 21.public static void main(String args) 22. 23.AssertTest test = new AssertTest();
14、24. 25.test.methodA(-10); 26. 27.28. 29. 30. Error! Reference source not found.A.it will print -10 Error! Reference source not found.B.it will result in AssertionError showing the message-“the value must not be negative”. Error! Reference source not found.C.the code will not compile. Error! Referenc
15、e source not found.D.None of these. 10: 1. The following code is entire contents of a file called Example.java,causes precisely one error during compilation: 2. class SubClass extends BaseClass 3. 4. class BaseClass() 5. String str; 6. public BaseClass() 7. System.out.println(“ok”); 8. public BaseClass(String s) 9. str=s; 10. public class Example 1