中国民航信息网络股份有限公司JAVA面试题和笔试题
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1、jsp有哪些内置对象?作用分别是什么? 2、jsp有哪些动作?作用分别是什么? 3、JSP中动态INCLUDE与静态INCLUDE的区别? 4、Servlet的生命周期? 5、请写一个最基本的Servlet类 6、用JAVA实现一种排序?
按照覆盖的地理范围,计算机网络可以分为______、______和______。 【答案】:局域网、城域网、广域网 ISO/OSI参考模型将网络分为______层、______层、______层、______层、______层、______ 层和______层。 【答案】:物理、数据链路、网络、传输、会话、表示、应用 建立计算机网络的主要目的是:________。 【答案】:资源共享和在线通信 (4)最基本的网络拓扑结构有三种,他们是________、________和________。 【答案】:总线型、环形、星形 (5)以太网使用________介质访问控制方法,而FDDI则使用________介质访问控制方法。 【答案】:CSMA/CD、令牌环 (6)在将计算机与10BASE-T集线器进行连接时,UTP电缆的长度不能大于________米。在将 计算机与100BASE-TX集线器进行连接时,UTP电缆的长 度不能大于________米。 【答案】:100、100 (7)非屏蔽双绞线由________对导线组成,10BASE-T用其中的________对进行数据传输, 100BASE-TX用其中的________对进行数据传输。 【答案】:4、2、2
12. } 13. } Which statement is true? A. The Mycircle class is fully encapsulated(完全封装). B. √The diameter of a given MyCircle is guaranteed to be twice its radius. C. Lines 6 and 7 should be in a synchronBiblioteka Baiduzed block to ensure encapsulation. D. The radius of a MyCircle object can be set without affecting its diameter.
QUESTION NO: 27 Exhibit: 1. public class Mycircle { 2. public double radius; 3. public double diameter; 4. 5. public void setRadius(double radius) 6. this.radius = radius; 7. this.diameter= radius * 2; 8. } 9. 10. public double getRadius() { 11. return radius;
QUESTION NO: 4 Given: 1. interface Animal { 2. void soundOff(); 3. } 4. 5. class Elephant implements Animal { 6. public void soundOff() { 7. System.out.println(“Trumpet”); 8. } 9. } 10. 11. class Lion implements Animal { 12. public void soundOff() { 13. System.out.println(“Roar”); 14. } 15. } 16. 17. class Alpha1 { 18. static Animal get( String choice ) { 19. if ( choice.equalsIgnoreCase( “meat eater” )) { 20. return new Lion(); 21. } else { 22. return new Elephant();
QUESTION NO: 24 Which two are valid declarations of a float? (Choose two) A. √ float f = 1F; B. float f = 1.0.; C. √float f = ‘1’; D. float f = “1”; E. float f = 1.0d;
B. √ Compilation fails. C. The code runs with no output. D. An exception is thrown at runtime.
QUESTION NO: 23 Given: 1. // Point X 2. public class foo { 3. public static void main(String[] args) throws Exception { 4. jave.io.PrintWriter out = new jave.io.PrintWriter( 5. new jave.io.OutputStreamWriter(System.out), true); 6. out.println(“Hello”); 7. } 8. } Which statement at Point X on line 1 is required to allow this code to compile? A. √ No statement is required. B. import jave.io.*; C. include java.io.*; D. import jave.io.PrintWriter; E. include java.io.PrintWriter;
QUESTION NO: 4 1. public class Delta { 2. static boolean foo(char c) { 3. System.out.print(c); 4. return true; 5. } 6. public static void main( String[] argv ) { 7. int i =0; 8. for ( foo(‘A’); foo(‘B’)&&(i<2); foo(‘C’)){ 9. i++ ; 10. foo(‘D’); 12. } 13. } 14. }
QUESTION NO: 16 Given: 1. interface Beta {} 2. 3. class Alpha implements Beta { 4. String testIt() { 5. return “Tested”; 6. } 7. } 8. 9. public class Main1 { 10. static Beta getIt() { 11. return new Alpha(); 12. } 13. public static void main( String[] args ) { 14. Beta b = getIt(); 15. System.out.println( b.testIt() ); 16. } 17. } What is the result? A. Tested
9. } 10. finally { 11. System.out.print(“C”); 12. } 13. System.out.print(“D”); 14. } 15. public static void badMethod() {} 17. } What is the result? ACD
QUESTION NO:14 Given: 1. public class OuterClass { 2. private double d1 = 1.0; 3. // insert code here 4. } Which two are valid if inserted at line 3? (Choose two) A. static class InnerOne { public double methoda() { return d1; } } B. static class InnerOne { static double methoda() { return d1; } } C. √ private class InnerOne { public double methoda() { return d1; } } D. protected class InnerOne { static double methoda() { return d1; } } E. √ public abstract class InnerOne { public abstract double methoda(); }
18. output += “4”; 19. } 20. 21. public static void main(String args[]) { 22. foo(0); 134 23. foo(1);23 24. 25. } 26. } What is the value of the variable output at line 23? 13423
QUESTION NO: 10 Given: 11. String a = “ABCD”; 12. String b = a.toLowerCase(); 13. b.replace(‘a’, ‘d’); 14. b.replace(‘b’, ‘c’); 15. System.out.println(b); What is the result? abcd 问答
23. } 24. } 25. } Which compiles? A. new Animal().soundOff(); B. Elephant e = new Alpha1(); C. Lion 1 = Alpha.get(“meat eater”); D. √new Alpha1().get(“veggie”).soundOff();
What is the result? ABDCBDCB
QUESTION NO: 6 Given: 1. public class Test { 2. public static String output =””; 3. 4. public static void foo(int i) { 5. try { 6. if(i==1) { 7. throw new Exception(); 8. } 9. output += “1”; 10. } 11. catch(Exception e) { 12. output += “2”; 13. return; 14. } 15. finally { 16. output += “3”; 17. }
QUESTION NO: 7 1. class Super { 2. public float getNum() { return 3.0f; } 3. } 4. 5. public class Sub extends Super {. 7. } Which method, placed at line6, causes compilation to fail? A. √ public void getNum() { } B. public void getNum(double d) { } C. public float getNum() { return 4.0f; } D. public double getNum(float d) { return 4.0d; }
QUESTION NO: 7 Given: 1. public class X { 2. public static void main(String [] args) { 3. try { 4. badMethod(); 5. System.out.print(“A”); 6. } 7. catch (Exception ex) { 8. System.out.print(“B”);