Exam 10: Object-Oriented Programming

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

Special methods are methods that are automatically called in Python.

(True/False)
4.8/5
(32)

_______________ is a fundamental feature of object-oriented programming languages that allows for information hiding.

(Short Answer)
4.9/5
(30)

There is no means in Python for accessing the private members of a class.

(True/False)
4.9/5
(32)

Name mangling occurs when the identifiers within a class are not sufficiently distinct.

(True/False)
4.8/5
(42)

Match the descriptions with their terms: -indicates the number of objects that may be associated

(Multiple Choice)
4.8/5
(35)

________ and _________ are methods providing controlled access to private instance variables.

(Short Answer)
4.8/5
(39)

Which of the following is the correct way to access private instance variable x in object a of type ClassA?

(Multiple Choice)
4.8/5
(31)

______________________ is used in Python to indicate that particular members of a class are to be considered private.

(Short Answer)
4.9/5
(48)

For a class named FullName that contains an __init__ method that is passed a first and last name to construct a new object with, give an instruction that creates a new object of type FullName containing the name "Yu Huang."

(Essay)
4.7/5
(45)

Interaction diagrams in UML are used to represent the interactions of the user of a given program.

(True/False)
4.9/5
(52)

Getters and setters are methods providing controlled access to private instance variables.

(True/False)
4.8/5
(36)

There can be multiple levels of subclasses for a given class.

(True/False)
4.7/5
(41)

There are special methods in Python corresponding to both arithmetic and relational operators.

(True/False)
4.7/5
(43)

For a class named Money that stores a dollar and cent amount, give an appropriate __eq__ method that determines if two Money values are equal. (Note: the cent amount stored in Money objects is in the range 0 to 99.)

(Essay)
4.8/5
(36)

Special methods are predefined methods in Python that are automatically called, with names that begin and end with two ___________________ characters.

(Short Answer)
4.8/5
(35)

Duck typing, used in Python, refers to the fact that:

(Multiple Choice)
4.9/5
(35)

Give an appropriate __init__ method for a class named FullName that stores the first and last name of a given individual. Assume that the class contains (private) instance variables first_name and last_name.

(Essay)
4.9/5
(37)

The two methods that are implemented to display the value of a given object are named__________ and ___________.

(Short Answer)
4.8/5
(31)

Role names are used to describe an association between two classes.

(True/False)
4.9/5
(40)

For class FullName that contains an __init__ method that is passed a first and last name to construct a new object with, define a subclass of the FullName class named FullNamePlus that also stores a person's middle name. The subclass should include an __init__ method, getter/setter methods, and a __str__ methods that displays a name in the form lastname, firstname middlename. (Assume that class FullName contains getter methods accessing the first and last names.)

(Short Answer)
4.7/5
(41)
Showing 61 - 80 of 81
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)