Wipro Placements MCQ with Answers

       Wipro Placements MCQ,S with Answers

Topic: Abstract Classes, Interfaces

 1. Which is a valid method signature in an interface?
   a)private int getArea(); 
   b)protected float getVol(float x);
   c) public static void main(String [] args); 
   d)boolean setFlag(Boolean [] test []);

 2. Which statement is true about interfaces?

 a)Interfaces allow multiple implementation inheritance. 

 b)Interfaces can extend any number of other interfaces.

 c)  Members of an interface are never static.

 d)Members of an interface can always be declared static.


3. Which statement is true about interfaces?
  a) The keyword extends is used to specify that an interface inherits from another interface.
  b)  The keyword extends is used to specify that a class inherits from an interface.
  c)  The keyword implements is used to specify that an interface inherits from another interface.
  d) The keyword implements is used to specify that a class inherits from another class.
 
4. Which of the field declaration is legal within the body of an interface?

a)  protected static int answer = 42;

b)volatile static int answer = 42; 

c)int answer = 42;

   d)private final static int answer = 42;

 5. Which declaration prevents creating a subclass of a top level class?

a)  private class Javacg{}

b)abstract public class Javacg{} 

c)final public class Javacg{} 

d)final abstract class Javacg{}

 

6. Here is an abstract method defined in the parent:
public abstract int sumUp ( int[] arr );

  7.Which of the following is required in a non-abstract child?
a)public abstract int sumUp ( int[] arr ) { . . . } 
b)public int sumUp ( int[] arr ) { . . . }
c) public double sumUp ( int[] arr ) { . . . }
d) public int sumUp ( long[] arr ) { . . . }

 

8. Which statement is true for any concrete class implementing the java.lang.Runnable interface?
a) The class must contain an empty protected void method named run().
b) The class must contain a public void method named runnable().
c) The class definition must include the words implements Threads and contain a method called run().
d) The mandatory method must be public, with a return type of void, must be called run(), and cannot take any arguments.

 

9. Which is a valid declaration within an interface?
a)protected short stop = 23; 
b)final void madness(short stop);
c)public Boolean madness(long bow); 
d)static char madness(double duty);

10. Can an abstract class define both abstract methods and non- abstract methods ?
   a) No-it must have all one or the other.
   b)  No-it must have all abstract methods
   c) Yes-but the child classes do not inherit the abstract methods. 
   d)Yes-the child classes inherit both.


11. Which one of the following statements is true ?
a)  An abstract class can be instantiated.
b)An abstract class is implicitly final.
c)An abstract class can declare non-abstract methods. 
d)An abstract class can not extend a concrete class.


Wipro Placements MCQ,S with Answers
Wipro Placements MCQ,S with Answers


Post a Comment

0 Comments