北京清软创新科技有限公司面试题 – Java开发

匿名网友 匿名网友 发布于: 2015-08-30 00:00:00
阅读 174 收藏 0 点赞 0 评论 0

选择题 
1:在软件生命周期中,下列哪个说法是不准确的? 
 A.软件生命周期分为计划、开发和运行三个阶段 
 B.在计划阶段要进行问题焉醛和需求分析 
 C.在开发后期要进行编写代码和软件测试 
 D.在运行阶段主要是进行软件维护 
2:Which fragments are not correct in Java source file? 
 A.package testpackage; public class Test{//do something...} 
 B.import java.io.*; package testpackage; public class Test{// do something...} 
 C.import java.io.*; class Person{// do something...} public class Test{// do something...} 
 D.import java.io.*; import java.awt.*; public class Test{// do something...} 
3: 
1.	What will be the result of executing the following code?    
2.	  
3.	// Filename; SuperclassX.java   
4.	  
5.	package packageX;    
6.	  
7.	public class SuperclassX   
8.	  
9.	{   
10.	  
11.	protected void superclassMethodX()   
12.	  
13.	{   
14.	  
15.	}   
16.	  
17.	int superclassVarX;   
18.	  
19.	}    
20.	  
21.	    
22.	  
23.	// Filename SubclassY.java   
24.	  
25.	1.package packageX.packageY;   
26.	  
27.	2.   
28.	  
29.	3.public class SubclassY extends SuperclassX   
30.	  
31.	4.{   
32.	  
33.	5.SuperclassX objX = new SubclassY();   
34.	  
35.	6.SubclassY objY = new SubclassY();   
36.	  
37.	7.void subclassMethodY()   
38.	  
39.	8.{   
40.	  
41.	9.objY.superclassMethodX();   
42.	  
43.	10.int i;   
44.	  
45.	11.i = objY.superclassVarX;   
46.	  
47.	12.}   
48.	  
49.	13.}    
50.	  
51.	Choices:  
 A.Compilation error at line 5 
 B.Compilation error at line 9 
 C.Runtime exception at line 11 
 D.None of these 
4: 
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);    
7.	  
8.	  4.    e.calculatePay();    
9.	  
10.	  5.    System.out.println(e.printDetails());    
11.	  
12.	  6.    e = null;    
13.	  
14.	  7.    e = new Employee("Denise", 36);    
15.	  
16.	  8.    e.calculatePay();    
17.	  
18.	  9.    System.out.println(e.printDetails());    
19.	  
20.	 10.  }    
21.	  
22.	 11.}   
23.	Only One:   
 A.Line 10 
 B.Line 11 
 C.Line 7 
 D.Line 8 
5:Which are not Java keywords? 
 A.TRUE 
 B.const 
 C.super 
 D.void 
6:Which declares for native method in a java class corrected? 
 A.public native void method(){} 
 B.public native void method(); 
 C.public native method(); 
 D.public void native method(); 
7: 
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.  
 A.before line 5 
 B.before line 6 
 C.before line 7 
 D.before line 9 
8:Which modifier should be applied to a method for the lock of object this to be obtained prior to excution any of the method body? 
 A.synchronized 
 B.abstract 
 C.final 
 D.static 
9:Which code fragments would correctly identify the number of arguments passed via command line to a Java application, exclude the name of the class that is being invoke. 
 A.int count = args.length; 
 B.int count = args.length-1; 
 C.int count=0; while(args[count]!=null) count++; 
 D.int count=0;while (!(args[count].equals(“”))) count++; 
10: 
1.	What will happen when you attempt to compile and run the following code?    
2.	  
3.	int Output = 10;   
4.	  
5.	boolean b1 = false;    
6.	  
7.	if((b1 == true) && ((Output += 10) == 20))   
8.	  
9.	{   
10.	  
11.	   System.out.println("We are equal " + Output);   
12.	  
13.	}    
14.	  
15.	else  
16.	  
17.	{   
18.	  
19.	   System.out.println("Not equal! " + Output);   
20.	  
21.	}    
22.	  
23.	Choices:  
 A.Compilation error, attempting to perform binary comparison on logical data type 
 B.Compilation and output of "We are equal 10". 
 C.Compilation and output of "Not equal! 20". 
 D.Compilation and output of "Not equal! 10". 
11:A class design requires that a particular member variable must be accessible for direct access by any subclasses of this class. but otherwise not by classes which are not members of the same package. What should be done to achieve this? 
 A.The variable should be marked public 
 B.The variable should be marked private 
 C.The variable should be marked protected 
 D.The variable should have no special access modifier 
12: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 
13:以下的C程序代码片段运行后C和d的值分别是多少 
Int a =1,b =2; 
Int c,d; 
c =(a&b)&&a; 
d =(a&&b)&a; 
 A.0,0 
 B.0,1 
 C.1,0 
 D.1,1 
14: Which of the following statements are true? 
 A.The automatic garbage collection of the JVM prevents programs from ever running out of memory 
 B.A program can suggest that garbage collection be performed and force it 
 C.Garbage collection is platform independent 
 D.An object becomes eligible for garbage collection when all references denoting it are set to null. 
15: 
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:  
 A.prints: Value is - 9 
 B.Compilation error 
 C. prints: Value is - 5 
 D.None of these 
16: 
1.	Select valid identifier of Java:  
 A.%passwd 
 B.3d_game 
 C.$charge 
 D.this 
17: 
1.	public class X{   
2.	  
3.	   public Object m(){   
4.	  
5.	      Object o = new Float(3.14F);//line 3   
6.	  
7.	      Object [] oa = new Object[1];//line 4   
8.	  
9.	      oa[0] = o;//line 5   
10.	  
11.	      o=null;//line 6   
12.	  
13.	      return oa[0];//line 7   
14.	  
15.	     }   
16.	  
17.	}   
18.	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(that is,as the method returns) 
 D.never in this method 
简答题 
18:多线程有几种实现方法,都是什么?同步有几种实现方法,都是什么? 
19:Java中异常处理有什么优点? 
20:什么是序列化?什么是反序列化?为什么要序列化对象? 
21:session和cache的区别是什么。 
22:JSP中动态INCLUDE与静态INCLUDE的区别? 
23:如何给weblogic指定大小的内存? 
24:有篇文章,找出文章中单词在词典中的序号,要求高效率.词典没排序。 
25:Collection 和 Collections的区别。 

评论列表
文章目录