
Python Dictionaries Quiz

Quiz
•
Computers
•
10th Grade
•
Hard

Mick Kilpatrick
Used 2+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the correct syntax to create an empty dictionary in Python?
`empty_dict = []`
`empty_dict = {}`
`empty_dict = ()`
`empty_dict = set()`
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you add a key-value pair to a dictionary in Python?
`dict[key] = value`
`dict.add(key, value)`
`dict.append(key, value)`
`dict.insert(key, value)`
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method is used to remove a key-value pair from a dictionary?
`dict.remove(key)`
`dict.pop(key)`
`dict.delete(key)`
`dict.discard(key)`
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you check if a key exists in a dictionary?
`key in dict`
`dict.has_key(key)`
`dict.contains(key)`
`key.exists(dict)`
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will `len(dict)` return when `dict = {'a': 1, 'b': 2, 'c': 3}`?
`1`
`2`
`3`
`4`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method returns a list of all the keys in a dictionary?
`dict.keys()`
`dict.values()`
`dict.items()`
`dict.get_keys()`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the `dict.get(key, default)` method do?
Returns the value for `key` if `key` is in the dictionary, else `default`
Removes the `key` from the dictionary
Adds `default` to the dictionary if `key` is not found
Updates the value of `key` to `default`
Create a free account and access millions of resources
Similar Resources on Wayground
20 questions
IGCSE ICT DATA MANIPULATION QUIZ_11D

Quiz
•
9th - 11th Grade
17 questions
12CSC Database Normalisation

Quiz
•
9th - 12th Grade
11 questions
PyGame (пайгейм) кітапханасы

Quiz
•
10th Grade
12 questions
PowerPoint Quiz

Quiz
•
7th Grade - University
14 questions
MEMO QUIZ

Quiz
•
9th - 12th Grade
16 questions
IBA Chapter 8B

Quiz
•
8th - 12th Grade
14 questions
Mobile Devices

Quiz
•
9th - 12th Grade
11 questions
The keyboard and mouse

Quiz
•
4th Grade - Professio...
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade
29 questions
AP CSP Unit 2 Review (Code.org)

Quiz
•
10th - 12th Grade