Python Dictionaries are unordered, mutable collections used to store data as key-value pairs. This quiz will help you master dictionary creation, access, update, and built-in methods through real-world Python usage examples.
Time limit: 0
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
What is the correct way to define a dictionary in Python?
Correct
Incorrect
Question 2 of 15
2. Question
What does the keys() method return?
Correct
Incorrect
Question 3 of 15
3. Question
What is the output of len({“a”: 1, “b”: 2, “c”: 3})?
Correct
Incorrect
Question 4 of 15
4. Question
Which method is used to return all key-value pairs?
Correct
Incorrect
Question 5 of 15
5. Question
What is the output of d = {“x”: 5}; print(d[“x”])?
Correct
Incorrect
Question 6 of 15
6. Question
Which method removes all items from a dictionary?
Correct
Incorrect
Question 7 of 15
7. Question
What happens if you access a key that doesn’t exist in a dictionary using []?
Correct
Incorrect
Question 8 of 15
8. Question
Which method can safely return a value for a given key or return a default?
Correct
Incorrect
Question 9 of 15
9. Question
Which of these can be used as a dictionary key?
Correct
Incorrect
Question 10 of 15
10. Question
What does dict1.update(dict2) do?
Correct
Incorrect
Question 11 of 15
11. Question
Which method removes an item by key and returns its value?
Correct
Incorrect
Question 12 of 15
12. Question
What does this return?
d = {“a”: 1, “b”: 2} print(“c” in d)
Correct
Incorrect
Question 13 of 15
13. Question
Which of these is invalid dictionary syntax?
Correct
Incorrect
Question 14 of 15
14. Question
What will this code do?
a = {} a[0] = “zero” print(a)
Correct
Incorrect
Question 15 of 15
15. Question
What is the output of this code?
d = {“a”: 1, “b”: 2} print(list(d.values()))
Correct
Incorrect
Summary
These Python Dictionary MCQs help learners understand key-value operations, methods like `get()`, `pop()`, `update()`, and the rules around keys and immutability. Mastering dictionaries is essential for data manipulation and real-world applications in Python.
At QuizOrbit, our team specializes in fun, informative quizzes across topics like general knowledge, technology, and entertainment. Boost your knowledge with our expert-designed quizzes.