nerdexam
Python_Institute

PCAP-31-03 · Question #102

The following class definition is given. We want the show () method to invoke the get () method, and then output the value the get () method returns. Which of the invocations should be used instead…

The correct answer is B. print (self.get()). See the full explanation below for the reasoning.

Question

The following class definition is given. We want the show () method to invoke the get () method, and then output the value the get () method returns. Which of the invocations should be used instead of XXX?

Exhibit

PCAP-31-03 question #102 exhibit

Options

  • Aprint (get(self))
  • Bprint (self.get())
  • Cprint (get())
  • Dprint (self.get (val))

How the community answered

(42 responses)
  • A
    5% (2)
  • B
    71% (30)
  • C
    17% (7)
  • D
    7% (3)

Community Discussion

No community discussion yet for this question.

Full PCAP-31-03 Practice