Continue with your mobile number
This code demonstrates polymorphism in Python. 1. Base Class Behavior: The Shape class has an area method returning 0 by default, which is inherited but overridden by the Circle class. 2. Derived Class Behavior: The Circle class redefines the area method to calculate the area of a circle using the formula πr² . 3. Output: o The first call (s.area()) invokes the area method in Shape, returning 0. o The second call (c.area()) invokes the overridden area method in Circle, calculating and returning 78.5. This demonstrates inheritance and method overriding. Why Other Options Are Incorrect: • B) 0 followed by 0: The second call correctly calculates the circle's area. • C) 78.5 followed by 78.5: The first call uses the Shape class's method, which returns 0. • D) None followed by 78.5: The area method in Shape returns 0, not None. • E) Throws an error due to missing area method in Shape: The Shape class defines the area method.
Who has been sworn in as the new Deputy Chief Minister of Maharashtra?
For the first time, who has become the first Asian to be elected as the President of Film Academy?
Who was re-elected as an IOC member from India in July 2024?
What is the rank of India in Gender Gap Index, published by World Economic Forum?
Which mutual fund launched the digital campaign "Apne #SIPKoDoPromotion" in July 2024 to educate investors about the benefits of SIP Top-Up?
P Shiv Kumar Sharma passed away recently, who was he?
Which of the following is the highest peak of the Eastern Ghats?
Which sector in India grew by 9.9% as per the World Bank's report on India's economy for 2024-25?
Who has won the ICC men’s player of the month award for the month of June?
Which organization did REC Limited sign an MoU with to finance infrastructure projects?