Exam 9: Dictionaries and Sets

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

Which method would you use to returns all the elements in the dictionary as a list of tuples?

(Multiple Choice)
4.9/5
(80)

What is the value of the variable phones after the execution of the following code? Phones = {'John': '5555555', 'Julie' : '7777777'} Phones['John'] = '1234567'

(Multiple Choice)
4.7/5
(80)

The index of the first key-value pair in a dictionary is 0.

(True/False)
4.9/5
(84)

You created the following dictionary relationships = {'Jimmy':'brother'}. You then executed the following code, and received a KeyError exception. What is the reason for the exception? Relationships['jimmy']

(Multiple Choice)
4.8/5
(86)

In order to avoid KeyError exceptions, you can check whether a key is in the dictionary using the _____ operator.

(Multiple Choice)
4.8/5
(75)

What is the correct structure for creating a dictionary of month names to be accessed by month numbers?

(Multiple Choice)
4.8/5
(81)

The difference of set1 and set2 is a set that contains only the elements that appear in set1 but do not appear in set2.

(True/False)
5.0/5
(90)

The _______________ method returns a value associated with a specified key and if found, removes that key-value pair from the dictionary.

(Short Answer)
4.9/5
(79)

The elements in a dictionary are not stored in a specific order. Therefore a dictionary is not a(n) _______________.

(Short Answer)
4.9/5
(75)

The issubset method can be used to determine whether set1 is a subset of set2.

(True/False)
4.9/5
(70)

The _______________ of two sets is a set that contains all the elements of both sets.

(Short Answer)
4.8/5
(84)

The built-in function _______________ returns the number of items in a set.

(Short Answer)
4.9/5
(69)

The set remove and discard methods behave differently only when a specified item is not found in the set.

(True/False)
4.8/5
(69)

What method can be used to add a group of elements to a set?

(Multiple Choice)
4.9/5
(68)

To determine whether a key is not included in a dictionary, or an element is not included in a set, you can use the _______________ operator.

(Short Answer)
4.7/5
(79)
Showing 21 - 35 of 35
close modal

Filters

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