Exam 10: Dictionaries and Sets

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

The index of the first element in a set is 0.

Free
(True/False)
4.9/5
(69)
Correct Answer:
Verified

False

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

Free
(Short Answer)
5.0/5
(67)
Correct Answer:
Verified

pop

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']

Free
(Multiple Choice)
4.8/5
(71)
Correct Answer:
Verified

A

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)
4.9/5
(74)

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

(True/False)
4.8/5
(74)

What is the number of the first index in a list dictionary?

(Multiple Choice)
4.9/5
(72)

Which method would you use to return the value associated with a specified key and remove that key-value pair from the dictionary?

(Multiple Choice)
4.8/5
(78)

What would be the result of the following code? ages = {'Aaron' : 6, 'Kelly' : 3, 'Abigail' : 1 } Value = ages['Brianna']

(Multiple Choice)
4.9/5
(71)

In a dictionary, you use a(n) _____ to locate a specific value.

(Multiple Choice)
4.7/5
(83)

Sets are immutable.

(True/False)
4.7/5
(86)

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

(True/False)
4.9/5
(91)

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

(True/False)
4.8/5
(88)

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

(Multiple Choice)
4.9/5
(71)

To write an object to a file, you use the _______________ function of the _______________ module.

(Short Answer)
4.9/5
(75)

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

(Multiple Choice)
5.0/5
(73)

To add a single item to a set, you can use the set method _______________.

(Short Answer)
4.9/5
(84)

Which of the following does not apply to sets?

(Multiple Choice)
5.0/5
(73)

Which statement would you use to delete an existing key-value pair from a dictionary?

(Multiple Choice)
4.9/5
(72)

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.8/5
(88)

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.9/5
(82)
Showing 1 - 20 of 35
close modal

Filters

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