Abstraction

11.What will happen if an abstract class has no abstract methods?
  • A. It cannot be compiled
  • B. It can still be used for partial abstraction
  • C. It cannot be inherited
  • D. It will cause a runtime error

It can still be used for partial abstraction

It can still be used for partial abstraction

12.What happens if a subclass does not implement all abstract methods from an abstract class?
  • A. The program will compile successfully
  • B. The subclass must be declared abstract
  • C. The program will execute without issues
  • D. The abstract class will override the methods automatically

The subclass must be declared abstract

The subclass must be declared abstract

13.What is the primary reason for using abstract classes instead of interfaces?
  • A. To allow method implementation along with abstraction
  • B. To prevent inheritance
  • C. To force all methods to be static
  • D. To allow multiple inheritance

To allow method implementation along with abstraction

To allow method implementation along with abstraction

14.What is a major advantage of using interfaces in Java?
  • A. It supports multiple inheritance
  • B. It prevents object creation
  • C. It restricts method overriding
  • D. It allows method overloading

It supports multiple inheritance

It supports multiple inheritance

15.What happens if a class implements an interface but does not override all methods?
  • A. It must be declared as abstract
  • B. It will compile without errors
  • C. It will provide default implementations
  • D. It will generate runtime exceptions

It must be declared as abstract

It must be declared as abstract