Cheap Web Hosting | Free Web Hosting | Dedicated Server | Windows Hosting | Free Web Space | Web Hosting | FrontPage | Business Web Hosting
cheap web hosting
Search the Web

<% @ language=VBScript%> <% Option Explicit Dim strUnique strUnique="Hits" & Request.ServerVariables("SCRIPT_NAME") Application.Lock If isEmpty(Application(strUnique)) Then Application(strUnique) = 0 End If Application(strUnique) = Application(strUnique) + 1 Application.UnLock %> Mock Exam2

Mock Exam 2

Give your feedback at response_me@email.com


	Q1.What will be the result of compiling and running the given program?
	Select one correct answer.

	  1. public class Q1 
	  2. {
	  3. 	public static void main(String[] args) 
	  4.	{
	  5. 	   boolean t1 = true, t2 = false, t3 = t1; 
	  6.	   boolean t = false; 
	  7. 	   t &&= (t1 || ( t2 && t3)); 
	  8.  	   System.out.println("boolean t = "+t); 
	  9.    } 
	  10.}
    1. Compile time error at the line no. 5 as you can't intialize t3 with t1 in same line.
    2. Program compiles correctly and print "boolean t = false" when executed.
    3. Compile time error at the line no. 7.
    4. Program compiles correctly and print "boolean t = true" when executed.

	Q2.What will be the result of compiling and running the given program?
	Select one correct answer.
		
	  1.  public class Q2 
	  2.  {
	  3.    public static void main(String[] args) 
	  4.    { 
	  5.  	   int[] a; 
	  6.       a = new int[0]; 
	  7.       call(a); 
	  8.       System.out.println(a.length+" , "+a[0]); 
	  9.    } 
	  10.   static void call(int[] a)
	  11.   { 
	  12.      int[] b = {4,5,6}; 
	  13. 	   a = b; 
	  14. 	   a = new int[6]; 
	  15.   } 
	  16. } 
      1. Compile time error.
      2. Run time error.
      3. Program compiles correctly and print "3,4" when executed.
      4. Program compiles correctly and print "6,0" when executed.
      5. Program compiles correctly and print "0,0" when executed.

	Q3.Which of the given choices are true?Select any two.

	  1. public class Q3 
	  2. {
	  3.    public static void main(String[] args) 
	  4.    {
	  5.       long l = 2; 
	  6.       int l1 = 2; 
	  7.       long i = l1 >> 33; 
	  8.       int i1 = l1 >> 33; 
	  9.       long i2 = l >> 33; 
 	  10.      if ( i = = i2) 
	  11.         System.out.println("equal"); 
	  12.      else 
	  13.         System.out.println("not equal"); 
	  14. 
	  15.      if ( i = = i1) 
	  16.         System.out.println("equal"); 
	  17.      else 
	  18.         System.out.println("not equal"); 
	  19.    } 
	  20. } 
      1. "i = = i2" will print not equal.
      2. "i = = i2" will print equal.
      3. "i = = i1" will print equal.
      4. "i = = i1" will print not equal.

	Q4.What will be the result of compiling and running the given program?
	Select one correct answer.
	
	  1.  public class Q4
	  2.  { 
	  3.     public static void main(String[] args) 
	  4.     {
	  5.         double d = Integer.MAX_VALUE; 
	  6.   	     float f= Integer.MAX_VALUE; 
	  7.  	     if (f == d) 
	  8.            System.out.println("equal"); 
	  9.         else 
	  10.  	        System.out.println(" not equal "); 
	  11.    } 
	  12.  } 
      1. Compile time error.
      2. Program compiles correctly and print "equal" when executed.
      3. Program compiles correctly and print "not equal" when executed.
      4. Run time error.
  

	Q5.What will be the result of compiling and running the given program?Select any two.
	
	  1.  public class Q5
	  2.  {
	  3.     public static void main(String[] args)
	  4.     { 
	  5.        int a[] = {4,5,9,8,6,6,0}; 
	  6.        int i=1; 
	  7.        a[i] = i+= a[i++]; 
	  8.        System.out.println(a[i]);  
	  9.        System.out.println(i); 
	  10.    } 
 	  11. } 
      1. Line number 8 will print 6.
      2. Line number 8 will print 0.
      3. Line number 9 will print 9.
      4. Line number 9 will print 6.

	Q6.What will be the result of compiling and running the given program?
	Select one correct answer.
	
	  1.  public class Q6
	  2.  {
	  3.     public static void main(String[] args) 
	  4.     {
	  5.        int a=1,b=2,c=3; 
	  6.        a=b=c; 
	  7.        boolean bool; 
	  8.        bool = a = = b = = c; 
	  9.        System.out.println(a+b+c+" , "+bool); 
	  10.    } 
	  11. }
      1. 9 , false
      2. 9 , true
      3. Compiler Error at line 8
      4. Compiler Error at line 6

	Q7.What will be the result of compiling and running the given program?
	Select one correct answer.

	  1. public class Q7 
	  2. {
	  3.    public static void main(String[] args) 
	  4.    {
	  5.       int i=5; 
	  6.       System.out.println(i%-0.0); 
 	  7.    } 
	  8.  } 
      1. NaN
      2. Infinity
      3. -Infinity
      4. 0.0
      5. Runtime error at line number 6.

 	Q8.Which of the following are not legal declarations in a class?. 
	   Select two correct answers. 
      1. synchronized native void method();
      2. final native void method();
      3. abstract native void method();
      4. transient volatile final int i;

	Q9.Which one of the following are valid declaration of switch statements?Select any two.
      1. int x; switch( x = 5){ }
      2. switch(int x = 5){ }
      3. int x; switch( x = 5){ break; }
      4. int x; switch (x=5){ default: }

	Q10.What will be the result of compiling and running the given program?
	Select one correct answer.

	  1.  public class Q10 
	  2.  { 
	  3.     public static void main(String[] args) 
	  4.     {
	  5.        int i=3; 
	  6.        System.out.println(i*=2 + i++); 
 	  7.     } 
	  8.  } 
    1. Program compiles correctly and prints 7 when executed.
    2. Program compiles correctly and prints 11 when executed.
    3. Program compiles correctly and prints 15 when executed.
    4. None of above.
 

 	Q11.What will be the result of compiling and running the given program?
	Select one correct answer.
 	  1. public class Q11 
	  2. {
	  3.    static int i=4; 
	  4.    Q11()
	  5.    {
	  6.       i=i++;
	  7.    } 
	  8.    void Q11()
	  9.    { 
	  10.      this(); 
	  11.      System.out.println(i); 	
	  12.   }  
	  13.   public static void main(String args)
	  14.   { 
	  15.      Q11 q1 = new Q11(); 
	  16.      q1.Q11(); 
	  17.   }
	  18. }
      1. Program compiles correctly and prints 5 when executed.
      2. Program compiles correctly and prints 6 when executed.
      3. Compile time error at line number 10.
      4. Compile time error at line number 8.

 	Q12.What will be the result of compiling and running the given program?
	Select one correct answer.

  	  1.  public class Q12 
	  2.  {
	  3.     public static void main(String[] args) 
	  4.     {
	  5.        char x='1'; 
	  6.        switch (x) 
	  7.        {
	  8.           default: 
	  9.                     System.out.println("default"); 
	  10.          case 1: 
	  11.                    System.out.println("case 1"); 
	  12.          case 2: 
	  13.                    System.out.println("case 2"); 
	  14.                    break; 
	  15.       } 
	  16.    } 
	  17.  } 
      1. Compile time error as explicit cast needed to convert case constants from int to char.
      2. Run time erroras explicit cast needed to convert case constants from int to char.
      3. Program compiles correctly and prints "case 1" and "case 2" when executed.
      4. Program compiles correctly and prints "case 1" when executed.
      5. None of above.

 	Q13.What will be the result of compiling and running the given program?
	Select one correct answer.
	
	  1. public class Q13 
	  2. {
	  3.    static int call(int x) 
	  4.    {
	  5.       try 
	  6.       {
	  7.          System.out.println(x---x/0); 
	  8.          return x--;  
	  9.       }
	  10.      catch(Exception e)
	  11.      { 
	  12.         System.out.println(--x-x%0); 
	  13.         return x--; 
	  14.      } 
	  15.      finally
	  16.      { 
	  17.         return x--;
	  18.      }
	  19.   }
	  20.   public static void main(String[] args)
	  21.   {
	  22.      System.out.println(" value = "+ call(5)); 
	  23.   } 
	  24. } 
      1. Compile time error.
      2. Run time error.
      3. Program compiles correctly and prints 4 when executed.
      4. Program compiles correctly and prints 3 when executed.

 	Q14.What will be the result of compiling and running the given program?
	Select one correct answer.

	  1. public class Q14 
	  2. {
	  3.    public static void main(String[] args)throws Exception 
	  4.    {
	  5.       RuntimeException re = null; 
	  6.       try 
	  7.       {
	  8.          throw re;  
	  9.       }
	  10.      catch(Exception e)
	  11.      {
	  12.         throw e;  
	  13.      }
	  14.      finally
	  15.      { 
	  16.         throw re;  
	  17.      } 
	  18.   }
	  19. } 
      1. java.lang.NullPointerException will be thrown.
      2. java.lang.RuntimeException will be thrown..
      3. Compile time error at line number 8.
      4. Compile time error at line number 12.
      5. Compile time error at line number 16.

	Q15.What will happen if I save,compile and run the bellow code as Q15.java?
	    Select one correct answer.

	  1.  class superclass 
	  2.  {
	  3.     public static void main(String[] args) 
	  4.     {
	  5.        System.out.println("Hello"); 
	  6.     } 
	  7.  } 
	  8.  class Q15 extends superclass 
	  9.  { 
	  10. } 
      1. Program compiles correctly and prints Hello when executed.
      2. Program compiles correctly and give no output.
      3. Program compiles correctly but give run time error.
      4. Compile time error at line 1.
      5. Compile time error at line 11.

 	Q16.What will be the result of compiling and running the given program?
	Select one correct answer.
 	  1. interface I1 {} 
	  2. interface I2 {} 
	  3. class A implements I2{} 
	  4. class Q16 extends A implements I1   
	  5. {
	  6.    public static void main(String[] args)
	  7.    {     
	  8.       A a = new Q16(); 
	  9.       I2 i2 = a; 
	  10.      I1 i1 = (I1)a; 
	  11.   }
	  12. } 
      1. Compile time error at line number 9.
      2. Runtime time error at line number 9.
      3. Runtime error at line number 10.
      4. Program compiles and runs without any error.
  	

 	Q17.What will be the result of compiling and running the given program?
	    Select one correct answer.
	  1.  interface I1 {} 
	  2.  interface I2 extends I1{}
	  3.  class A implements I2{}
	  4.  class Q17 implements I2 extends A
 	  5.  { 
	  6.     public static void main(String[] args)
	  7.     {
	  8.        Q17 q =new Q17(); 
	  9.        I1 i1 = q; 
	  10.    }	
 	  11. }
      1. Compile time error at line number 9.
      2. Runtime error at line number 9.
      3. Program will compile and run correctly.
      4. None of above.

 	Q18.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1.  class superclass 
	  2.  {
	  3.     void method1(int i){} 
	  4.     void method2(final int j){} 
	  5.     void method3(){}  
	  6.  }
	  7.  class Q18 extends superclass implements Runnable 
	  8.  {
	  9.      void method1(final int i){} 
	  10.     void method2(int j) throws ArithmeticException{} 
	  11.     void method3() throws InterruptedException{} 
	  12.     synchronized void run() throws NullPointerException{} 
	  13. }
      1. Compile time errors at line number 11 and 12.
      2. Compile time errors at line number 4 and 10.
      3. Compile time errors at line number 3 and 9.
      4. Program will compile correctly.

 	Q19.What will be the result of compiling and running the given program?
	    Select one correct answer.
	  1.  class Q19 
	  2.  {
	  3.      private static int increase(int i)
	  4.      { 
	  5.         return i++; 
	  6.      }
	  7.      public Q19()
	  8.      {
	  9.         i = increase(1);  
	  10.     }
	  11.     { 
	  12.        i = increase(1); 
	  13.     } 
	  14.     static int i = increase(1); 
	  15.     public static void main(String[] args) 
	  16.     {
	  17.        System.out.println(i=increase(i)); 
	  18.     } 
	  19.  } 
      1. Compile time error at line 9 as forward referencing is not allowed.
      2. Compile time error at line 12 instant intializer block cannot access a static method.
      3. Program will compile correctly and print 1 when executed.
      4. Program will compile correctly and print 4 when executed.
      5. Compile time error at line 17 as you can not use = in the print statement.

	Q20.Which of the given choices can make the program compiles and run without any error?
	    Select any two.
	  1.  interface I1 {} 
	  2.  class A {} 
	  3.  class Q20  extends A implements I1 
 	  4.  { 
 	  5.     public static void main(String[] args)
	  6.     {
	  7. 		Q20 q = new Q20(); 	   	
	  8.		A a =new A(); 
	  9.		I1 i1 = (I1)a; //This line is giving ClassCastException.
	  10.    }	
 	  11. }
      1. Replace the statement at line number 9 with the statement "I1 i1 = a".
      2. Replace the statement at line number 8 with the statement "A a = q;".
      3. Replace the statement at line number 8 with the statement "A a = new Q20();".
      4. Completly remove the statement at line number 8.

 	Q21.What will be the result of compiling and running the given program?
	Select one correct answer.
	  1.  interface I1 {} 
	  2.  class A {} 
	  3.  class Q21  extends A implements I1 
 	  4.  { 
 	  5.     public static void main(String[] args)
	  6.     {
	  7. 		Q21 q = new Q21(); 	   	
	  8.		A a =null; 
	  9.		I1 i1 = (I1)a; 
	  10.    }	
 	  11. }
      1. Program compiles and run without any error.
      2. Program compiles correctly but give NullPointerException when excuted.
      3. Compile time error at line number 8.
      4. Compile time error at line number 9.

 	Q22.Which method is used to make the thread eligible for running?
	    Select one correct answer.
      1. run()
      2. start()
      3. notify()
      4. resume()

 	Q23.What is the default priority of a thread?Select one correct answer.
      1. Depends upon Operating System.
      2. The default priority is 1.
      3. The default priority is 5.
      4. The default priority is 10.

 	Q24.What will be the result of compiling and running the given program?
	Select one correct answer.
	  1. class Q24 
	  2. {
	  3.    public static void main(String[] args) 
	  4.    {
	  5.       StringBuffer str =new StringBuffer("Hello"); 
   	  6.       String str1 = new String(str); 
  	  7.       if (str.equals(str1))
	  8.          System.out.println("true"); 
	  9.       else 
	  10.         System.out.println("false"); 
	  11.   } 
	  12.}
      1. Program compiles correctly and prints true when executed.
      2. Program compiles correctly and prints false when executed.
      3. Compile time error at line number 7.
      4. Runtime error at line number 7.

  	Q25.What will be the result of compiling and running the given program?
    	Select one correct answer.

	    1. class Q25
	    2. {
	    3.     public static void main(String[] args) 
	    4.     {
	    5.         Boolean bool1 = new Boolean("Wrong");  
	    6.         Boolean bool2 = new Boolean("True"); 
	    7.         System.out.println(bool1.toString()); 
	    8.         System.out.println(bool2.toString()); 
	    9.     }
	    10.} 
      1. Program compiles correctly and prints false and true when executed.
      2. Program compiles correctly and prints Wrong and True when executed.
      3. Compile time error at line number 5.
      4. Runtime error at line number 5.

 	Q26.What will be the value of st after line no.14?Enter your answer in the given field.
	    Don't use any extra signs like ("")quotes or any string like "st=".For example,
	    if your answer is the string "XYZ" you just write XYZ

	    1.  class Q26
	    2.  { 
	    3.     public static void main(String[] args)
	    4.     { 
	    5.         String str = new String("Hello"),st=""; 
	    6.         if (str.substring(0) == str) 
	    7.             st+="A"; 
	    8.         else 
	    9.             st+="B"; 
	    10.        if (str.replace('k','j') == str) 
	    11.            st+="C"; 
	    12.        else 
	    13.            st+="D";
	    14.        System.out.println(st);
	    15.    } 
	    16. } 

