Topics-Dictionary: introduction, accessing items in a dictionary using keys, mutability of a dictionary (adding a new term, modifying an existing item), traversing a dictionary, built-in functions/methods – len(), dict(), keys(), values(), items(), get(), update(), del(), del, clear(), fromkeys(), copy(), pop(), popitem(), setdefault(), max(), min(), sorted(); Suggested programs: count the number of times a character appears in a given string using a dictionary, create a dictionary with names of employees, their salary and access them.

1. What is a dictionary in programming?

 
 
 
 

2. How can you access the value associated with a specific key in a dictionary?

 
 
 
 

3. Can you modify the values in a dictionary?

 
 
 
 

4. How can you add a new key-value pair to a dictionary?

 
 
 
 

5. How can you traverse a dictionary in Python?

 
 
 
 

6.  

Which built-in function is used to determine the number of key-value pairs in a dictionary?

 
 
 
 

7. Which built-in method is used to return a list of all the keys in a dictionary?

 
 
 
 

8. Which built-in method is used to return a list of all the values in a dictionary?

 
 
 
 

9. Which built-in method is used to return a list of all the key-value pairs in a dictionary?

 
 
 
 

10. Which built-in method is used to retrieve the value associated with a key in a dictionary?

 
 
 
 

11. Which built-in method is used to update a dictionary with the key-value pairs from another dictionary?

 
 
 
 

12. Which built-in method is used to remove a key-value pair from a dictionary?

 
 
 
 

13. Which built-in method is used to remove and return a key-value pair from a dictionary?

 
 
 
 

14. Which built-in method is used to return the maximum key in a dictionary?

 
 
 
 

15. Which suggested program involves counting the number of times a character appears in a given string using a dictionary?

 
 
 
 

By cbsepython

A complete solution for the students of class 9 to 12 having subject Information Technology (402), Computer Science (083). Explore our website for all the useful content as Topic wise notes, Solved QNA, MCQs, Projects and Quiz related to the latest syllabus.