Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Python Institute Exam PCAP-31-03 Topic 2 Question 78 Discussion

Actual exam question for Python Institute's PCAP-31-03 exam
Question #: 78
Topic #: 2
[All PCAP-31-03 Questions]

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?

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

Sage
2 months ago
I'm not sure, but I think C is also a possible answer.
upvoted 0 times
...
Judy
2 months ago
Hmm, this is a tricky one. But I think B) print(self.get()) is the right answer. Gotta love those self-referential method calls!
upvoted 0 times
Pearlie
1 months ago
I would choose C) print(get()) for this one.
upvoted 0 times
...
Eileen
1 months ago
I'm not sure, but I would go with B) print(self.get()).
upvoted 0 times
...
Simona
1 months ago
I think A) print(get(self)) might work too.
upvoted 0 times
...
Portia
2 months ago
I agree, B) print(self.get()) is the correct choice.
upvoted 0 times
...
...
Jesusa
2 months ago
B) print(self.get()) is the way to go. I mean, come on, it's basic object-oriented programming 101.
upvoted 0 times
Erin
1 months ago
Agreed, using self to access the method within the class is the right approach.
upvoted 0 times
...
Lindsey
2 months ago
Yeah, that makes sense. It's the standard way to call a method on an object.
upvoted 0 times
...
Catina
2 months ago
I think B) print(self.get()) is the correct invocation.
upvoted 0 times
...
...
Devorah
3 months ago
Haha, I'm going to go with C) print(get()). Just kidding, that's obviously wrong. It's gotta be B) print(self.get()).
upvoted 0 times
...
Brett
3 months ago
Definitely B) print(self.get()). The 'self' keyword is used to refer to the instance of the class, so that's the way to access the get() method.
upvoted 0 times
...
Jillian
3 months ago
I agree with Sheridan, because self.get() is the correct way to invoke the get() method.
upvoted 0 times
...
Margot
3 months ago
I think the correct answer is B) print(self.get()). That's the standard way to call a method on an object in Python.
upvoted 0 times
Kerry
2 months ago
I see, thanks for clarifying. B) print(self.get()) it is then.
upvoted 0 times
...
Maia
2 months ago
No, A) print(get(self)) would not work because get() is a method of the object, so we need to use self.get().
upvoted 0 times
...
Roselle
2 months ago
But what about A) print(get(self))? Wouldn't that work as well?
upvoted 0 times
...
Roselle
2 months ago
I agree, B) print(self.get()) is the correct way to call a method on an object.
upvoted 0 times
...
...
Sheridan
3 months ago
I think the answer is B.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77