(Note:This is the same way of doing entry as it is in real exam, you have to take care of above assumption while doing entry in a text field)


 	Q27.Which of the following regarding garbage collection are true?
 	    Select any two.
      1. Given,b1 = b2. If b2 is eligible for garbage collection, then b1 is also eligible for garbage collection.
      2. An object will be garbage collected immediately after the last reference to the object is removed.
      3. Once an object has become eligible for garbage collection, it will remain so until it is destroyed.
      4. You cannot force garbage collection.

  	Q28.What will be the result of compiling and running the given program?
    	Select one correct answer.

	  1.  class Q28
	  2.  { 
	  3.     public static void main(String[] args)
	  4.     { 
	  5.         System.out.println(Math.ceil(-0.5)+"/"+Math.floor(-0.5)); 
	  6.     } 
	  7.  } 
      1. Program compiles correctly and prints -0.0/-1.0 when executed.
      2. Program compiles correctly and prints -1.0/0.0 when executed.
      3. Program compiles correctly and prints -1.0/-0.0 when executed.
      4. Program compiles correctly and prints 0.0/-1.0 when executed.

 	Q29.Which of the following collection implementations are thread safe?
  	    Select any two.
      1. HashMap
      2. Vector
      3. Hashtable
      4. LinkedList

 	Q30.What is the default number of rows visible in a List?
	Select one correct answer.
      1. 1
      2. 2
      3. 3
      4. 4

 	Q31.Which interface is implemented by the MouseMotionAdapter class?
	Select one correct answer.
      1. MouseListener
      2. MouseMotionListener
      3. MouseEvent
      4. MouseMotionEvent

 	Q32.What will be the result of compiling and running the given program?
	Select one correct answer.
	  1. class Q32
	  2. { 
	  3.    public static void main(String[] args)
	  4.    { 
 	  5.       Frame f = new Frame("My frame"); 
	  6.       f.setLayout(new GridBagLayout()); 
	  7.       GridBagConstraints gbc = new GridBagConstraints(); 
	  8.       f.add(new Button("B1")); 
	  9.       f.add(new Button("B2")); 
	  10.      f.setSize(400,400); 
	  11.      f.setVisible(true); 
	  12.   } 
	  13. }
      1. Only the button B2 will appear covering the whole frame.
      2. Both the button B1 and B2 will appear side by side covering the whole frame.
      3. Both the button B1 and B2 will appear with thier actual size placed in the top left area of the frame.
      4. Both the button B1 and B2 will appear with thier actual size placed in the center of the frame.
      5. None of above.

 	Q33.Name the component whose prefered size is honoured by BorderLayout?
	    Select one correct answer.
      1. Choice
      2. TextArea
      3. Checkbox
      4. It is not possible to do so using BorderLayout.Only either one dimension can be honoured.

 	Q34.Which of the following are valid constructors of IO stream classes?
	    Select one correct answer.
      1. DataInputStream dis = new DataInputStream(new File("test.txt"));
      2. DataOutputStream dos = new OutputStream(new FileInputStream("test.txt"));
      3. OutputStream os = new BufferedOutputStream(new FileOutputStream("test.txt"));
      4. FileInputStream fs = new FileInputStream("C:\test","test.txt");

	Q35.Which of the following are valid constructors of IO classes?
	    Select one correct answer.
      1. PrintWriter pw = new PrintWriter(new File("test.txt"),true);
      2. InputStreamReader isr = new InputStreamReader(new File("test.txt"));
      3. BufferedWriterr br = new BufferedWriter(new PrintInputStream(System.out));
      4. BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

 	Q36.What will be the result of compiling and running the given program?
	Select one correct answer.

	  1.  class Q36 extends Thread 
	  2.  {
	  3.     public void run() 
	  4.     {
	  5.        System.out.println("Hello");  
	  6.     }
	  7.     public static void main(String[] args)
	  8.     { 
	  9.        Runnable r = new Q36(); 
	  10.       Thread t = new Thread(r); 
	  11.       t.run(); 
	  12.    }
	  13.  }
      1. Compile time error at line number 9.
      2. Program compiles correctly and prints Hello when executed.
      3. Runtime error at line number 9
      4. None of above.

 	Q37.What will be the result of compiling and running the given program?
	   Select one correct answer.

	  1.  class Q37
	  2.  { 
	  3.     public static void main(String[] args)
	  4.     { 
	  5.        String s1 = null; 
	  6.        String s2 = null; 
	  7.        if (s1 == s2) 
	  8.  	       System.out.print("A"); 
	  9.        else 
	  10.          System.out.print("B"); 
	  11.       if (s1 .equals(s2)) 
	  12.          System.out.print("C"); 
	  13.       else 
	  14.          System.out.print("D"); 
	  15.     } 
	  16.  }
      1. Program will compile correctly and print A and D when executed.
      2. Program will compile correctly and print A and C when executed.
      3. Program will compile correctly and print B and D when executed.
      4. Compile time error.
      5. Runtime error.

 	Q38.Which of the following about inner classes are true?Select any two.
      1. When an anonymous class implements an interface it extends Object class implicitly.
      2. An anonymous class can implement any number of interface.
      3. An anonymous class cannot have constructors
      4. An anonymous class can be both an explicit subclass and implement an interface.

  	Q39.What will be the result of compiling and running the given program?
	   Select one correct answer.

	  1. public class Q39
	  2. { 
	  3.    public static void main(String args[]) 
	  4.    {
	  5.       int x = 10;
	  6.       final int y;
	  7.       if(x++ > 10) 
	  8.          y = 1;
	  9.       else
	  10.         y = 2;
	  11.      System.out.println("y is " + y);
	  12.   }
	  13. }
      1. Compile time error at line number 6 as y is final and must be initialized within the statement.
      2. Compile time error at line number 8 as you cannot initialize a final variable again.
      3. Compile time error at line number 10 as you cannot initialize a final variable again.
      4. Program will compile correctly and print y is 2 when executed.
      5. Program will compile correctly and print y is 1 when executed.

 	Q40.Which of the following are methods of ComponentListener?Select any two.
      1. componentHidden(....)
      2. componentAdded(....)
      3. componentShown(....)
      4. componentRemoved(....)

	Q41.Whether the following code compile or not?
 	    Select the most appropriate one answer.
	  1.  class Q41
	  2. {
	  3.     public static void main(String arg[])
	  4.     {
	  5.        final int y;
	  6.     }
	  7.  }
      1. It will not compile.
      2. It will compile.
      3. It will compile if we initalize the y in the statement at line number 5.

 	Q42.What will be the result of compiling and running the given program?
	    Select one correct answer.
	  1.  class Q42
	  2.  {
	  3.     public static void main(String args[]) 
	  4.     {
	  5.        int b='A';
	  6.        System.out.write(b);    	
	  7.     }
	  8.  }
      1. Compile time error at line number 5 as you cannot assign a char value to an int variable.
      2. Compile time error at line number 6 as there is no write() method in class System.out
      3. Program compiles correctly and prints A when executed.
      4. Program compiles correctly and give no output when executed.

  	Q43.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1. class Q43 
	  2. { 
	  3.    int y=1; 	
	  4.    Q43() 
	  5.    { 
	  6.       this(y);
	  7.    } 
	  8.    Q43(int x) 
	  9.    { 
	  10.      y=x++ + ++x;
	  11.   } 
	  12.   public static void main(String [] args) 
	  13.   { 
	  14.      Q43 t = new Q43(); 
	  15.      System.out.println(t.y);
	  16.   } 
	  17. }
      1. Program compiles correctly and prints 1 when executed.
      2. Program compiles correctly and prints 4 when executed.
      3. Compile time error.
      4. None of above.

 	Q44.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1. class Q44 
	  2. { 
	  3.    public static void main(String[] args) 
	  4.    { 
	  5.       int intNumber = 123456789; 
	  6.       float floatNumber = intNumber; 
	  7.       int x = (int)floatNumber; 
	  8.       System.out.println(intNumber - x); 
	  9.       System.out.println(intNumber == x ); 
	  10.   } 
	  11. }
      1. Prints 0 and true.
      2. Prints 0 and false.
      3. Prints some number (other than 0) and true.
      4. Prints some number (other than 0) and false.

	Q45.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1.  public class Q45
	  2.  { 
	  4.      static    	
	  5.      { 
	  6.         System.out.print("Java".startsWith("")); 
	  7.      }    
	  8.      static void processorB() 
	  9.      { 
	  10.        System.out.println(" is a boolean Operator."); 
	  11.     }    
	  12.     static Q45 processorA()
	  13.     { 
	  14.        Q45 q=null; 
	  15.        if (("java").startsWith("null")) 
	  16.           return q; 
	  17.        else 
	  18.           return null; 
	  19.     }    
	  20.     public static void main(String[] args) 
	  21.     { 
	  22.        processorA().processorB(); 
	  23.     }	 
	  24.  }
      1. Compile time error at line number 22 as you can't call processorB() like this.
      2. NullPointerException at line number 22 as processorA() will return null.
      3. Program will compile correctly and print false is a boolean operator when executed.
      4. Program will compile correctly and print true is a boolean operator when executed.

	Q46.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1. class Q46 
	  2. { 
	  3.    public static void main(String [] args) 
 	  4.    { 
  	  5.       String str = "Java"; 
  	  6.       str += "Beans"; 
   	  7.       if(str.equals("JavaBeans")) 
  	  8.          System.out.println("TRUE" ); 
 	  9.       else 
  	  10.         System.out.println("FALSE" ); 
  	  11.      if(str == "JavaBeans") 
	  12.         System.out.println("TRUE" ); 
   	  13.      else 
  	  14.         System.out.println("FALSE" );  
 	  15.   } 
	  16. }
      1. Program will compile correctly and print TRUE , TRUE when executed.
      2. Program will compile correctly and print FALSE , FALSE when executed.
      3. Program will compile correctly and print FALSE , TRUE when executed.
      4. Program will compile correctly and print TRUE , FALSE when executed.

 	Q47.Which of the following is not valid adapter class?Select one correct answer.
      1. MouseMotionAdapter
      2. KeyAdapter
      3. AdjustmentAdapter
      4. WindowAdapter

	Q48.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1. class Except extends Exception{}
	  2. public class Q48 
	  3. { 
	  4.   public static void main(String[]args) 
	  5.   { 
	  6.      try 
	  7.      { 
	  8.         System.out.println(10/0); 
	  9.      } 
	  10.     catch(Except e) 
	  11.     { 
	  12.        System.out.println("catch block"); 
	  13.     } 
	  14.  } 
	  15.} 
      1. Program will throw ArithmeticException which is not handled.
      2. Compile time error at line number 10.
      3. Compile time error at line number 8 as ArithmeticException must be caught.
      4. None of above.

 	Q49.Which of these are legal ways of accessing a File named "file.txt" for 
	    writing.Select one correct answer. 
      1. FileWriter fr = new FileWriter("file.txt");
      2. FileOutputStream fr = new FileOutputStream("file.txt","UTF8");
      3. FileWriter fr = new FileWriter("file.txt", "UTF8");
      4. OutputStreamWriter out = new OutputStreamWriter("file.txt");

 	Q50.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1.  public class Q50
	  2.  {
	  3.     public static void main(String argv[])
	  4.     {
	  5.        int x=31;
	  6.        System.out.println(  x >>> 1 + x);
	  7.        System.out.println( -x >>> 1 + x);
	  7.     }
	  8.  }
      1. Program will compile correctly and print 31,31 when executed.
      2. Program will compile correctly and print 31,-31 when executed.
      3. Program will compile correctly and print 46,2147483632 when executed.
      4. Compile time error at line number 6 and 7.

 	Q51.What is the name of collection interface used to maintain unique elements
	    in order?Select one correct answer. 
      1. Set
      2. Map
      3. SortedSet
      4. ArrayList
      5. List
 

 	Q52.What is the name of interface used to store data as key-value pairs?
	    Select one correct answer. 
      1. Map
      2. Set
      3. List
      4. ArrayList
      5. SortedSet

 	Q53.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1. class Q53
	  2. { 
	  3.   public static void main(String [] args) 
	  4.   { 
	  5.     java.lang.StringBuffer sb;
	  6.   	 sb = new java.lang.StringBuffer().append("Hello").append("World"); 
	  7.     System.out.println(sb. substring(5,10).toString()); 
	  8.   } 
	  9. }
      1. Compile time error at line number 6.
      2. Runtime error at line number 6.
      3. Program will compile correctly and print World when executed.
      4. StringIndexOutOfBoundsException at line number 7.

 	Q54.Which of the following methods can force a thread to leave the Lock(monitor)?
	    Select any two.
      1. yield()
      2. wait()
      3. sleep()
      4. start()

  	Q55.What will be the result of compiling and running the given program?
	    Select one correct answer.

	  1. class Q55 
	  2. {
	  3.    public static void main(String[] args) 
	  4.    {
	  5.       int[] a={11,12,13,14};
	  6.       int[] b={0,1,2,3};
	  7.       System.out.println(a[(a=b)[3]]); 
  	  8.    }
	  9. }
      1. Compile time error at line number 7.
      2. Runtime error at line number 7.
      3. Program will compile correctly and print 3 when executed.
      4. Program will compile correctly and print 14 when executed.

 	Q56.What will be the result of compiling and running the given program?
	    Select one correct answer.
	
	  1.  public class Q56
	  2.  {
	  3.     static boolean x;
	  4.     public static void main(String args[]) 
	  5.     {   
	  6.        int a;
	  7.        if(x) 
	  8.            a = x ? 1: 2;
	  9.        else 
	  10.           a = x ? 3: 4;
	  11.       System.out.println(a);
	  12.    }
   	  13. }
      1. Compile time error at line number 7 as x is not intialized.
      2. Compile time error at line number 11 as a may not be intialized.
      3. Program will compile correctly and print 1 when executed.
      4. Program will compile correctly and print 4 when executed.

 	Q57.What will be the result of compiling and running the given program?
	Select one correct answer.
	  1. class Q57 
	  2. { 
	  3.     public static double[] d ; 
	  4.     public static void main(String [] args) 
 	  5.     { 
	  6.        Q57 x = new Q57(); 
	  7.        x.methodA(d); 
	  8.     }  
	  9.     void methodA(double[] d1) 
 	  10.    { 
	  11.       System.out.println(d1[0]); 
 	  12.    } 
	  13. } 
      1. Compile time error at line number 7 as d is not intialized.
      2. Program compiles correctly and print 0.0 when executed.
      3. ArrayIndexOutOfBoundsException at line number 11.
      4. None of above.

 	Q58.Which of the following statement is true?Select one correct answer.
	  1. class Q58
	  2. {
	  3.    int x=0;
	  4.    final int y=0;
	  5.    private int z=0;
	  6.    void xyz()
	  7.    {
	  8.       int a=0;
	  9.       final int b=0;
	  10.      class abcd
	  11.      {		    
	  12.         abcd()
	  13.         {
	  14.             System.out.println(x);
 	  15.             System.out.println(b);
	  16.             System.out.println(a);
	  17.             System.out.println(y);
	  18.             System.out.println(z);
	  19.         }
	  20.      }
	  21.   }	
  	  22. }
      1. Compile time error at line number 14.
      2. Compile time error at line number 15.
      3. Compile time error at line number 16.
      4. Compile time error at line number 17.
      5. Compile time error at line number 18.

 	Q59.Which of the following statement can be placed at line number 8, without 
	    causing any error?Select one correct answer.
	  1. public class OuterTest
	  2. { 
	  3.    class Inner 
 	  4.    { 
	  5.    } 
	  6.    public static void main(String args[]) 
 	  7.    { 
	  8.       //Here
	  9.    }	
 	  10.} 
      1. Inner i = new Inner();
      2. OuterTest ob = new Inner();
      3. OuterTest ob = null; ob.new Inner();
      4. OuterTest ob = new OuterTest(); new ob.Inner();