πŸ“Š Python
Q. What will the following code print?
```python
class A:
def __init__(self, x):
self.x = x

a = A(10)
print(a.x)
```
  • (A) 0
  • (B) 10
  • (C) None
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 10

Explanation: The constructor sets `self.x` to 10, so `a.x` is 10.

Explanation by: Mr. Dubey
The constructor sets `self.x` to 10, so `a.x` is 10.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
72
Total Visits
πŸ“½οΈ
10 mo ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
93%
Success Rate