PYnative

Python Programming

  • Learn Python
  • Exercises
  • Quizzes
  • Code Editor
  • Tricks
Home » Python » Quizzes » Python Dictionary Quiz

Python Dictionary Quiz

Updated on: August 24, 2022 | 11 Comments

This Python dictionary quiz provides Multiple Choice Questions(MCQ) to get familiar with Python dictionary operations. Python dictionary is the most widely used data structure, and a good understanding of dictionary operations is necessary. This online quiz focuses on testing your Python dictionary skills.

Also, See: Python Dictionary Exercise.

  • The quiz contains 14 Questions. Solve 10 correct to pass the test.
  • You will have to read all the given answers and click over the correct answer.
  • Read guide on Dictionaries in Python to solve this quiz

1. What is the output of the following code

dict1 = {"key1":1, "key2":2}
dict2 = {"key2":2, "key1":1}
print(dict1 == dict2)
 
 

2. Select all correct ways to copy a dictionary in Python

 
 
 

3. What is the output of the following dictionary operation

dict1 = {"name": "Mike", "salary": 8000}
temp = dict1.pop("age")
print(temp)
 
 

4. Dictionary keys must be immutable

 
 

5. Items are accessed by their position in a dictionary and All the keys in a dictionary must be of the same type.

 
 

6. Select the correct ways to get the value of marks key.

student = {
  "name": "Emma",
  "class": 9,
  "marks": 75
}
 
 
 
 

7. Select the correct way to access the value of a history subject

sampleDict = { 
   "class":{ 
      "student":{ 
         "name":"Mike",
         "marks":{ 
            "physics":70,
            "history":80
         }
      }
   }
}
 
 
 

8. What is the output of the following

sampleDict = dict([
    ('first', 1),
    ('second', 2),
    ('third', 3)
])
print(sampleDict)
 
 
 

9. Please select all correct ways to empty the following dictionary

student = { 
  "name": "Emma", 
  "class": 9, 
  "marks": 75 
}
 
 
 

10. Select the all correct way to remove the key marks from a dictionary

student = { 
  "name": "Emma", 
  "class": 9, 
  "marks": 75 
}
 
 
 
 

11. Select the correct way to print Emma’s age.

student = {1: {'name': 'Emma', 'age': '27', 'sex': 'Female'},
           2: {'name': 'Mike', 'age': '22', 'sex': 'Male'}}
 
 
 

12. Select correct ways to create an empty dictionary

 
 
 

13. In Python, Dictionaries are immutable

 
 

14. What is the output of the following dictionary operation

dict1 = {"name": "Mike", "salary": 8000}
temp = dict1.get("age")
print(temp)
 
 

Loading ... Loading …

Loading

Filed Under: Python, Python Basics, Python Quizzes

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Founder of PYnative.com I am a Python developer and I love to write articles to help developers. Follow me on Twitter. All the best for your future Python endeavors!

Related Tutorial Topics:

Python Python Basics Python Quizzes

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 10 questions
  • Each Quiz contains 12-15 MCQ
Exercises
Quizzes

Posted In

Python Python Basics Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

  • Python Quizzes Home
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Functions Quiz
  • if else and loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

All Python Topics

Python Basics Python Exercises Python Quizzes Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our Terms Of Use, Cookie Policy, and Privacy Policy.

Copyright © 2018–2023 pynative.com