Home / MCQ Bank / Computer
Computer Concept Of Object Oriented Programs In Python

What will be the output of the following Python code? class Demo: def __new__(self): self.__init__(self) print("Demo's __new__() invoked") def __init__(self): print("Demo's __init__() invoked") class Derived_Demo(Demo): def __new__(self): print("Derived_Demo's __new__() invoked") def __init__(self): print("Derived_Demo's __init__() invoked") def main(): obj1 = Derived_Demo() obj2 = Demo() main()

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • Derived_Demo's __new__() invoked Demo's __init__() invoked Demo's __new__() invoked

Related Computer Questions

Pick out the correct answer. How do you insert an element at the beginning of the list? In time series analysis, what is the purpose of "rolling forecasting origin"? Which type of SQL Server cursor concurrency places an update lock on a row when the row is read? What is the primary benefit of using inheritance in Ruby?