Filters
Question type

Study Flashcards

In the remove method for LinkedBag, if probe points to the node at the head of the linked structure, trailer will point to the tail.

A) True
B) False

Correct Answer

verifed

verified

The code for the __iter__ method is shown below. What is the missing code? Def __iter__(self) : < missing code > While cursor < len(self) : Yield self.items[cursor] Cursor += 1


A) cursor = 0
B) cursor = 1
C) cursor = self.size
D) cursor = len(self)

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

Which of the following is one of the hallmarks of well-designed software?


A) a random grouping of interfaces to ensure secure code
B) an interface that is tightly coupled to the implementation
C) the clean separation of interfaces from implementations
D) a sophisticated interface with a high learning curve

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

C

What does Python do when it sees a for loop on an iterable object?


A) executes a do loop
B) runs the __iter__ method
C) runs the clear method
D) executes a return statement

E) B) and C)
F) A) and D)

Correct Answer

verifed

verified

Data that is needed to represent the state of a collection are assigned instance variables in the __help__ method of the class.

A) True
B) False

Correct Answer

verifed

verified

Class diagrams show the relationships among classes at various levels of detail.

A) True
B) False

Correct Answer

verifed

verified

A precondition is a statement of what must be true for a method to perform its actions correctly.

A) True
B) False

Correct Answer

verifed

verified

In the ArrayBag class, what must the __init__ method do if a source collection is specified?


A) the new instantiation of the bag must be copied to the source collection.
B) the source collection must be initialized with the clear method
C) the data in the source collection must be deleted
D) the data in the source collection must be copied

E) A) and C)
F) A) and D)

Correct Answer

verifed

verified

Each time you run Python's document function to obtain information about a module, data type, method, or function, you are accessing documentation about that resource's interface.

A) True
B) False

Correct Answer

verifed

verified

The following code copies the data from a specified source collection in the LinkedBag __init__ method. What is the missing code? for item in sourceCollection: < missing code >


A) add(item.self)
B) self.add(item)
C) self.item(add)
D) self.item = source.item

E) A) and C)
F) A) and B)

Correct Answer

verifed

verified

What testing tool can be used to help ensure that a resource meets its requirements?


A) unittest
B) pytest
C) pyunit
D) unitcheck

E) C) and D)
F) All of the above

Correct Answer

verifed

verified

Which of the following methods will require changes between the ArrayBag and the LinkedBag class?


A) isEmpty
B) remove
C) __eq__
D) __len__

E) B) and C)
F) None of the above

Correct Answer

verifed

verified

While desirable, testing is not a critical part of software resource development.

A) True
B) False

Correct Answer

verifed

verified

False

What is one of the pieces of data that must be initialized in the __init__ method in the LinkedBag class?


A) an array
B) a linked structure
C) a physical size
D) a string pointer

E) A) and C)
F) None of the above

Correct Answer

verifed

verified

What method does Python run when it sees the in operator used with a collection?


A) __contains__
B) __iter__
C) __eq__
D) __add__

E) All of the above
F) None of the above

Correct Answer

verifed

verified

A

How can the performance of the in and remove functions be described in the two bag implementations?


A) they take linear time
B) they take constant time
C) the performance is exponential according to the size of the bag
D) the performance is logarithmic according to the size of the bag

E) B) and C)
F) All of the above

Correct Answer

verifed

verified

Which is true about a bag collection?


A) it is an unordered collection
B) it is a standard collection type in Python
C) bags can contain only numeric objects
D) bags are of a fixed size

E) A) and D)
F) All of the above

Correct Answer

verifed

verified

A docstring is a string enclosed in double quotes that will be displayed when Python's help function is run on a resource.

A) True
B) False

Correct Answer

verifed

verified

You can use a for loop on any collection.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is NOT a goal of the barrier that separates an interface from implementation?


A) allows users to quickly glue resources together
B) allows alternative implementations of the same resource
C) changes to a resource's implementations do not disturb user code
D) increases the learning curve for resource's users

E) All of the above
F) B) and C)

Correct Answer

verifed

verified

Showing 1 - 20 of 50

Related Exams

Show Answer