1)What do self and cls refer to?
a)self is a reference to the object that receives the service call and executes the method whereas cls refers to the class that receives the method call.
b)self is a reference to the object that makes the service whereas cls refers to the class that receives the method call.
c)self is a reference to the object that receives the service call and executes the method whereas cls refers to the class that makes the method call.
d)self is a reference to the object that makes the service call whereas cls refers to the class that makes the method call
2)Which statement is true about augmentation and specialisation?
a)Augmentation adds data attributes and methods to a subclass whereas specialisation modifies methods that a subclass inherits.
b)Augmentation adds data attributes and methods to a superclass whereas specialisation modifies methods that a superclass inherits.
c)Specialisation adds data attributes and methods to a subclass whereas augmentation modifies methods that a subclass inherits.
d)Specialisation adds data attributes and methods to a superclass whereas augmentation modifies methods that a superclass inherits.
Answer 1
d)self is a reference to the object that makes the service call whereas cls refers to the class that makes the method call
self- the instance to call and method and passed to the method automatically, but not received automatically
cls - is always be a reference to the class, never to the instance. When cls is used a method is bound to the class object.
Answer 2
c)Specialization adds data attributes and methods to a subclass whereas augmentation modifies methods that a subclass inherits.
Specialization - Subclass having common attributes of super class with distinct specific attributes and methods of its own.
Augmentation - in which a subclass adds a modifies ad adds behavior not defined in the superclass.
Get Answers For Free
Most questions answered within 1 hours.