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 Exam1

Mock Exam 1

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 class Q1
	  2 { 	
	  3     public static  void main(String arg[]) 	
	  4     { 		
	  5        int a[]={2,2}; 		
	  6        int b=1; 		
	  7        a[b]=b=0; 		
	  8        System.out.println(a[0]); 		
	  9        System.out.println(a[1]); 	
	  10    } 
	  11 }
    1. Compile time error at the line no. 5.
    2. Run time error at the line no. 5.
    3. Program compiles correctly and print 2,0 when executed.
    4. Program compiles correctly and print 0,2 when executed.

	Q2.What will be the result of compiling and running the given program?
	Select one correct answer.
		
	1  class Q2
	2  {
	3     public static void main(String arg[])
	4     {
	5        StringBuffer s[]={"A","B"};
	6        System.out.println(s[0]+","+s[1]);
	7     }
	8  }
      1. Program compiles correctly and print A,B when executed.
      2. Compile time error.
      3. Run time error.

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

	1 class Q3
	2 {	
	3    public static void main(String arg[])
	4    {
	5       int[] a,c,d[];
	6       int b[]=new int[0];
	7    }
	8 }

      1. All the variables a,b,c,d are arrays.
      2. Only a,d,b are arrays.
      3. We can declare an array with zero element.
      4. We cannot declare an array with zero element.

	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       boolean t1 = true, t2 = false, t3 = t1; 
 	6       boolean t = false; 
 	7       t &&= (t1 || ( t2 && t3));
 	8       System.out.println(t); 
	9    } 
	10 }
      1. Program compiles correctly and print true when executed.
      2. Program compiles correctly and print false when executed.
      3. Compile time error.
      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 rag[])
	4     {
	5        byte b=1;
	6        b++;
	7        byte b=127+1;
	8        int i=2147483647+1;
	9        b=- -b;
	10    }
	11 }

      1. Compile time error at line no. 6.
      2. Compile time error at line no. 7.
      3. Compile time error at line no. 8.
      4. Compile time error at line no. 9.

	Q6.What will be the result of compiling and running the given program?
	Select one correct answer.
	
	1 class AA{}
	2 class BB extends AA{}
	3 class Q6
	4 {
	5    public static void main(String arg[])
	6    {
	7       AA a=null;
	8       BB b=(BB)a;
	9       System.out.println(b);
	10      System.out.println(b instanceof BB);
	11      System.out.println(b instanceof AA);		
	12   }
	13 }
      1. Program compiles correctly and print null,true,false
      2. Program compiles correctly and print null,true,true.
      3. Program compiles correctly and print null,false,false
      4. Program compiles correctly and print null,false,true.
      5. Compile time error at line no.8 as null value cannot be casted.
      6. Run time error at line no. 8 as null value cannot be casted.

	Q7.Which one of the following statements will give you an Exception when 
	   placed at line no.10?Select one correct answer.

	1  class AA{}
	2  class BB extends AA{}
	3  class casting
	4  {
	5     public static void main(String arg[])
	6     {
	7       AA a=new AA();
	8       BB b=new BB();
	9       AA c=new BB();
	10      //Here		
	11    }
	11 }
      1. b = (BB) a;
      2. a = b ;
      3. b = (BB) c;
      4. c = b;

 	Q8.Which one of the following are valid character contants?Select any two.
      1. char c = '\u000d' ;
      2. char c = '\u000a';
      3. char c = '\u0000';
      4. char c = '\uface' ;

	Q9.Which one of the following are not valid character contants?Select any two.
      1. char c = '\u00001' ;
      2. char c = '\101';
      3. char c = 65;
      4. char c = '\1001' ;

 	Q10.Which will be the first line to cause an error in the following code?
	Select one correct answer.

	1 class Char
	2 {
	3    public static void main(String arg[])
	4    {
	5       char c1,c2;
	6       c1='A';
	7       c1++;
	8       c1+=1;
	9       c1=c1+1;
	10      c2='B';
	11      c2--;
	12      c2=c2-1;	
	13   }
	14 }
      1. Line no. 7
      2. Line no. 8
      3. Line no. 9
      4. None of above.

 	Q11.What will be the result of compiling and running the given program?
	Select one correct answer.
 	1  public class Child extends Parent 
	2  {
	3     public static int test(int i) 
	4     { 
	5        return 20; 
 	6     }
	7     public static void main(String[] args) 
	8     { 
	9        Parent c = new Child(); 
	10       System.out.println(c.test(10)); 
	11    } 
	12 }
	13 class Parent 
	14 { 
	15    public static int test(int i) 
	16    { 
	17       return 5; 
	18    } 
	19 }
	
      1. Compile time as we can't overide static methods
      2. Run time error as we can't overide static methods
      3. Program compiles correctly and prints 5 when executed.
      4. Program compiles correctly and prints 20 when executed.

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

	1  public class Q12
	2  { 
	3     String str;
	4     public static void main(String[] args) 
	5     {
	6        Q12 a = new Q12();
	7        a.append("B");
	8        a.append("C"); 
	9        System.out.println(a.str);
	10    } 
	11    void append(String s)
	12    {
	13        str+=s;
	14    }
	15 } 
      1. Compile time error as "append" is a reserved name.
      2. Compile time error as str may not be initialized.
      3. Run time error as str may not be initialized.
      4. Program compiles correctly and prints BC when executed.
      5. None of above.

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

	1  class sample
	2  {
	3     sample(String s)
	4     {
	5        System.out.println("String");
	6     }
	7     sample(Object o)
	8     {
	9     	 System.out.println("Object");
	10    }
	11 }
	12 class constructor
	13 {
	14    public static void main(String arg[])
	15    {
	16  	 sample s1=new sample(null);
	17    }
	18 }
      1. Compile time error as call to constructor at line no. 16 is ambigious.
      2. Run time error as call to constructor at line no. 16 is ambigious.
      3. Program compiles correctly and prints "object" when executed.
      4. Program compiles correctly and prints "string" when executed.

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

	1  class sample
	2  {
	3     sample(String s)
	4     {
	5        System.out.println("String");
	6     }
	7     sample(StringBuffer sb)
	8     {
	9     	 System.out.println("StringBuffer");
	10    }
	11 }
	12 class constructor
	13 {
	14    public static void main(String arg[])
	15    {
	16  	 sample s1=new sample(null);
	17    }
	18 }
      1. Compile time error as call to constructor at line no. 16 is ambigious.
      2. Run time error as call to constructor at line no. 16 is ambigious.
      3. Program compiles correctly and prints "StringBuffer" when executed.
      4. Program compiles correctly and prints "string" when executed.

	Q15.Which one of the following method will return closest integer but not less than
	    for any value passed as argument d?Select one correct answer.
      1. i = (int)Math.ceil(d);
      2. i = (int)Math.abs(d);
      3. i = (int)Math.floor(d);
      4. i = (int)Math.round(d);

 	Q16.What will be the result of compiling and running the given program?
	Select one correct answer.
	1   class A
	2   {
	3      void callme()
	4      { 
	5         System.out.println("A");
	6      }
	7      int r=10;
	8   }
	9   class B extends A 
	10  {
	11     public void callme() 
	12     {
	13        System.out.println("B");
	14     }
	15     int r=20;
	16  }
	17  class Q16
	18  {
	19      public static void main(String args[]) 
	20      {
	21         A a = new B(); 
	22         a.callme();
	23         System.out.println(a.r); 
	24      }
	25  }
      1. Compile time error
      2. Program compiles correctly and prints "A" and 10 when executed.
      3. Program compiles correctly and prints "B" and 20 when executed.
      4. Program compiles correctly and prints "B" and 10 when executed.
  	

 	Q17.Which one of the following methods will give you an error when placed at 
	    line no.10?Select one correct answer.
	1   class A
	2   {
	3      public void callme()
	4      { 
	5         System.out.println("A");
	6      }      
	7   }
	8   class B extends A 
	9   {
	10     //Here
	11  }
      1. public final void callme(){}
      2. void callMe(){}
      3. void callme(int a){}
      4. void callme(){}

 	Q18.Which will be the first line to cause an error in the following code?
	Select one correct answer.

	1 class Char
	2 {
	3    public static void main(String arg[])
	4    {
	5       while(false) 
	6       {
	7           System.out.println("Hello");
	8       }
	9       while(false)
	10      {
	11      }
	12      do;
	13      while(false);
	14      do
	15      {
	16          ;
	17      }
	18      while(false);
	19   }   	    
	20 }

      1. Line no. 5
      2. Line no. 9
      3. Line no. 12
      4. Line no. 16

	Q19.Which of the given choices is true?Select one correct answer.
	1  class equal
	2  { 
	3     public static void main (String args[]) 
	4     { 
	5        StringBuffer sb1 = new StringBuffer("Amit"); 
	6        StringBuffer sb2= new StringBuffer("Amit"); 
	7        String ss1 = "Amit";
	8        System.out.println(sb1==sb2); 
	9        System.out.println(sb1.equals(sb2)); 
	10       System.out.println(sb1.equals(ss1)); 
	11       System.out.println(sb1==ss1);
	12    }
	13 }
      1. Error at line no. 10
      2. Excepetion at line no. 10
      3. Error at line no. 11
      4. Excepetion at line no. 11

	Q20.Which of the given choices are true?Select any two.
	1  class Q20
	2  {
	3     public static void main(String arg[])
	4     {
	5        Q20 e=null;
	6        System.out.println(e.equals(null));
	7        Q20 e1;
	8        System.out.println(e1.equals(null));
	9     }
	10 }
      1. Error at line no. 6
      2. Excepetion at line no. 6
      3. Error at line no. 8
      4. Excepetion at line no. 8

 	Q21.What will be the result of compiling and running the given program?
	Select one correct answer.
	1   public class exception
	2   { 
	3      public static void main(String args[]) 
	4      { 
	5          System.out.println("A"); 
	6          try 
	7          { 
	8          }
	9          catch(java.io.IOException t)
	10         { 
	11            System.out.println("B"); 
	12         } 
	13         System.out.println("C");  
	14     } 
	15  }
      1. Compile time error
      2. Program compiles correctly and prints "A" when executed.
      3. Program compiles correctly and prints "A" and "C" when executed.
      4. Run time error

 	Q22.What will be the result of compiling and running the given program?
	Select one correct answer.
	1   public class exception
	2   { 
	3      public static void main(String args[]) 
	4      { 
	5          System.out.println("A"); 
	6          try 
	7          { 
	8                return;
	9          }
	10         catch(Exception e)
	11         { 
	12            System.out.println("B"); 
	13         } 
	14         System.out.println("C");  
	15     } 
	16  }
      1. Compile time error in line no. 8 as main() method is declared void.
      2. Program compiles correctly and prints "A" when executed.
      3. Program compiles correctly and prints "A" and "C" when executed.
      4. Compile time error at line no.14 due to statement not reached.

 	Q23.What will be the result of compiling and running the given program?
	Select one correct answer.
	1   public class exception
	2   { 
	3      public static void main(String args[]) 
	4      { 
	5          System.out.println("A"); 
	6          try 
	7          { 
	8                return;
	9          }
	10         catch(Exception e)
	11         { 
	12            System.out.println("B"); 
	13         } 
	14         finally
	15         {
	16            System.out.println("C");  
	17         }
	18     } 
	19  }
      1. Compile time error in line no. 8 as main() method is declared void.
      2. Program compiles correctly and prints "A" when executed.
      3. Program compiles correctly and prints "A" and "C" when executed.
      4. Program compiles correctly and prints "A","B" and "C" when executed.

 	Q24.What will be the result of compiling and running the given program?
	Select one correct answer.
	1   public class exception
	2   { 
	3      public static void main(String args[]) 
	4      { 
	5          System.out.println("A"); 
	6          try 
	7          { 
	8             System.out.println("B");    
	9             System.exit(0);
	9          }
	10         catch(Exception e)
	11         { 
	12            System.out.println("C"); 
	13         } 
	14         finally
	15         {
	16            System.out.println("D");  
	17         }
	18     } 
	19  }
      1. Program compiles correctly and prints "A" when executed.
      2. Program compiles correctly and prints "A" and "B" when executed.
      3. Program compiles correctly and prints "A" and "C" when executed.
      4. Program compiles correctly and prints "A","B" and "C" when executed.

 	Q25.Whether the following code compile or not?
	Select the most appropriate answer.

	1  public class Q25
	2  { 
	3      final static int fsn;
	4      final int fn;
	5      static
	6      {
	7         fsn=6;
	8      }
	9      {
	10        fn =8;
	11     }
	12 }
      1. It will compile.
      2. It will not compile.
      3. It will compile if we initialize the two variable at the time of declaration.
      4. It will compile if we change the initializer blocks into the contructors.

 	Q26.What will be the value of str after line no.7?Enter your answer in the given field.
	    Don't use any extra signs like ("")quotes or any string like "str=".For example,
	    if your answer is the string "XYZ" you just write XYZ
	1  class string 
	2  {
	3     public static void main(String ds[])
	4     {
	5        String str="A";
	6        str.concat("B");
	7        str+="C";
	8     }
	9  }

