Guest User

Untitled

a guest
May 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. Consider the following program:
  2. class NN:
  3. def __init__(self):
  4. self.n = 0
  5. def get(self):
  6. self.n += 1
  7. return str(self.n)
  8. def reset(self):
  9. self.n = 0
  10.  
  11. class NS(NN):
  12. def get(self, s):
  13. return s + NN.get(self)
  14.  
  15. The following statements are executed in sequential order.
  16.  
  17. 1) What does this print?
  18.  
  19. foo = NS()
  20.  
  21.  
  22. 2) What does this print?
  23.  
  24. print foo.get('b')
  25.  
  26. 3) What does this print?
  27.  
  28. foo.reset()
  29. print foo.get('c')
Add Comment
Please, Sign In to add comment