Exam 5: Interfaces, Implementations, and Polymorphism

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

The __iter__ method uses a yield statement to send each item to the calling for loop.

(True/False)
4.9/5
(30)

When defining the Bag class, the __init__ operation is the constructor for the class.

(True/False)
4.8/5
(27)

You should always try to hide the implementing data structures behind a wall of method calls on the object being implemented.

(True/False)
4.8/5
(46)

In the Bag class defined in the chapter, what is one of the purposes of the sourceCollection argument in the __init__ method?

(Multiple Choice)
4.8/5
(42)

What is it called when the contents of two bags are combined into a third bag?

(Multiple Choice)
4.9/5
(42)

Software bags can grow as more items are added, or they can shrink as items are removed.

(True/False)
4.9/5
(35)

Once the designer of a collection class has obtained its interface, the implementation of the class includes completing code for the methods.

(True/False)
4.9/5
(36)

The running times of the operations of ArrayBag and LinkedBag are similar.

(True/False)
4.8/5
(32)

Why won't some of the ArrayBag methods require changes when implementing the LinkedBag class?

(Multiple Choice)
4.9/5
(36)

When used with a bag object, the in operator returns an integer value.

(True/False)
4.8/5
(38)

In the ArrayBag class, why must the ArrayBag object track its logical size in a separate instance variable?

(Multiple Choice)
4.9/5
(34)

The __iter__ method is identical in the ArrayBag and LinkedBag classes.

(True/False)
4.7/5
(41)

Which of the following is a visual aid to help catalog resources in your software toolbox?

(Multiple Choice)
4.8/5
(44)

The statement in the ArrayBag constructor to copy an item from a source collection to a new ArrayBag object is self.init(item) .

(True/False)
4.9/5
(28)

What word is best defined as the use of common names for operations on different types of collections?

(Multiple Choice)
4.9/5
(45)

In the ArrayBag class, what function does the __str__ method use to generate a sequence of strings from a bag?

(Multiple Choice)
5.0/5
(41)

An interface's documentation gives you enough information to know how to use or call a method and what to expect it to accomplish and return.

(True/False)
4.9/5
(41)

A bag is a type of ordered collection.

(True/False)
4.9/5
(26)

The clear method empties a bag.

(True/False)
4.8/5
(43)

Whenever you need to use the logical size of the bag within a class definition, run len(self) instead of referring directly to the instance variable self.size .

(True/False)
4.9/5
(33)
Showing 21 - 40 of 50
close modal

Filters

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