EXAM REVIEW 2: OOP

The __________ programming practice is centered on creating functions that are separate from the data that they work on.
Click the card to flip 👆
1 / 37
Terms in this set (37)
Starting an attribute name with two underscores will hide the attribute from code outside the class.TrueA set of standard diagrams for graphically depicting object-oriented systems is provided by .the Unified Modeling LanguageBy doing this, you can hide a class's attribute from code outside the class.begin the attribute's name with two underscoresWhy should an object's data attributes be hidden from code outside the class?It prevents accidental corruptionSuppose my_car is the name of a variable that references an object, and go is the name of a method. Write a statement that uses the my_car variable to call the go method. (You do not have to pass any arguments to the go method.)my_car.go()One way to find the classes needed for an object-oriented program is to identify all of the verbs in a description of the problem domain.FalseA(n) ____________ method stores a value in a data attribute or changes its value in some other way.mutatorYou cannot directly call the _ _str_ _ methodTrueWhen the _ _init_ _ method executes, what does the self parameter reference?It references the object that the method is to operate onA(n) ___________ method gets the value of a data attribute but does not change itaccessorWhat is encapsulation?Encapsulation refers to the combining of data and code into a single object.What is the difference between a class and an instance of a class?A class is a 'blueprint' that can be used to create objects. An instance of a class is an object of the data type that exists in memory.In one approach to identifying a class's data attributes and methods, the programmer identifies the class's .ResponsibilitiesThe ___________ programming practice is centered on creating objects.object-orientedWhat does a subclass inherit from its superclass?the subclass inherits everything from its superclass/ The superclass's attributes and methods.This characteristic of object-oriented programming allows the correct version of an overridden method to be called when an instance of a subclass is used to call it.PolymorphismIn an inheritance relationship, the ___________ is the specialized class.subclassSuppose a program uses two classes: Airplane and JumboJet. Which of these would most likely be the subclass?JumboJetIt is not possible to call a superclass's __init__ method from a subclass's __init__ method.Falsewhen two methods have the same name but do different tasks, one of the methods will override the other.When a subclass method has the same name as a superclass method, it is said that the method is overridden.A subclass can have a method with the same name as a method in the superclass.TruePolymorphism allows you to write methods in a subclass that have the same name as methods in the superclass.TrueYou cannot use the isinstance function to determine whether an object is an instance of a subclass of a class.FalseIn an inheritance relationship, the __________ is the general class.superclassOnly the __init__ method can be overridden.FalseYou can use this to determine whether an object is an instance of a class.the isinstance functionLook at the following class definition. What is the name of the superclass? What is the name of the subclass?: class Tiger(Felis):Felis is the superclass and Tiger is the subclass.