Exam 6: Inheritance and Abstract Classes

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

In the ArraySortedBag class, why must the self argument be passed to the __init__ method of ArrayBag?

(Multiple Choice)
5.0/5
(37)

By using inheritance to create new classes, you increase code redundancy.

(True/False)
4.9/5
(43)

Which of the following is true about the three bag classes (LinkedBag, ArrayBag, ArraySortedBag)?

(Multiple Choice)
4.7/5
(33)

A primary purpose of using inheritance is to eliminate redundant code.

(True/False)
4.9/5
(45)

In the constructor for the ArrayBag class shown below, what is the missing code? Def __init__(self, sourceCollection = None): < missing code > AbstractBag.__init__(self, sourceCollection)

(Multiple Choice)
4.7/5
(42)

What would be the purpose of creating a more general abstract class called AbstractCollection ?

(Multiple Choice)
4.9/5
(45)

The __init__ method in the parent class is automatically called by a subclass of the parent class.

(True/False)
4.9/5
(39)

What is the syntax for the calling the __init__ method in the ArrayBag class from the ArraySortedBag class?

(Multiple Choice)
4.7/5
(35)

If a programmer calls the next function on an iterator object and there is no current item in the sequence, the next function returns the Null item.

(True/False)
4.9/5
(39)

The root class of the Python hierarchy is called object .

(True/False)
4.8/5
(41)

When looking at a hierarchy of abstract classes, the classes trend from the more specific to the more general going from the top to the bottom of the hierarchy.

(True/False)
4.9/5
(45)

When calling the __init__ method from a subclass, you need to include the self argument.

(True/False)
4.8/5
(36)

An abstract class is always used to create objects in client applications.

(True/False)
4.7/5
(40)

A set of methods that could be used on other data structures besides the one they were created for could be used in a general abstract class.

(True/False)
5.0/5
(36)

What is the root class of Python's built-in class hierarchy?

(Multiple Choice)
4.9/5
(32)

What is a class called when the purpose of it is to eliminate redundant methods in other classes?

(Multiple Choice)
4.7/5
(35)

Under which circumstance can an instance variable be moved to an abstract class?

(Multiple Choice)
4.8/5
(48)

When you use inheritance to customize a class, the existing and new class have identical behavior.

(True/False)
4.9/5
(27)

An abstract class captures the common features and behavior of a set of related classes.

(True/False)
4.8/5
(39)

When considering the ArrayBag class and the ArraySortedBag class, which of the following is true?

(Multiple Choice)
4.7/5
(33)
Showing 21 - 40 of 50
close modal

Filters

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