MCQs
The snippet of code shown above results in a value error. This is because there is an invalid literal for int() with base 10: '65.43'.
Class B inherits class A hence the function disp () becomes part of class B's definition. Hence disp() method is properly executed and the line is printed.
The __eq(other) method is called if any comparison takes place and it is defined in the object class.
The derived class method change() overrides the base class method.
The other two do not exist.
setattr(obj,name,value) is used to set an attribute. If attribute doesn't exist, then it would be created.
Variables such as self.__b are private members of the class.
The code shown above will not yield any output. This is because when we try to yield 9, and there is no next(g), the iteration stops. Hence there is no output.
The else part is executed when no exception occurs.
Special methods like __init__ begin and end with two underscore characters.