1
CHAPTER: DICTIONARY IN PYTHON
ASSIGNMENT SET – 1
Time: 30 min M.M. – 20
Instructions:
 All Questions are compulsory
 Q1 to Q6 carry 1 mark
 Q7 to Q10 carry 2 marks
 Q11 to Q12 carry 3 marks
Q1. Keys must be ______ in dictionary.(mutable/immutable)
Q2. Write a built in function which is used to create an empty dictionary.
Q3. Write the code to print only keys of the following dictionary.
D = {“Amit” : 40, “Sunil” : 34, “Naina” : 30}
Q4. Write the code to add the following detail in dictionary given above.
“Ravi” – 45
Q5. Write the output of the following code:
D = {“Amit” : 40, “Sunil” : 34, “Naina” : 30}
print(D[‘Amit’] + D[‘Sunil’])
Q6. Name the function which is used to return a value of the given key.
Q7. Write two differences between List and Dictionary.
2
Q8. Write the output of the following:
m = {1 : "Jan", 2 : 'Jun', 3 : 'Aug'}
print(m[1])
print(m["jan"])
Q9. Explain keys() function of dictionary with example.
Q10. Write one similarity and one difference between del statement and
pop() function in reference to dictionary.
Q11. Find errors in the following statement and write the correct code:
num = {1 : 10, 2 : 20, 3 : 30, 4 : 40, 5 : 50}
a) print(num.item())
b) print(num.len())
c) print(pop(5))
Q12. Write a program to input details of five employees in a dictionary
like employee number, employee name, employee salary and display
their details in tabular form.

CBSE Python Dictionary Assignment

  • 1.
    1 CHAPTER: DICTIONARY INPYTHON ASSIGNMENT SET – 1 Time: 30 min M.M. – 20 Instructions:  All Questions are compulsory  Q1 to Q6 carry 1 mark  Q7 to Q10 carry 2 marks  Q11 to Q12 carry 3 marks Q1. Keys must be ______ in dictionary.(mutable/immutable) Q2. Write a built in function which is used to create an empty dictionary. Q3. Write the code to print only keys of the following dictionary. D = {“Amit” : 40, “Sunil” : 34, “Naina” : 30} Q4. Write the code to add the following detail in dictionary given above. “Ravi” – 45 Q5. Write the output of the following code: D = {“Amit” : 40, “Sunil” : 34, “Naina” : 30} print(D[‘Amit’] + D[‘Sunil’]) Q6. Name the function which is used to return a value of the given key. Q7. Write two differences between List and Dictionary.
  • 2.
    2 Q8. Write theoutput of the following: m = {1 : "Jan", 2 : 'Jun', 3 : 'Aug'} print(m[1]) print(m["jan"]) Q9. Explain keys() function of dictionary with example. Q10. Write one similarity and one difference between del statement and pop() function in reference to dictionary. Q11. Find errors in the following statement and write the correct code: num = {1 : 10, 2 : 20, 3 : 30, 4 : 40, 5 : 50} a) print(num.item()) b) print(num.len()) c) print(pop(5)) Q12. Write a program to input details of five employees in a dictionary like employee number, employee name, employee salary and display their details in tabular form.