πŸ“Š Problem Solving and Python Programming
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
πŸ’¬ Discuss
βœ… Correct Answer: (D) error is generated

Explanation: self.o1 was never created.


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

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
553
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
86%
Success Rate