Is The Following Python Code Validp Pre Langpython #1084
Is the following Python code valid?</p> <pre><code class="language-python"> class B(object): def first(self): print("First method called") def second(): print("Second method called") ob = B() B.first(ob) </code></pre>
This multiple choice question (MCQ) is related to the book/course gs gs109 Python. It can also be found in gs gs109 Classes and Objects - Python Classes and Objects - Quiz No.2.
Is the following Python code valid?
class B(object): def first(self): print("First method called") def second(): print("Second method called") ob = B() B.first(ob)
It isn’t as the object declaration isn’t right
It isn’t as there isn’t any __init__ method for initializing class members
Yes, this method of calling is called unbounded method call
Yes, this method of calling is called bounded method call