Which of the below given statement(s) is/are true?
Micron technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Which of the below given statement(s) is/are true?
I) An abstract class can be instantiated
II) An abstract method must be overridden
Show answer & explanation
Statement I is false: abstract classes cannot be directly instantiated. You must create a concrete subclass that implements all abstract methods, then instantiate that subclass. Statement II is true: any abstract method declared in an abstract class must be overridden (implemented) in a concrete subclass, otherwise that subclass remains abstract.
Step-by-step Derivation:
Evaluate each statement:
Statement I - "An abstract class can be instantiated": FALSE
- Attempting to instantiate an abstract class directly (e.g.,
AbstractClass obj = new AbstractClass();) results in a compile-time error in languages like Java and C++. - Abstract classes serve as templates and cannot exist as standalone objects.
- Only concrete (non-abstract) subclasses that implement all abstract methods can be instantiated.
Statement II - "An abstract method must be overridden": TRUE
- Abstract methods are declared with the
abstractkeyword and have no implementation body. - Any class that inherits from a parent with abstract methods must override (provide implementation for) all abstract methods.
- If a subclass does not override an abstract method, it remains abstract and cannot be instantiated.
- This is enforced by the compiler/language design.
Conclusion: Statement I is false, Statement II is true → Answer is D (Only II).