Question OOP-CLS-0036
EasyWhat is the output of this code?
class Box:
def __init__(self, v):
self.v = v
a = Box(1)
b = Box(2)
a.v = 5
print(a.v, b.v)
- A.
5 2
- B.
1 2
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Classes and Objects question
What is the output of this code?
class Box:
def __init__(self, v):
self.v = v
a = Box(1)
b = Box(2)
a.v = 5
print(a.v, b.v)
5 2
1 2
Sign up free to see the answer and a step-by-step explanation.
5 5
2 5