Question

1)What do self and cls refer to? a)self is a reference to the object that receives...

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.

Homework Answers

Answer #1

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.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Create an add method for the BST (Binary Search Tree) class. add(self, new_value: object) -> None:...
Create an add method for the BST (Binary Search Tree) class. add(self, new_value: object) -> None: """This method adds new value to the tree, maintaining BST property. Duplicates must be allowed and placed in the right subtree.""" Example #1: tree = BST() print(tree) tree.add(10) tree.add(15) tree.add(5) print(tree) tree.add(15) tree.add(15) print(tree) tree.add(5) print(tree) Output: TREE in order { } TREE in order { 5, 10, 15 } TREE in order { 5, 10, 15, 15, 15 } TREE in order {...
a/b x c/dy Let's design a class and explore more on object reference: A fraction with...
a/b x c/dy Let's design a class and explore more on object reference: A fraction with two private fields: a for representing numerator and b for representing denominator. Define a constructor Fraction() accept two integers to represent the numerator and denominator. Define a public instance method named printString() which returns a String in form of "a/b". Define a public instance method named multiplyBy() which accepts one argument of class type Fraction, calculates the multiplication between self and the receiving Fraction,...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the following subsections can all go in one big file called pointerpractice.cpp. 1.1     Basics Write a function, int square 1(int∗ p), that takes a pointer to an int and returns the square of the int that it points to. Write a function, void square 2(int∗ p), that takes a pointer to an int and replaces that int (the one pointed to by p) with its...
Task 1: You will modify the add method in the LinkedBag class.Add a second parameter to...
Task 1: You will modify the add method in the LinkedBag class.Add a second parameter to the method header that will be a boolean variable: public boolean add(T newEntry, boolean sorted) The modification to the add method will makeit possible toadd new entriesto the beginning of the list, as it does now, but also to add new entries in sorted order. The sorted parameter if set to false will result in the existing functionality being executed (it will add the...
this is the book name. Data Structures and Abstractions with Java 1) Description: The sample programs...
this is the book name. Data Structures and Abstractions with Java 1) Description: The sample programs in Chapter 1 of your textbook are not complete. They are used for illustration purpose only. The implementation of Listing 1-1 on page 39 is explained in Chapter 2. And, in order to see the result of using it, we will need the following set of files: i. BagInteface.java – the specification only. ii. ArrayBag.java – the implementation of BagInerface.java. iii. ArrayBagDemo.java – a...
Question 1) Which of the following are considered valid criticisms of the legalistic model of crime...
Question 1) Which of the following are considered valid criticisms of the legalistic model of crime and criminology? a. Law in action departs substantially from the ideal behavior of the law. b. Focusing only on legally criminalized behavior makes it impossible to consider the impact of gender, race, age and ethnicity. c. Legalistic definitions ignore acts that cause great harm. d. The legalistic model suggests that these are absolute standards for judging right and wrong. e. All of the above....
Question 1 Jamal is a 40 year-old African American male. He is brought to a local,...
Question 1 Jamal is a 40 year-old African American male. He is brought to a local, out-patient mental health facility by his wife. She expresses concern about him, because he has been withdrawn for the last 2 or 3 weeks. She describes him as being irritable and restless. She also says he eats very little and has lost almost 10 pounds in the past 2 weeks. He agrees that he has been irritable; however, he attributes his irritability to the...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...