click below
click below
Normal Size Small Size show me how
SGD113Module4a
Classes
Question | Answer |
---|---|
1. Every _________ method must have at least one parameter | instance |
2. You want to avoid directly accessing an object's ________ outside of its class definition | attributes |
3. Only one class attribute is created for each object ________ from that class. | instantiated |
4. A ______ method can be invoked even if no objects of the class have been instantiated. | static |
5. By default, all of an object's attributes and methods are ________. | public |
6. It’s legal to access an object's _______ attribute inside the object's own class definition | private |
7. Access methods allow ________ access to attributes and often impose some sort of restriction on that access | indirect |
8. Instance attributes are usually created in the __________ | constructor |
9. __str__ is a special method returns a ______ representation of an object. | string |
10. Defining an attribute or method as private encourages ___________ | encapsulation |
11. _______ attributes can be used to limit the direct access of object attributes by client code. | private |
12. You would define an attribute as private by using __________ | (__) two leading underscores |
13. A ______ can access both its private and public methods from the class object. | method |
14. If it's critical that a method never be directly accessed by client code, what should you make the method _______. | private |
15. A get type of ______ method should always return a value. | accessor |
16. A set type of access method should always _____ a value. | take |
17. A property essentially wraps ______ methods | access |
18. A(n) ____________________ method is associated with a class itself. | static |
19. A(n) ____________________ is a special method that is automatically invoked right after a new object is created. | constructor |
20. A(n) ____________________ class is not based on the built-in object, directly or indirectly. | old-style |
21. A(n) ____________________ class is directly or indirectly based on the built-in object. | new-style |
22. A(n) ____________________ attribute is a single attribute for an entire class | class |
23. A class is simply a ______ | design |
24. Every instance method must have a special first parameter, called _____ by convention, in its parameter list. | self |
25. ___________ method is automatically invoked right after the object is created. | constructor |
26. The constructor method is typically used to set up the _______ attribute values of an object. | initial |
27. A class attribute is a _______ value that exists for an entire class | single |
28. To enforce ___________, client code should communicate with objects through method parameters and return values | encapsulation |
29. _______ code should avoid directly altering the value of an object's attribute. | client |