HW 9.docx - HW 9 Multiple Choice 1 B 2 D 3 C 4 D 5 B 6 D 7...

This preview shows 1 out of 2 pages.

HW 9 Multiple Choice 1. B 2. D 3. C 4. D 5. B 6. D 7. C 8. A 9. B 10. A 11. D 12. A True or False 1. False 2. True 3. False 4. False 5. True 6. True 7. False Short Answer 1. Encapsulation is the combining of both data and code into a single object. 2. An object’s data attributes should be hidden from outside code so that it doesn’t accidentally get corrupted. 3. A class is the “blueprint” and instances of a class are the objects created from the class. 4. The method name is get_dollar and the variable name that references the object is wallet. 5. When the __init__ method executes, the self parameter references the object that just got created. 6. To hide an attribute from code outside the class, start the attribute name with 2 underscore characters. 7. To call the str method, pass the object as an argument to the built-in str or print function.
Image of page 1

Subscribe to view the full document.

Algorithm Workbench 1. my_car.__go() 2. class Book: def __init__(self, title, author, publisher):
Image of page 2
You've reached the end of this preview.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern