Dictionary in Python Quiz for Class 11-12

Last updated on January 5th, 2022 at 09:25 am

Dictionary in Python Quiz for Class 11

The quiz contains 16 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck!

1. What is printed by the following statements?

D1 = {“cat”:17, “dog”:6, “elephant”:23, “bear”:20}

print (25 in D1)

 
 
 
 

2. Dictionaries are _____ data types of Python.

 
 
 
 

3. Which of the following will delete key_value pair for key = “tiger” in dictionary?

di = {“loin” : “wild”, “tiger” : “wild”, “cat”:”domestic” : “dog” : “domestic”}

 
 
 
 

4. What will be the output after the following statements?

x = {1:’Jan’, 2:’Feb’, 3:’March’, 4:’April’}

print(x[2])

 
 
 
 

5. What will be the output of the following Python code snippet?

d1 = {“Amit”:34, “Arnav”:45}

d2 = {“Amit”:46, “Arnav”:45}

d1 == d2

 
 
 
 

6. d = {“Amit”:40, “Abhay”:45}

To delete the entry for “Amit” what command do we use?

 
 
 
 

7. What will be the result of the following code?

d1 = {“abc”:5,”def”:6, “ghi”:7}

print (d1[0])

 
 
 
 

8. Dictionaries are also called _____.

 
 
 
 

9. Which of the following will raise an error if the given key is not found in the dictionary?

 
 
 
 

10. Which of the following functions will return the key, value pairs of a dictionary?

 
 
 
 

11. What will the following code do?

dict = {“Phy”:94, “Che”: 70, “Bio”:82, “Eng”:95}

dict.update({“Che”:72,”Bio”:80})

 
 
 
 

12. What would the following code print?

d = {‘spring’: ‘autumn’, “autumn”: “fall”, “fall”:”spring”}

print (d[“autumn”])

 
 
 
 

13. Which of the following can be used to delete item(s) from a dictionary?

 
 
 
 

14. What will be the output after the following statements?

x = {0:4, 1:8, 2:16, 3:32}

print(x.items())

 
 
 
 

15. What is printed by the following statements?

D1 = {“cat”:17, “dog”:6, “elephant”:23, “bear”:20}

print (“dog” in D1)

 
 
 
 

16. What will be the output after the following statements?

x = {0:4, 1:8, 2:16, 3:32}

print(x.keys())

 
 
 
 

Question 1 of 16

Jitendra Singh
✔ Verified Educator

Jitendra Singh

Founder of CBSEPython.in

I help CBSE Class 9–12 students learn Python, Information Technology, Artificial Intelligence and Computer Science through easy notes, quizzes, MCQs and sample papers.

Read More About Me →

Leave a Comment

error: Content is protected !!