Vidyalelo
Python · Q45

Classes and Objects in Python

Programming · Python · question 45

Q45

What will be the output of the following Python code? class Demo: def __init__(self): pass def test(self): print(__name__) obj = Demo() obj.test()

A.
Exception is thrown
B.
__main__
Answer
C.
Demo
D.
test

Answer: Option B

Solution

Answer: Option B
No explanation is given for this question Let's Discuss on Board