Exam 10: Object-Oriented Programming
Exam 1: Introduction102 Questions
Exam 2: Data and Expressions71 Questions
Exam 3: Control Structures129 Questions
Exam 4: Lists85 Questions
Exam 5: Functions83 Questions
Exam 6: Objects and Their Use54 Questions
Exam 7: Modular Design62 Questions
Exam 8: Text Files58 Questions
Exam 9: Dictionaries and Sets33 Questions
Exam 10: Object-Oriented Programming81 Questions
Exam 11: Recursion27 Questions
Select questions type
A _____________ is something that can be substituted for and behave as its parent type.
Free
(Short Answer)
4.9/5
(43)
Correct Answer:
subtype
The word polymorphism derives from Greek meaning:
Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
A
Information hiding is a form of abstraction.n.
Free
(True/False)
4.8/5
(33)
Correct Answer:
True
For a class named Money that stores a dollar and cent amount, give an appropriate __add__ method. Assume that the class contains (private) instance variables dollars and cents. (Note: the cent amount stored should be in the range 0 to 99.)
(Essay)
4.9/5
(37)
Match the descriptions with their terms:
-indicates a grouping of classes
(Multiple Choice)
4.7/5
(40)
Subclass relationships in UML are indicated by use of a solid line with a(n)
(Multiple Choice)
4.8/5
(36)
Multiplicity in a UML class diagrams refers to the total number of relationships defined between classes.
(True/False)
4.9/5
(40)
For person1, an object instance of class FullName containing private instance variables first_name and last_name, indicate how each of these instance variables can be directly accessed from outside the class.
(Essay)
4.9/5
(36)
Give the __str__ method for a class named FullName that contains the first and last name of an individual, such that the name is displayed (when printed) in the form lastname, firstname. Assume that the class contains (private) instance variables first_name and last_name.
(Essay)
4.8/5
(33)
A class in which one or more methods are unimplemented (or only implemented to raise an exception) is called an abstract class.
(True/False)
4.9/5
(36)
Private members of a class in Python begin and end with two underscore characters.
(True/False)
4.8/5
(41)
A class specifies a set of instance variables and methods that are "bundled together" for defining a type of object.
(True/False)
4.8/5
(37)
Special methods __repr__ and __str__ both produce the same string representation of a given object's value.
(True/False)
4.7/5
(38)
The three sections of a class as denoted in UML are ____________, ______________, and __________.
(Short Answer)
4.8/5
(35)
Give a UML class diagram for some of the entities in a university. Include the following classes: University, College, Department, Department Chair, Faculty Member, Student, and Course. Include only the class names in the denoted classes. Make sure to include multiplicity and role names were appropriate.
(Essay)
4.9/5
(38)
Denote in UML a Fraction class with private instance variables numer and denom, an __init__ method, setter and getter methods, a method for properly displaying a fraction value, a method for adding two fraction values (such that the '+' symbol can be used, returning a Fraction result), and a method for comparing if two given Fraction objects are equal (using the '==' symbol, returning a Boolean result).
(Essay)
4.9/5
(31)
In procedural programming, the focus is on variables and the passing of variables to functions, whereas in object-oriented programming, the focus is on _____________ and _____________________________.
(Short Answer)
5.0/5
(41)
In object-oriented programming, polymorphism allows objects of different types, each with their own specific behaviors, to be treated as the same general type.
(True/False)
4.8/5
(30)
Showing 1 - 20 of 81
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)