MENU
Question -

What will be the output of the following code

class c (object):
тАж.def_init_(self):
self.x = 1
C = C()
print C.X
print C.X
print C.X
print C.X



Answer -

All the outputs will be 1, since the value of the objects attribute (X) is never changed.
1
1
1
1
X is now a part of the public members of the class C. Thus it can be accessed directly.

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×