(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.What will be the result of compiling and running the given program?
	Select any two.
	1  import java.util.*;
	2  import java.sql.*;
	3  class Q27
	4  {
	5     Date d;
	6     public static void main(String arg[])
	7     {
	8     }   
	6  }   
      1. Compile time error as Date class is defined in both of the above packages.
      2. Run time error as Date class is defined in both of the above packages.
      3. It will compile and run without any error.
      4. It will compile and run if we use ".Date" instead of ".*" in any one of the two import statements

 	Q28.Which one of the following is the simplest way to print the value of variable
	    text at line no. 18?Select one correct answer.

	1   class Message
	2   {
	3      String text="Hello1";
	4   }
	5   class Super
	6   {
	7      Message msg=new Message();
	8   }
	9   class inheritance extends Super
	10  {
	11     public static void main(String arg[])
	12     {
	13        inheritance i=new inheritance();
	14        i.print();
	15     }
	16     public void print()
	17     {
	18        //Here
	19     }
	20  }
      1. System.out.println(msg.text);
      2. System.out.println(super.msg.text);
      3. System.out.println(Message.text);
      4. System.out.println(text);

 	Q29.Whether the following code compile or not?
	Select any two.

	1  class Base {}
	2  class Agg extends Base
	3  {
	4     public String getFields()
	5     {
 	6        String name =  "Agg";
	7        return name;
	8     }
	9  }
	10 public class Inheritence
	11 {
	12    public static void main(String argv[])
	13    {
	14       Base a = new Agg();
	15       System.out.println(a.getFields());
	16    }
	17 } 
     

      1. It will compile.
      2. It will not compile.
      3. It will compile if we cast the variable a for the object of class Agg like ((Agg) a).getFields()
      4. We can cast the variable a for the object of class Agg, but it is not required.

 	Q30.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  class Q30
	2  { 
	3     static int p=abc(); 
	4     static public int abc() 
	5     { 
	6        int i=123; 
	7        System.out.println(p);
	8        return i; 
	9     } 
	10    public static void main(String arg[])	
	11    {	
	12    }
	13 } 
      1. Compile time error for forward referencing the variable p at line no. 7.
      2. Run time error for forward referencing the variable p at line no. 7.
      3. Program compiles correctly and prints 123 when executed.
      4. Program compiles correctly and prints 0 when executed.

 	Q31.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  public class initialize
	2  { 
	3      public initialize(int m) 
	4      { 
	5          System.out.println(i+","+j+","+k+","+x+","+m);
	6      } 
	7      public static void main(String[]args) 
	8      { 
	9          initialize obj=new initialize(x); 
	10     } 
	11     static int i=5; 
	12     static int x; 
	13     int j=7; 
	14     int k; 
	15     { 
	16         j=70;x=20; 
	17     } 
	18     static 
	19     { 
	20         i=50; 
	21     } 
	22 } 
      1. Compile time error.
      2. Program will give output 50,70,0,20,0
      3. Program will give output 50,70,0,20,20
      4. Program will give output 50,0,0,20,0

 	Q32.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  class initialize
	2  {
	3     int y=0;
	4     {
	5        y=1;
	6     }
	7     initialize()
	8     {	
	9        this(10);
	10       y=3;
	11    }
	12    initialize(int s)
	13    {			
	14       y=2;
	15    }
	16    public static void main(String arg[])
	17    {	
	18       initialize i=new initialize();		
	19       System.out.println(i.y);
	20    }
	21 }

      1. Compile time error
      2. Program compiles correctly and prints 1 when executed.
      3. Program compiles correctly and prints 2 when executed.
      4. Program compiles correctly and prints 3 when executed.
      5. Program compiles correctly and prints 0 when executed.

 	Q33.Which will be the first line to cause an error in the following code?
	Select one correct answer.

	1  class Outer
	2  {
	3     class Inner 
	4     {
	5         final int a=20;
	6         static final int b=20;
	7         static int c=20;
	8     }	
	9  }

      1. Line no. 5 as we can't declare a final variable in an inner class.
      2. Line no. 6 as we can't declare a static final variable in an inner class.
      3. Line no. 7 as we can't declare a static variable in an inner class.
      4. There is no error in this code.

 	Q34.Which of the following will be the correct way to make the object of class one
	    at line no.11?Select one correct answer.

	1  class outer
	2  {
	3     class one
	4     {
	5     }
	6  }
	7  class Q33
	8  {
	9     public static void main(String a[])
	10    {
	11       //Here
	12    }
	13 }

      1. outer o=new outer.one();
      2. outer o=new one();
      3. outer.one o=new outer().new one();
      4. one o=new outer().new one();

 	Q35.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  class instanceOf
	2  {
	3     public static void main(String arg[])
	4     {
	5        G g=new G();
	6        H h=new H();
	7        System.out.println(h instanceof G);
	8     }
	9  }
	10 class G{}
	11 class H{}
      1. Program compiles correctly and prints true when executed.
      2. Program compiles correctly and prints false when executed.
      3. Run time error
      4. Compile time error.

 	Q36.Which of the following method will not give you any error when placed on 
	    line no.3?Select one correct answer.

	1  interface i2
	2  {
	3     //Here
	4  }

      1. static void abc();
      2. abstract void abc();
      3. native void abc();
      4. synchronized void abc();
      5. final void abc();
      6. private void abc();
      7. protected void abc();

 	Q37.Which of the following statement will not give you any error when placed 
	    on line no.3?Select one correct answer.

	1  interface i2
	2  {
	3     //Here
	4  }
      1. private int a=10;
      2. int a;
      3. transient int a=0;
      4. volatile int a=0;
      5. public static final int a=0;

 	Q38.Which two of the following statement will give you same results?Select any two.
      1. 76>>>4
      2. 76<<4
      3. 76>>4
      4. 76^2

 	Q39.Which of the following variable is not accessible at line no.12?
	    Select one correct answer.

	1  class outer
	2  {
	3      private int a=0;
	4      int b=0;
	5      static int c=0;
	6      public void xyz(int d)
	7      {
	8          final int e=0;
	9          class local
	10         {
	11             {
	12                 //Here
	13             }
	14         }
	15     }
	16 }

      1. Variable a
      2. Variable b
      3. Variable c
      4. Variable d
      5. Variable e

 	Q40.Which two of the following are valid declaration for main() method?
	    Select any two.
      1. final public static void main(String arg[]){}
      2. private static void main(String arg[]){}
      3. public static void main(String arg[]){}
      4. public static void main(String arg){}

 	Q41.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  class Q41
	2  {
	3     public static void main(String arg[])
	4     {
	5        System.out.println(Math.abs(-2147483648);
	6     }
	7  }

      1. Program compiles correctly and prints 2147483648 when executed.
      2. Program compiles correctly and prints -2147483648 when executed.
      3. Program compiles correctly and prints 2147483647 when executed.
      4. The program will not compile.

 	Q42.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  class Bitwise
	2  {
	3     public static void main(String arg[])
	4     {
	5        abc();
	6     }
	7     public void abc()
	8     {
	9        byte x=13|2;
	10       byte y=~x;
	11       System.out.println(y);
	12    } 
	13 }


      1. Program compiles correctly and prints -16 when executed.
      2. Program compiles correctly and prints 15 when executed.
      3. Program compiles correctly and prints 16 when executed.
      4. Compile time error

 	Q43.After which line the object initially refered by str is eligible for garbage
	    collection?Select one correct answer.

	1   class Garbage
	2   {
	3       public static void main(String arg[])
	4       {
	5            String str=new String("Hello");
	6            String str1=str;
	7            str=new String("Hi");
	8            str1=new String("Hello Again");
	9            return;
	10      }
	11  }
      1. After line no. 6
      2. After line no. 7
      3. After line no. 8
      4. After line no. 9

 	Q44.Which of the following classes is not derived from the Component class.
	    Select one correct answer. 
      1. Container
      2. Window
      3. List
      4. MenuItem
      5. Choice

 	Q45.Name the method defined in EventObject class that returns the Object generated
	    from the event.Select the one correct answer. 
      1. getEvent()
      2. getObject()
      3. getID()
      4. getSource()
      5. getComponent()

 	Q46.Which of the following is not valid event class?Select one correct answer.
      1. MouseEvent
      2. PaintEvent
      3. WindowEvent
      4. MouseMotionEvent

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

 	Q48.How will the following program lay out its buttons. 
	    Select one correct answer. 

	1  import java.awt.*;
	2  public class MyClass 
	3  {
	4     public static void main(String args[]) 
	5     {
	6        String[] labels = {"A"};
	7        Window win =   new Frame();
	8        win.setLayout(new FlowLayout());
	9        for(int i=0;i < labels.length;i++)
	10       win.add(new Button(labels[i]));
	11       win.pack();
	12       win.setVisible(true);
	13    }
	14 }
      1. The button A will appear on the top left corner of the window.
      2. The button A will appear on the center of first row.
      3. The button A will appear on the top right corner of the window.
      4. The button A will appear on the middle row and column, in the center of the window.

 	Q49.Which of these are legal ways of accessing a File named "file.txt" for 
	    reading.Select one correct answer. 
      1. FileReader fr = new FileReader("file.txt");
      2. FileInputStream fr = new FileInputStream("file.txt","UTF8");
      3. FileReader fr = new FileReader("file.txt", "UTF8");
      4. InputStreamReader isr = new InputStreamReader("file.txt");

 	Q50.Which of the following classes can be used to specify the character encoding
	    for input?Select one correct answer. 
      1. FileReader
      2. InputStreamReader
      3. OutputStreamWriter
      4. FileInputStream
      5. RandomAccessFile

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

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

 	Q53.Which of the following methods is used to create a thread?
	    Select one correct answer.
      1. run()
      2. yield()
      3. start()
      4. create()

 	Q54.Which of the following methods must be used in try-catch?
	    Select any two.
      1. sleep()
      2. wait()
      3. yield()
      4. start()

 	Q55.Which of the following methods can be written at line no.3 to make the program
	    compile correctly?Select one correct answer.
	
	1 class abc imlements Runnable
	2 {
	3   //Here
	4 }  
      1. public void start(){}
      2. void run(){}
      3. public static void main(){}
      4. None of above.

 	Q56.Which of the following methods can be written at line no.3 to make the program
	    compile correctly?Select one correct answer.
	
	1 class abc extends Thread
	2 {
	3   //Here
	4 }  
      1. public void start(){}
      2. public void run(){}
      3. public static void main(){}
      4. Program will compile as it is.

 	Q57.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  class Q57
	2  {
	3      public static void main(String arg[])
	4      {
	5           int j=0;
	6           switch(1)
	7           {
	8                case 2:  j+=1;
	9                case 4:  j+=2;
	10               default: j+=3;
	11               case 0:  j+=4;
	12          }
	13          System.out.println(j); 
	13     }
	14  }
      1. Compile time error as default must come after all the cases.
      2. Compile time error as we can not use 1 as argument to switch.
      3. Program compiles correctly and print 3 when executed.
      4. None of above.

 	Q58.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  class Q58
	2  {
	3     public static void main(String args[]) 
	4     {
	5         int arr[] = new int[2];
	6         System.out.println(arr[0]);
	7     }
	8  }
      1. Compile time error saying arr may not be initialized.
      2. Run time error saying arr may not be initialized.
      3. Program compiles and prints 0 when executed.
      4. Program compiles and prints null when executed.

 	Q59.What will be the result of compiling and running the given program?
	Select one correct answer.
	1  class strings
	2  {
	3     public static void main(String arg[])
	4     {
	5         if("String".indexOf("S",-10) ==0) 
	6         {
	7             System.out.println("Equal"); 
	8         }
	9         else 
	10        {
	11            System.out.println("Not Equal");
	12        }
	13    }
	14  }

      1. Compile time error as we passed negative value in indexOf() method.
      2. Run time error as we passed negative value in indexOf() method.
      3. Program compiles and prints Equal when executed.
      4. Program compiles and prints Not Equal when executed.