Q. What will be the output of the following
Python code?
1. class tester:
2. def __init__(self, id):
3. self.id = str(id)
4. id="224"
5.
6. >>>temp = tester(12)
7. >>>print(temp.id)

  • (A) 224
  • (B) error
  • (C) 12
  • (D) none
πŸ’¬ Discuss
βœ… Correct Answer: (C) 12
Explanation: id in this case will be the attribute of the class.

Explanation by: Mr. Dubey
id in this case will be the attribute of the class.

πŸ’¬ Discussion

πŸ“Š Question Analytics

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