Which of the following is the correct way to create an empty dictionary in Python?
Section 3D: Collect and process data using dictionaries

Quiz
•
Computers
•
12th Grade
•
Medium
Misti McDaniel
Used 5+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
`my_dict = []`
`my_dict = {}`
`my_dict = ()`
`my_dict = set()`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? ```python my_dict = {'a': 1, 'b': 2} print(my_dict['b']) ```
`'b'`
`1`
`2`
`KeyError`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method would you use to get a list of all the keys in a dictionary?
`values()`
`items()`
`keys()`
`get()`
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you add a new key-value pair to an existing dictionary called `d` with key `'x'` and value `10`?
`d.add('x', 10)`
`d['x'] = 10`
`d.append('x', 10)`
`d.insert('x', 10)`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements will remove the key `'age'` from the dictionary `person`?
`person.remove('age')`
`del person['age']`
`person.popitem('age')`
`person.clear('age')`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the dictionary `d = {'a': 1, 'b': 2, 'c': 3}`, which code will check if the key `'b'` exists in `d`?
`'b' in d`
`d.has_key('b')`
`'b' == d`
`d['b'] == None`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method returns a view object that displays a list of a dictionary's key-value tuple pairs?
`keys()`
`values()`
`items()`
`pairs()`
Create a free account and access millions of resources
Similar Resources on Quizizz
15 questions
Python Skills

Quiz
•
1st Grade - Professio...
10 questions
Python Basics Test

Quiz
•
12th Grade
16 questions
Quizz

Quiz
•
1st - 12th Grade
20 questions
Python Basics Review (TSK)

Quiz
•
9th - 12th Grade
10 questions
Dictionary in Python

Quiz
•
11th - 12th Grade
10 questions
Python lists and tuples

Quiz
•
12th Grade
20 questions
Python Programming II CSE A

Quiz
•
12th Grade - University
10 questions
Data Structures Quiz

Quiz
•
12th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University