PYnative

Python Programming

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

Python Dictionary Quiz

Updated on: March 9, 2021 | Python Tags: Basics Python Quizzes

TweetF  sharein  shareP  Pin

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.

Read Complete Guide on Dictionaries in Python to solve this quiz

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.

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

 
 
 

2. What is the output of the following dictionary operation

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

3. Dictionary keys must be immutable

 
 

4. In Python, Dictionaries are immutable

 
 

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

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

6. What is the output of the following dictionary operation

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

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

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

8. What is the output of the following code

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

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

 
 

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

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

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

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

12. Select correct ways to create an empty dictionary

 
 
 

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

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

14. What is the output of the following

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

Loading ... Loading …

Loading

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:

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

Leave a Reply Cancel reply

your email address will NOT be published. all comments are moderated according to our comment policy.

Use <pre> tag for posting code. E.g. <pre> Your code </pre>

5 Comments

  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
  • Random Data Generation Quiz

All Python Topics

Python Basics Python Exercises Python Quizzes Python Regex Python Random Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON
TweetF  sharein  shareP  Pin

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
  • Privacy Policy
  • Cookie Policy
  • Terms Of Use
  • Contact Us
DMCA.com Protection Status

Copyright © 2018-2021 · [pynative.com]

This website uses cookies to ensure you get the best experience on our website.Privacy PolicyGot it!