Question
Consider the following Python code: from abc
import ABC, abstractmethod class Shape(ABC):   @abstractmethod   def area(self):     pass class Circle(Shape):   def __init__(self, radius):     self.radius = radius   def area(self):     return 3.14 * self.radius * self.radius # What will be the output of the following? # s = Shape() # print(s.area()) What will happen if you try to execute the commented-out lines `s = Shape()` and `print(s.area())`?Solution
o In Python, when you define a class that inherits from abc.ABC (Abstract Base Class) and includes at least one method decorated with @abstractmethod, that class becomes an abstract class. o Abstract classes cannot be instantiated directly. Their purpose is to serve as blueprints for other classes. You must create a concrete subclass (like Circle in this example) that provides implementations for all abstract methods before you can create an object of that subclass. o Attempting to instantiate Shape() will result in a TypeError.
Which artisan from Chhattisgarh received the National Handicrafts Award for 2023?
In which year was the World Bank established?
The Ganga Expressway inaugurated by PM Modi in Hardoi is how many kilometers long?
Which country is ranked first for cyberattacks in 2024, according to the CloudSEK report?
In July, the number of total account holders under the PMJDY reached 495.6 million, with a total outstanding of over Rs 2 trillion. Of this, _______ are...
Under which legislation were the violations by Reliance General Insurance detected during inspection?
In which Indian state is the Pench Tiger Reserve (PTR) located, recently designated as India's first Dark Sky park?
In a significant development, India is believed to have placed a funding request of around_____Â in its first call with the Pandemic Fund of the World ...
Bangladesh became the first South Asian country to join which UN water governance treaty in 2025?
On which date will the President of India attend the SOAR – Skilling for AI Readiness programme?