Dictionary operations PYQ
PYQ PRACTICE SCOPE: Dictionary operations.
Concept ID: U1_DICTIONARY_OPS.
Use only previous-year questions whose concept_ids include U1_DICTIONARY_OPS.
Key things we'll cover
Dictionary operations
PYQ references used by both prompts29 included0 excluded
Flagged questions are excluded from both Study Notes and PPT references until corrected in Paper Analyzer.
Included
ID 6496 · 2021 · 1 mark(s)
Which of these about a dictionary is false?
a) The values of a dictionary can be accessed using keys
b) The keys of a dictionary can be accessed using values
c) Dictionaries aren't ordered
d) Dictionaries are mutable
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6529 · 2022 · 1 mark(s)
Given the following dictionaries:
dict_exam={"Exam":"AISSCE", "Year":2023}
dict_result={"Total":500, "Pass_Marks":165}
Which statement will merge the contents of both dictionaries?
a) dict_exam.update(dict_result)
b) dict_exam + dict_result
c) dict_exam.add(dict_result)
d) dict_exam.merge(dict_result)
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6548 · 2022 · 2 mark(s)
(a) Given is a Python string declaration:
myexam="@@CBSE Examination 2022@@"
Write the output of: print(myexam[::-2])
(b) Write the output of the code given below:
my_dict = {"name": "Aman", "age": 26}
my_dict['age'] = 27
my_dict['address'] = "Delhi"
print(my_dict.items())
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6095 · 2023 · 1 mark(s)
Which of the following statement(s) would give an error after executing the following code ?
Stud={"Murugan":100, "Mithu":95} # Statement 1
print (Stud[95]) # Statement 2
Stud ["Murugan"]=99 # Statement 3
print (Stud.pop() ) # Statement 4
print (Stud) # Statement 5
(a) Statement 2
(b) Statement 3
(c) Statement 4
(d) Statements 2 and 4
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6285 · 2023 · 1 mark(s)
Which of the following is not a sequential datatype in Python ?
(a) Dictionary
(b) String
(c) List
(d) Tuple
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6286 · 2023 · 1 mark(s)
Given the following dictionary
Day={1:"Monday", 2: "Tuesday", 3: "Wednesday" }
Which statement will return "Tuesday".
(a) Day.pop()
(b) Day.pop(2)
(c) Day.pop(1)
(d) Day.pop("Tuesday")
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6298 · 2023 · 1 mark(s)
Which of the following functions is a valid built-in function for both list and dictionary datatype ?
(a) items()
(b) len()
(c) update()
(d) values()
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6575 · 2023 · 1 mark(s)
Which of the following will delete key-value pair for key = "Red" from a dictionary D1?
a) delete D1("Red")
b) del D1["Red"]
c) del.D1["Red"]
d) D1.del["Red"]
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6305 · 2023 · 2 mark(s)
(a) Given is a Python string declaration :
NAME = "Learning Python is Fun"
Write the output of : print (NAME [-5:-10:-1])
(b) Write the output of the code given below :
dict1={1: ["Rohit",20], 2: ["Siya",90]}
dict2={1: ["Rahul",95], 5: ["Rajan",80]}
dict1.update (dict2)
print (dict1.values())
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6592 · 2023 · 2 mark(s)
Predict the output of the following code:
S = "LOST"
L = [10,21,33,4]
D={}
for I in range(len(S)):
if I%2==0:
D[L.pop()] = S[I]
else:
D[L.pop()] = I+3
for K,V in D.items():
print(K,V,sep="*")
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6617 · 2024 · 1 mark(s)
If my_dict is a dictionary as defined below, then which of the following statements will raise an exception?
my_dict = {'apple': 10, 'banana': 20, 'orange': 30}
a) my_dict.get('orange')
b) print(my_dict['apple', 'banana'])
c) my_dict['apple']=20
d) print(str(my_dict))
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6350 · 2024 · 2 mark(s)
Predict the output of the following code :
d={"IND":"DEL","SRI":"COL","CHI":"BEI"}
str1=""
for i in d:
str1=str1+str(d[i])+"@"
str2=str1[:-1]
print (str2)
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6352 · 2024 · 2 mark(s)
(b) A dictionary dict2 is copied into the dictionary dict1 such that the common key's value gets updated. Write the Python commands to do the task and after that empty the dictionary dict1.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6180 · 2025 · 1 mark(s)
Consider the statements given below and then choose the correct output from the given options:
D={'S01':95, 'S02':96}
for I in D:
print(I,end='#')
(A) S01#S02#
(B) 95#96#
(C) s01,95#S02,96#
(D) S01#95#S02#96#
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6184 · 2025 · 1 mark(s)
Which of the following built-in function/method returns a dictionary?
(A) dict()
(B) keys()
(C) values()
(D) items()
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6374 · 2025 · 1 mark(s)
Which of the following is a mapped data type ?
(A) List
(B) Sets
(C) Dictionary
(D) Boolean
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6375 · 2025 · 1 mark(s)
If the dictionary D1 is defined as :
D1={1:'a',2:'b'}
then which of the following statements is incorrect and hence will result in an error ?
(A) D1.get(1)
(B) D1.get(3)
(C) D1.del(1)
(D) D1.clear()
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6392 · 2025 · 1 mark(s)
Assuming that D1 and D2 are Python dictionaries, write the required statement using built-in functions/methods.
Delete all the elements of D1.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6393 · 2025 · 1 mark(s)
Assuming that D1 and D2 are Python dictionaries, write the required statement using built-in functions/methods.
Generate a list of values of D1.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6394 · 2025 · 1 mark(s)
Assuming that D1 and D2 are Python dictionaries, write the required statement using built-in functions/methods.
Update dictionary D2 with the elements of D1.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6395 · 2025 · 1 mark(s)
Assuming that D1 and D2 are Python dictionaries, write the required statement using built-in functions/methods.
Generate a tuple of keys of D2.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6670 · 2025 · 1 mark(s)
What will be the output of the following Python code?
my_dict = {"name": "Alicia", "age": 27, "city": "DELHI"}
print(my_dict.get("profession", "Not Specified"))
a) Alicia
b) DELHI
c) None
d) Not Specified
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6689 · 2025 · 2 mark(s)
Predict the output of the Python code given below:
emp = {"Arv": (85000,90000),"Ria": (78000,88000),"Jay": (72000,80000),"Tia": (80000,70000)}
selected = [ ]
for name in emp:
salary = emp[name]
average = (salary[0] + salary[1]) / 2
if average > 80000:
selected.append(name)
print(selected)
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6224 · 2026 · 1 mark(s)
Which of the following statements is true about dictionaries in Python ?
(A) A dictionary is an example of sequence datatype.
(B) A dictionary cannot have two elements with same key.
(C) A dictionary cannot have two elements with same value.
(D) The key and value of an element cannot be the same.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6225 · 2026 · 1 mark(s)
If L is a list with 6 elements, then which of the following statements will raise an exception ?
(A) L.pop(1)
(B) L.pop(6)
(C) L.insert(1,6)
(D) L.insert(6,1)
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6241 · 2026 · 1 mark(s)
Assuming that D1 is a dictionary in Python, write the required Python expression/statement.
Write a Python expression to check if the key, 'RNo' is present in D1.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6242 · 2026 · 1 mark(s)
Assuming that D1 is a dictionary in Python, write the required Python expression/statement.
Write a Python expression to check if any key in D1 has a value 12.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6243 · 2026 · 1 mark(s)
Assuming that D1 is a dictionary in Python, write the required Python expression/statement.
Write a single statement using a built-in function to add the key:value pair 'RNo':12 if the key 'RNo' is not present in D1. If the key is present, the function should return its value.
Revision of Python & Core Concepts → Dictionary operations
Included
ID 6244 · 2026 · 1 mark(s)
Assuming that D1 is a dictionary in Python, write the required Python expression/statement.
Write a single statement to delete all the elements from D1.
Revision of Python & Core Concepts → Dictionary operations