GRADE: XII DICTIONARY REVISION WORKSHEET DATE: 16/09/2025
1. Keys must be _________________ in dictionary.
2. Dictionary is also known as ___________________.
3. Write the code to print only keys of the following dictionary.
D={“Amit”:40,”Sunil”:34,”Naina”:30}
4. Write the code to add the following detail in dictionary given above.
“Ravi”-45
5. Write the output of the following code:
D={“Amit”:40,”Sunil”:34,”Naina”:30}
print(D[‘Amit’]+D[‘Sunil’]
6. Name the function which is used to return a value of the given key.
7. Write two differences between List and Dictionary.
8. The following code will return data as ____________________.
B={“A”:”Apple”,”B”:”Bat”,”C”:”Cat”,”D”:”Doll”}
print(B.values())
9. Write the output of the following:
m={1:”Jan”,2:”Jun”,3:”Aug”}
print(m[1])
print(m[“jan”])
10. Explain keys() function of dictionary with example.
11. There is no index value in dictionary like we have in List.(T/F)
12. Write the output of the following
A={1:”One”,2:”Two”,3:”Three”}
B={“A”:”Apple”,”B”:”Bat”,”C”:”Cat”,”D”:”Doll”}
print(A.get(4,”Key Not Found”))
13. Which statement is not correct for the following code?
A={1:”One”,2:”Two”,3:”Three”}
A[4]=”Four”
a. It will add value at the end of dictionary
b. It will modify value if the key already exists
c. It will add value in between of the dictionary
14. Find the errors in the following statement and write the correct code:
num={1:10,2:20,3:30,4:40,5:50}
a. print(num.items())
b. print(num.len())
c. print(pop(5))
15. Write a program to input details of five employees in a dictionary like employee number, employee
name, employee salary and display their details.
16. Which of the following will delete key:value pair for key="tiger" in dictionary? di =
{"lion":"wild","tiger":"wild", "cat": "domestic","dog":"domestic"}
a. del di["tiger"]
b. del(di.["tiger"])
c. delete(di.["tiger"])
d. di["tiger"].delete()
17. Write the output of the following:
d={1:”Amit”,2:”Sumit”,5:”Kavita”}
print(len(d)
print(d.get(2))
d.pop(5)
print(d)
d.clear()
print(d)
a=list(d.items())
print(a)
print(len(a))
18. Write a function check(key) which takes a key as an argument and check whether that key is
present in dictionary or not.
19. Find the output
dict = {}
a, b, c = 15, 25, 35
dict[a, b, c] = a + b - c
a, b, c = 25, 20, 40
dict[a, b, c] = a + b - c
print(dict)
20. What is the output of the following code?
dry = {0: 'a', 1: 'b', 2: 'c'}
for x, y in dry. items():
print(x, y, end = ' ')
21. Write a program to accept a key from the user and remove that key from the dictionary if present.
22. Write a program in python to display the maximum and minimum value in dictionary.
23. Write a program in python to remove the duplicate values from the dictionary.
For example,
Original dictionary={1:”Aman”,2:”Suman”,3:”Aman”}
New dictionary={1””Aman”,2:”Suman”}
24. Write a program to store information of products like product id, product name and product price
in a dictionary by taking product id as a key.
25. Write a program to accept the employee id from the user and display its detail from the dictionary.
Data is stored in the dictionary in the following format.
{Empid:( Empname, EmpSalary}
26. Write a program to accept the employee id from the user and check Salary. If salary is less than
25000 then increase the salary by Rs. 1000. Data is stored in the dictionary in the following format.
{Empid:( Empname, EmpSalary}
27. Write a program to count the frequency of each word in a given string accepted from the user using
dictionary.
28. Write a program to accept roll number, names and marks of five students and store the detail in
dictionary using roll number as key. Also display the sum of marks of all the five students.