Prashnikaप्रश्निका
Code
About
‹ Back to the paper

Question 1(vi)

1 mark

Computer ScienceISC 2026 Improvement Computer Science Paper 1Assertion-reasonInheritance, Interfaces and Polymorphism

Study the Assertion and Reason and choose the correct option.

In Java, a subclass can override a method of its superclass by defining a method with the same name…

Assertion: In Java, a subclass can override a method of its superclass by defining a method with the same name and same signature.

Reason: If the subclass calls the overridden method without using the super keyword, the subclass’s own version of the method will get called, leading to recursion.

  • (a)Both Assertion and Reason are true and Reason is the correct explanation for Assertion.
  • (b)Both Assertion and Reason are true but Reason is not the correct explanation for Assertion.
  • (c)Assertion is true and Reason is false.
  • (d)Both Assertion and Reason are false.

Answer

Answer

Correct option: (b)

Answer: (b) Both Assertion and Reason are true but Reason is not the correct explanation for Assertion. Assertion: In Java, a subclass overrides a superclass method by defining a method with the same name and same signature — this is the correct definition of method overriding, so it is true. Reason: If a subclass method calls the overridden method by its own name (without 'super'), dynamic method dispatch causes the subclass's own version to be invoked again — which can lead to (self-)recursion. This is also a true statement, but it describes a runtime consequence of overriding rather than explaining the rule/definition of overriding stated in the Assertion. Hence Reason does not explain Assertion.