Exam 9: Dictionaries and Sets
Exam 1: Introduction to Computers and Programming36 Questions
Exam 2: Input, Processing, and Output35 Questions
Exam 3: Decision Structures and Boolean Logic35 Questions
Exam 4: Repetition Structures34 Questions
Exam 5: Functions and Modules69 Questions
Exam 6: Files and Exceptions34 Questions
Exam 7: Lists and Tuples35 Questions
Exam 8: More About Strings35 Questions
Exam 9: Dictionaries and Sets35 Questions
Exam 10: Classes and Object Oriented Programming35 Questions
Exam 11: Inheritance35 Questions
Exam 12: Recursion35 Questions
Exam 13: GUI Programming35 Questions
Select questions type
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)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)