
Mastering Python Dictionaries Quiz
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Hard
Devin Lachapelle
FREE Resource
Enhance your content in a minute
11 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct way to create an empty dictionary in Python?
empty_dict = []
empty_dict = {}
empty_dict = ()
empty_dict = set()
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the dictionary student = {"name": "Alice", "age": 18}, how would you access the value associated with the key "name"?
student["name"]
student.name
student{"name"}
student
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you add a new key-value pair "grade": "A" to the dictionary student = {"name": "Alice", "age": 18}?
student.add("grade", "A")
student["grade"] = "A"
student.create({"grade": "A"})
student + "grade":"A"
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
student = {"name": "Alice", "age": 18}
print(student["grade"])
None
"A"
KeyError
0
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the result of the following code? ```python student = {"name": "Alice", "age": 18} student["age"] = 19 print(student) ```
`{"name": "Alice", "age": 18}`
`{"name": "Alice", "age": 19}`
`{"name": "Alice", "age": 18, "age": 19}`
`Error`
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code? ```python student = {"name": "Alice", "age": 18} for key, value in student.items(): print(key, value) ```
`name Alice age 18`
`("name", "Alice") ("age", 18)`
`name: Alice, age: 18`
`name Alice \n age 18`
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How can you get a list of all values in a dictionary `student = {"name": "Alice", "age": 18}`?
`student.values()`
`list(student)`
`student.keys()`
`student.items()`
Access all questions and much more by creating a free account
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
Already have an account?
Similar Resources on Wayground
10 questions
R082 Book Cover Assets planning
Quiz
•
7th - 12th Grade
10 questions
Computer
Quiz
•
6th - 12th Grade
15 questions
HTML Quiz
Quiz
•
11th Grade - University
10 questions
Treasure Hunt
Quiz
•
12th Grade
16 questions
LA3.C3: Variables
Quiz
•
9th Grade - University
10 questions
Email Quiz - PWHS
Quiz
•
1st - 12th Grade
10 questions
Among us youtubers
Quiz
•
KG - Professional Dev...
10 questions
Component of Motherboard
Quiz
•
12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
