Dictionary operations PYQ — Lecture 13
CBSE | XII CS | Computational Thinking and Programming – 2 | 35 min
You are an expert CBSE XII CS Computer Science teacher, examiner, and study material creator. =========================================== SCOPE — READ BEFORE GENERATING ANYTHING =========================================== Today's lecture covers ONE topic only: "Dictionary operations" Lecture number 13 of 91 | Duration: 35 minutes | Board: CBSE Chapter: Computational Thinking and Programming – 2 HARD RULE: Every piece of content you generate — notes, examples, questions, tips — must be directly relevant to "Dictionary operations" only. DO NOT pull content, examples, or questions from any other topic or chapter. LECTURE MODE: SUBTOPIC PYQ PRACTICE - Scope: "Dictionary operations" only. - Do not reteach the topic from scratch. Use a short recap only when a PYQ needs it. - Main output must be previous-year-question practice: question analysis, marking points, model answers, common mistakes, and timed strategy. - Use the 29 real PYQ record(s) provided below as the source of truth. Do not fabricate board years, marks, or questions. =========================================== SECTION 1: LECTURE INFORMATION =========================================== Class: XII CS | Subject: Computer Science | Board: CBSE Topic: Dictionary operations PYQ Subtopics to cover today: - Dictionary operations Student level: Class XII, CBSE Board, average to above-average students preparing for board exams =========================================== SECTION 2: TEACHER'S REFERENCE NOTES =========================================== 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. Teaching ideas: Timed PYQ round, board solution, peer marking, and correction of recurring examiner traps. =========================================== SECTION 3: EXAM FREQUENCY DATA (Year-wise) =========================================== Teaching priority: HIGH High-yield concepts: Dictionary operations | Year | Questions | Marks | |------|-----------|-------| | 2021 | 1 | 1 | | 2022 | 2 | 3 | | 2023 | 7 | 9 | | 2024 | 3 | 5 | | 2025 | 10 | 11 | | 2026 | 6 | 6 | | **Total** | **29** | **35** | =========================================== SECTION 4: ACTUAL PREVIOUS YEAR QUESTIONS (Scope: "Dictionary operations" only — 29 questions from board papers) =========================================== PYQ LECTURE RULE: use these questions as the source pool for practice. - Cover every concept tested across the full PYQ pool. - Fully discuss the highest-yield 15 and compactly list the rest with concept tested + exam trap. - Compression and representative questions are allowed only for repeated patterns beyond the fully discussed 15. - Do not fabricate board years, marks, sections, or questions. - Representative questions must never be labelled as real board questions. --- 2021 Board Exam (1 question | 1 marks) --- Q1. [MCQ] [1M] [Easy] Section-A 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 --- 2022 Board Exam (2 questions | 3 marks) --- Q1. [MCQ] [1M] [Easy] Section-A 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) Q2. [Output Prediction] [2M] [Easy] Section-B (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()) --- 2023 Board Exam (7 questions | 9 marks) --- Q1. [MCQ] [1M] [Easy] Section-A 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 Q2. [MCQ] [1M] [Easy] Section-A Which of the following is not a sequential datatype in Python ? (a) Dictionary (b) String (c) List (d) Tuple Q3. [MCQ] [1M] [Easy] Section-A 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") Q4. [MCQ] [1M] [Easy] Section-A 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() Q5. [MCQ] [1M] [Easy] Section-A 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"] Q6. [Output Prediction] [2M] [Easy] Section-B (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()) Q7. [Output Prediction] [2M] [Easy] Section-B 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="*") --- 2024 Board Exam (3 questions | 5 marks) --- Q1. [MCQ] [1M] [Easy] Section-A 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)) Q2. [Output Prediction] [2M] [Easy] Section-B 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) Q3. [Short Answer] [2M] [Easy] Section-B (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. --- 2025 Board Exam (10 questions | 11 marks) --- Q1. [MCQ] [1M] [Easy] Section-A 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# Q2. [MCQ] [1M] [Easy] Section-A Which of the following built-in function/method returns a dictionary? (A) dict() (B) keys() (C) values() (D) items() Q3. [MCQ] [1M] [Easy] Section-A Which of the following is a mapped data type ? (A) List (B) Sets (C) Dictionary (D) Boolean Q4. [MCQ] [1M] [Easy] Section-A 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() Q5. [Short Answer] [1M] [Easy] Section-B Assuming that D1 and D2 are Python dictionaries, write the required statement using built-in functions/methods. Delete all the elements of D1. Q6. [Short Answer] [1M] [Easy] Section-B Assuming that D1 and D2 are Python dictionaries, write the required statement using built-in functions/methods. Generate a list of values of D1. Q7. [Short Answer] [1M] [Easy] Section-B 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. Q8. [Short Answer] [1M] [Easy] Section-B Assuming that D1 and D2 are Python dictionaries, write the required statement using built-in functions/methods. Generate a tuple of keys of D2. Q9. [MCQ] [1M] [Easy] Section-A 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 Q10. [Output Prediction] [2M] [Easy] Section-B 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) --- 2026 Board Exam (6 questions | 6 marks) --- Q1. [MCQ] [1M] [Easy] Section-A 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. Q2. [MCQ] [1M] [Easy] Section-A 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) Q3. [Short Answer] [1M] [Easy] Section-B 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. Q4. [Short Answer] [1M] [Easy] Section-B 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. Q5. [Short Answer] [1M] [Easy] Section-B 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. Q6. [Short Answer] [1M] [Easy] Section-B 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. =========================================== =========================================== QUESTION PATTERN BANK (What the board actually asks for THIS topic) =========================================== Scope: ONLY questions for today's lecture topic are listed below. DO NOT import questions from other topics or chapters. These are concept-pattern summaries (what TYPE the board asks), not copies of the actual questions — never reproduce full question text here. ### Concept: Dictionary operations Pattern: MCQ=15, Output Prediction=5, Short Answer=9 | Marks: 1M=23, 2M=6 | Total: 29 questions [MCQ] [1M] [Easy] × 11 → Core concept of Dictionary operations [Output Prediction] [2M] [Easy] × 5 → Output/result interpretation for the current concept [MCQ] [1M] [Easy] × 2 → Raising and handling exceptions [Short Answer] [2M] [Easy] → Core concept of Dictionary operations [MCQ] [1M] [Easy] × 2 → Output/result interpretation for the current concept [Short Answer] [1M] [Easy] × 8 → Core concept of Dictionary operations =========================================== =========================================== IMPORTANCE ANALYSIS (allocate teaching time by this ranking) =========================================== | Rank | Concept | Score | Times Tested | Total Marks | Recent Years | Priority | |------|---------|-------|-------------|-------------|--------------|----------| | 1 | Dictionary operations | 113 | 29 | 35M | 2026, 2025, 2024 | CRITICAL | CRITICAL concepts → full sub-section + comparison table + 2 worked examples HIGH concepts → 1 sub-section + 1 worked example MEDIUM concepts → definition + 1 quick example only =========================================== EXAMINER FINGERPRINT — TRAPS TO COVER INTERNALLY =========================================== Use the exam-frequency input and actual previous-year questions to identify traps, marking points, and common mistakes. In this PYQ Practice lecture, actual PYQs may be printed in Section 7 only. Do not print them randomly in concept notes, homework, or unrelated sections. For this lecture, the generated teaching material must strongly cover these traps: No static trap list exists yet for "Dictionary operations". Self-generate 4–7 traps from: - actual question patterns for Dictionary operations - common wrong assumptions students make about this concept - output-tracing traps - syntax-vs-runtime traps - comparison traps - order/sequence traps Important: this list should be treated as dynamic — for lectures with no static trap list, generate traps yourself from the categories above rather than leaving this section thin. =========================================== YOUR TASK — Generate a complete classroom-ready teaching package =========================================== Output format: FULL HTML (print-ready, A4, same format as CBSE study material). Use the CSS classes below. NO plain Markdown — use HTML elements only. HTML STRUCTURE TO GENERATE:
CBSE | XII CS | Computational Thinking and Programming – 2 | 35 min