CSV file read, write and search PYQ part 2 — Lecture 38
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: "CSV file read, write and search" Lecture number 38 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 "CSV file read, write and search" only. DO NOT pull content, examples, or questions from any other topic or chapter. LECTURE MODE: SUBTOPIC PYQ PRACTICE - Scope: "CSV file read, write and search" 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 8 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: CSV file read, write and search PYQ part 2 Subtopics to cover today: - CSV file read, write and search Student level: Class XII, CBSE Board, average to above-average students preparing for board exams =========================================== SECTION 2: TEACHER'S REFERENCE NOTES =========================================== CSV file read, write and search PYQ part 2 PYQ PRACTICE SCOPE: CSV file read, write and search. Concept ID: U1_CSV_OPS. Use only previous-year questions whose concept_ids include U1_CSV_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: CSV file read write and search | Year | Questions | Marks | |------|-----------|-------| | 2023 | 2 | 9 | | 2024 | 4 | 12 | | 2025 | 2 | 8 | | **Total** | **8** | **29** | =========================================== SECTION 4: ACTUAL PREVIOUS YEAR QUESTIONS (Scope: "CSV file read, write and search" only — 8 questions from board papers) =========================================== PYQ LECTURE RULE: use these questions as the source pool for practice. - This pool has 8 questions: preserve and discuss ALL 8 actual PYQs in Section 7. - Do not compress, replace, paraphrase, or skip any actual PYQ. - Do not create substitute or newly framed questions for this small pool. - Do not fabricate board years, marks, sections, or questions. --- 2023 Board Exam (2 questions | 9 marks) --- Q1. [Programming] [4M] [Medium] Section-D Vedansh is a Python programmer working in a school. For the Annual Sports Event, he has created a csv file named Result.csv, to store the results of students in different sports events. The structure of Result.csv is: [St_Id, St_Name, Game_Name, Result] Where: St_Id is Student ID (integer) ST_name is Student Name (string) Game_Name is name of game in which student is participating (string) Result is result of the game whose value can be either 'Won', 'Lost' or 'Tie' For efficiently maintaining data of the event, Vedansh wants to write the following user defined functions: Accept() – to accept a record from the user and add it to the file Result.csv. The column headings should also be added on top of the csv file. wonCount() – to count the number of students who have won any event. As a Python expert, help him complete the task. Q2. [Programming] [5M] [Hard] Section-D (b) Why it is important to close a file before exiting ? Write a program in Python that defines and calls the following user defined functions : (i) Add_Book(): Takes the details of the books and adds them to a csv file 'Book.csv'. Each record consists of a list with field elements as book_ID, B_name and pub to store book ID, book name and publisher respectively. (ii) Search_Book(): Takes publisher name as input and counts and displays number of books published by them. --- 2024 Board Exam (4 questions | 12 marks) --- Q1. [MCQ] [1M] [Easy] Section-A __________ files are stored in a computer in a sequence of bytes. (A) Text (B) Binary (C) CSV (D) Notepad Q2. [Programming] [3M] [Medium] Section-C Write the user defined function to modify the quantity of a product. The function should accept the product number, and the new quantity as arguments and update the quantity of that product in a CSV file "Product.csv". Q3. [Programming] [4M] [Medium] Section-D Mr. Mahesh is a Python Programmer working in a school. He has to maintain the records of the sports students. He has created a csv file named sports.csv, to store the details. The structure of sports.csv is : [sport_id, competition, prize_won] where sport_id, is Sport id (integer) competition is competition name (string) prize_won is ("Gold", "Silver", "Bronze") Mr. Mahesh wants to write the following user-defined functions : Add_detail() : to accept the detail of a student and add to a csv file, "sports.csv". Count_Medal() : to display the name of competitions in which students have won "Gold" medal. Help him in writing the code of both the functions. Q4. [Programming] [4M] [Medium] Section-D A csv file "Happiness.csv" contains the data of a survey. Each record of the file contains the following data: - Name of a country - Population of the country - Sample Size (Number of persons who participated in the survey in that country) - Happy (Number of persons who accepted that they were Happy) For example, a sample record of the file may be: ['Signiland', 5673000, 5000, 3426] Write the following Python functions to perform the specified operations on this file: (I) Read all the data from the file in the form of a list and display all those records for which the population is more than 5000000. (II) Count the number of records in the file. --- 2025 Board Exam (2 questions | 8 marks) --- Q1. [Programming] [4M] [Medium] Section-E Consider the table RESULT given below. | ROLL | SUBJECT | MARKS | |------|---------|-------| | S01 | Physics | 90 | | S02 | Chemistry | 98 | | S03 | Maths | 80 | | S04 | Physics | 95 | | S05 | Chemistry | 75 | | S06 | Maths | 97 | Write a program in Python to write the above data in a CSV file named RESULT.csv and display the records of all those students who are getting marks more than 80. Q2. [Programming] [4M] [Medium] Section-D Suman is an intern at a software startup. The company has assigned her a task to create a CSV file named CLUB.CSV, to store the records of the Club members. After discussing with Club Incharge, Suman has planned to store the following content of members in the file CLUB.CSV : [Mno, Name, Mobile, Fee] Where Mno – Member Number, Name – Name of the Member, Mobile – Member's Mobile Number, Fee – Fee amount Assuming you are asked to help Suman in her assignment, write a Python code for performing the following tasks with the help of user-defined functions : NewMembers() : to accept records of members from the user and add them to the file CLUB.CSV PriorityMember() : to find and display those members from the file CLUB.CSV, who are paying Fee more than 35000. =========================================== =========================================== 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: CSV file read write and search Pattern: MCQ=1, Programming=7 | Marks: 1M=1, 3M=1, 4M=5, 5M=1 | Total: 8 questions [Programming] [4M] [Medium] × 5 → Core concept of CSV file read write and search [Programming] [5M] [Hard] → Core concept of CSV file read write and search [MCQ] [1M] [Easy] → Core concept of CSV file read write and search [Programming] [3M] [Medium] → Core concept of CSV file read write and search =========================================== =========================================== IMPORTANCE ANALYSIS (allocate teaching time by this ranking) =========================================== | Rank | Concept | Score | Times Tested | Total Marks | Recent Years | Priority | |------|---------|-------|-------------|-------------|--------------|----------| | 1 | CSV file read write and search | 75 | 8 | 29M | 2025, 2024, 2023 | 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 "CSV file read, write and search". Self-generate 4–7 traps from: - actual question patterns for CSV file read write and search - 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