Filters
Question type

Study Flashcards

Which real-world item best represents a hierarchical collection?


A) a queue of customers
B) wiring diagrams
C) a box of legos
D) a family tree

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

Correct Answer

verifed

verified

Which of the following is an unordered collection?


A) string
B) stack
C) dictionary
D) queue

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

Correct Answer

verifed

verified

When a for loop is used to iterate over a collection, which statement is true?


A) list items are visited from last to first
B) items in a list are visited in a random order
C) items in a sorted collection are visited in ascending order
D) items in a dictionary are visited in descending order

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

Correct Answer

verifed

verified

C

If you clone an object using the = operator (as in myList=list(yourList) ), the is operator returns True while the == operator returns False.

A) True
B) False

Correct Answer

verifed

verified

When using a for loop to iterate over a list, the items are visited in no particular order.

A) True
B) False

Correct Answer

verifed

verified

Which operator is used to obtain a string representation of a collection?


A) len
B) char
C) str
D) in

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

Correct Answer

verifed

verified

What is the value of aList after the following code is executed? AList = [ 10, 20, 30 ] AList.pop()


A) [ 10, 20, 30 ]
B) [ 10,20 ]
C) [ ]
D) [ 20, 30 ]

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

Correct Answer

verifed

verified

In Python, modules and methods are the smallest units of abstraction, classes are the next in size, and functions are the largest.

A) True
B) False

Correct Answer

verifed

verified

False

A sorted collection must be in a linear structure, ordered by position.

A) True
B) False

Correct Answer

verifed

verified

The use of collections is a Python programming requirement, but they are not very useful for working with real-world objects.

A) True
B) False

Correct Answer

verifed

verified

Python includes two implementations of lists: arrays and linked lists.

A) True
B) False

Correct Answer

verifed

verified

What is the value of myObject after the following code executes? YourObject = "Hi" MyObject = tuple(yourObject)


A) ('H', 'i')
B) [ "H", "i" ]
C) (Hi)
D) ("Hi")

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

Correct Answer

verifed

verified

Which of the following is true about Python collections?


A) most can be heterogeneous
B) all are homogeneous
C) they are typically static
D) all are immutable object types

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

Correct Answer

verifed

verified

A set is a built-in Python collection type.

A) True
B) False

Correct Answer

verifed

verified

True

Use the & operator to concatenate two collections.

A) True
B) False

Correct Answer

verifed

verified

Which statement is true about a sorted collection?


A) must be ordered by position
B) they need not be linear
C) searching is inefficient
D) a box of donuts is an example

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

Correct Answer

verifed

verified

A tuple is an immutable collection type.

A) True
B) False

Correct Answer

verifed

verified

Which of the following is a special case of type conversion, where the two collections are of the same type?


A) replacing
B) copying
C) duplicating
D) cloning

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

Correct Answer

verifed

verified

What is the value of c after the following code executes? A = [ 10, 20, 30 ] B = [ 40, 50, 60 ] C = a + b


A) [ 50, 70, 90 ]
B) {[ 10, 20, 30 ], [ 40, 50, 60 ]}
C) [ 10, 20, 30, 40, 50, 60 ]
D) ([ 10, 40 ], [ 20, 50 ], [ 30, 60 ])

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

Correct Answer

verifed

verified

The map, filter, and reduce functions can only be used on list collections.

A) True
B) False

Correct Answer

verifed

verified

Showing 1 - 20 of 50

Related Exams

Show Answer