

MCQOPTIONS
Saved Bookmarks
1. |
What is the output of the following piece of code? class Test: def __init__(self): self.x = 0 class Derived_Test(Test): def __init__(self): self.y = 1 def main(): b = Derived_Test() print(b.x,b.y) main() |
A. | 0 1 |
B. | 0 0 |
C. | Error because class B inherits A but variable x isn’t inherited |
D. | Error because when object is created, argument must be passed like Derived_Test(1) |
Answer» D. Error because when object is created, argument must be passed like Derived_Test(1) | |