M

Mr. Dubey • 86.20K Points
Coach

Q. What will be the output of the following
Python code?
1. class father:
2. def __init__(self, param):
3. self.o1 = param
4.
5. class child(father):
6. def __init__(self, param):
7. self.o2 = param
8.
9. >>>obj = child(22)
10. >>>print "%d %d" % (obj.o1, obj.o2)

(A) none none
(B) none 22
(C) 22 none
(D) error is generated
Share

Explanation by: Mr. Dubey
 self.o1 was never created.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics