Exam 9: Dictionaries and Sets

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

What is the correct structure to create a dictionary of months where each month will be accessed by its month number (for example,January is month 1,April is month 4)?

Free
(Multiple Choice)
4.9/5
(78)
Correct Answer:
Verified

B

A dictionary can include the same value several times but cannot include the same key several times.

Free
(True/False)
4.8/5
(85)
Correct Answer:
Verified

True

The union of two sets is a set that contains only the elements that appear in both sets.

Free
(True/False)
4.8/5
(77)
Correct Answer:
Verified

False

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

(Short Answer)
4.8/5
(86)

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

(Multiple Choice)
4.7/5
(78)

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

(Multiple Choice)
4.8/5
(84)

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

(Short Answer)
4.8/5
(77)

Sets are created using curly braces { }.

(True/False)
4.8/5
(63)

Sets are immutable.

(True/False)
4.9/5
(79)

What is the value of the variable phones after the following code executes? Phones = {'John' : '5555555','Julie' : '5557777'} Phones['John'] = 5556666'

(Multiple Choice)
4.9/5
(81)

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

(Multiple Choice)
4.9/5
(87)

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

(True/False)
4.7/5
(101)

Which would you use to get the number of elements in a dictionary?

(Multiple Choice)
4.8/5
(78)

What does the get method do if the specified key is not found in the dictionary?

(Multiple Choice)
4.9/5
(71)

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

(Multiple Choice)
4.9/5
(81)

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

(Short Answer)
4.9/5
(67)

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

(Multiple Choice)
4.9/5
(91)

The __________ method returns all of a dictionary's keys as a dictionary view.

(Short Answer)
5.0/5
(68)

You would typically use a for loop to iterate over the elements in a set.

(True/False)
4.8/5
(83)

A(n)__________ is an object that holds multiple unique items of data in an unordered manner.

(Short Answer)
4.9/5
(71)
Showing 1 - 20 of 39
close modal

Filters

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