Exam 10: Dictionaries and Sets
Exam 1: Introduction to Computers and Programming35 Questions
Exam 2: Input, Processing, and Output35 Questions
Exam 3: Simple functions34 Questions
Exam 4: Decision Structures and Boolean Logic35 Questions
Exam 5: Repetition Structures35 Questions
Exam 6: Value-Returning functions and Modules35 Questions
Exam 7: files and Exceptions35 Questions
Exam 8: Lists and Tuples35 Questions
Exam 9: More About Strings35 Questions
Exam 10: Dictionaries and Sets35 Questions
Exam 11: Classes and Object-Oriented Programming35 Questions
Exam 12: Inheritance35 Questions
Exam 13: Recursion35 Questions
Exam 14: GUI Programming35 Questions
Select questions type
The index of the first element in a set is 0.
Free
(True/False)
4.9/5
(69)
Correct Answer:
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:
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:
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)
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)
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 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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)