Skip to content
CodeKruPro

A subclass that forgets an abstract method

QuizMediumPython onlyAsked in: Accenture, Capgemini, Infosys, TCS, Wipro

Shape(ABC) declares @abstractmethod area(self) (an abstract method has no body and every subclass must write it). Square(Shape) implements area; Half(Shape) does not. Which statements are true? Pick all that apply.

  • Shape("x") raises TypeError
  • Half("h") raises TypeError
  • Square(3) works
  • Defining class Half(Shape): pass raises an error immediately

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in