MCQOPTIONS
Saved Bookmarks
| 1. |
What is the output of the following code?class test: def __init__(self,a="Old"): self.variable = a def display(self): print(self.variable) obj = test() obj.display() |
| A. | An error displays: function doesn’t have parameters |
| B. | ‘old’ is printed |
| C. | The program has an error because constructor can’t have default arguments |
| D. | nothing is printed |
| Answer» C. The program has an error because constructor can’t have default arguments | |