QuestionQ67

VerifiedObject-Oriented Programming

Which of the following lines of code can independently be placed inside the dup() method so that the snippet outputs [0, 1, 1]?

Question Image

Choose two
Explanation

At the time dup() is called, self.store is [0, 1]. self.get()[-1] and self.store[1] both evaluate to 1, and self.put(...) appends that value to the list. The unqualified names store and put are not defined as local or global names in the method.

Community Discussion

No comments yet. Be the first to start the discussion!