Java OOPs Concept Quiz 2
Time left: 10:00

1. What is an abstract method in Java?

  • A method that has no body
  • A method that has a body
  • A method that can be called statically
  • A method that has no parameters

2. Can a class be both abstract and final in Java?

  • Yes
  • No
  • Only if it has no methods
  • Only if it is a static class

3. What is the purpose of a constructor in Java?

  • To initialize objects
  • To create objects
  • To define the behavior of objects
  • To define classes

4. What is the purpose of method overriding in Java?

  • To provide a specific implementation of a method in a subclass
  • To create multiple methods with the same name but different parameters
  • To define the behavior of objects
  • To define classes

5. What is the main difference between an interface and an abstract class in Java?

  • An interface can have only abstract methods, while an abstract class can have both abstract and concrete methods
  • An abstract class can have only abstract methods, while an interface can have both abstract and concrete methods
  • An interface can be instantiated, while an abstract class cannot
  • An abstract class can be instantiated, while an interface cannot

6. Can an abstract class have a constructor in Java?

  • Yes
  • No
  • Only if it is a static constructor
  • Only if it has no methods

7. What is the purpose of the "this" keyword in Java?

  • To refer to the current class object
  • To create a new object
  • To refer to the immediate superclass object
  • To refer to a static method

8. What is the purpose of the "super" keyword in Java?

  • To refer to the immediate superclass object
  • To create a new object
  • To refer to the current class object
  • To refer to a static method

9. What is the purpose of method overloading in Java?

  • To create multiple methods with the same name but different parameters
  • To create a method with the same name in a subclass
  • To create a method with the same name in the same class
  • None of the above

10. Can a constructor be private in Java?

  • Yes
  • No
  • Only if the class is abstract
  • Only if the class has no methods