

MCQOPTIONS
Saved Bookmarks
1. |
What is the output of the following piece of code? class A: def __init__(self): self._x = 5 class B(A): def display(self): print(self._x) def main(): obj = B() obj.display() main() |
A. | Error, invalid syntax for object declaration |
B. | Nothing is printed |
C. | 5 |
D. | Error, private class member can’t be accessed in a subclass |
Answer» D. Error, private class member can’t be accessed in a subclass | |