Ch. 9 Intro To Python: Lesson 9-6 Dictionaries
Quiz
•
Education
•
9th - 12th Grade
•
Practice Problem
•
Hard
Tim Sexton
Used 3+ times
FREE Resource
Enhance your content in a minute
10 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
2 mins • 1 pt
Which of the following are true of Python dictionaries:
select all that apply
All the keys in a dictionary must be of the same type.
Dictionaries can be nested to any depth.
Dictionaries are accessed by key.
A dictionary can contain any object type except another dictionary.
Dictionaries are mutable.
2.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Which of the following is not a valid way to define this dictionary in Python:
d = dict([
('foo', 100),
('bar', 200),
('baz', 300) ])
d = {'foo': 100, 'bar': 200, 'baz': 300}
d = { ('foo', 100), ('bar', 200), ('baz', 300) }
d = {} d['foo'] = 100 d['bar'] = 200 d['baz'] = 300
d = dict(foo=100, bar=200, baz=300)
3.
FILL IN THE BLANK QUESTION
2 mins • 1 pt
What statement will remove the entry in the dictionary for key 'baz'?
4.
FILL IN THE BLANK QUESTION
2 mins • 1 pt
Write the Python code that prints out Captain Kirk’s email address from the employee dictionary below:
Add your code below:
5.
MULTIPLE SELECT QUESTION
2 mins • 1 pt
Which Python code could replace the ellipsis (...) below to get the following output to the left?
(Select all that apply.)
for ship, captain in captains.items(): print(ship, captain)
for ship in captains: print(ship, captains)
for ship in captains: print(ship, captains[ship])
6.
MULTIPLE SELECT QUESTION
2 mins • 1 pt
Which of the following statements about this nested dictionary are true? (Select all that apply.)
The values for "California", "New York", and "Texas" are all dictionaries.
You can access the nested values directly by chaining square brackets ([]).
If you want to access the nested values, then you need to split the dictionary.
The syntax isn’t valid.
7.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Which of the following lines of code will create an empty dictionary named captains?
captains.dict()
captains = {dict}
type(captains)
captains = {}
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
Discover more resources for Education
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
10 questions
Understanding Meiosis
Interactive video
•
6th - 10th Grade
15 questions
Meiosis vs mitosis
Quiz
•
9th Grade
10 questions
Exploring the Origins of Veterans Day
Interactive video
•
6th - 10th Grade
28 questions
Ser vs estar
Quiz
•
9th - 12th Grade
16 questions
Ethos, Pathos, Logos Practice
Quiz
•
9th Grade
15 questions
Two Step Equations
Quiz
•
9th Grade
