Tuesday, 21 July 2026
Lecture 31 of 73 · Unit 1
Unit 1 ⏳ Pending
Unlocks at 05:00 PM, 21 Jul 2026

Text file reading writing searching and counting PYQ part 4

What We'll Learn

A quick overview of today's lecture

Text file reading writing searching and counting PYQ part 4 PYQ PRACTICE SCOPE: Text file reading writing searching and counting. Concept ID: U1_TEXT_FILE_OPERATIONS. Use only previous-year questions whose concept_ids include U1_TEXT_FILE_OPERATIONS.
Key things we'll cover
Text file reading writing searching and counting
PYQ references used by both prompts 8 included 1 excluded
Flagged questions are excluded from both Study Notes and PPT references until corrected in Paper Analyzer.
Included ID 6125 · 2023 · 5 mark(s)
(a) Write one difference between CSV and text files. Write a program in Python that defines and calls the following user defined functions : (i) COURIER_ADD(): It takes the values from the user and adds the details to a csv file 'courier.csv'. Each record consists of a list with field elements as cid, s_name, Source, destination to store Courier ID, Sender name, Source and destination address respectively. (ii) COURIER_SEARCH() : Takes the destination as the input and displays all the courier records going to that destination. (ii) Search_Book(): Takes publisher name as input and counts and displays number of books published by them.
File Handling → CSV file read write and search, Text file reading writing searching and counting
Excluded ID 6321 · 2023 · 5 mark(s)
(a) Write a point of difference between append (a) and write (w) modes in a text file. Write a program in Python that defines and calls the following user defined functions : (i) Add_Teacher() : It accepts the values from the user and inserts record of a teacher to a csv file "Teacher.csv". Each record consists of a list with field elements as T_id, Tname and desig to store teacher ID, teacher name and designation respectively. (ii) Search_Teacher() : To display the records of all the PGT (designation) teachers. (ii) Count_Device() : To count and display number of peripheral devices, whose price is less than or equal to 1000.
File Handling → CSV file read write and search
Awaiting categorisation review
Included ID 6143 · 2024 · 1 mark(s)
Which of the following file opening mode is used to open a file in append and read mode ? (A) r+ (B) w+ (C) a+ (D) x+
File Handling → File basics paths modes seek and tell, Text file reading writing searching and counting
Included ID 6366 · 2024 · 5 mark(s)
(b) (i) Give one difference between write() and writeline() function in text file. (ii) A Binary file, "Items.dat" has the following structure : [Icode, Description, Price] Where Icode – Item code Description – Detail of item Price – Price of item Write a function Add_data(), that takes Icode, Description and Price from the user and writes the information in the binary file "Items.dat".
File Handling → Binary file operations with pickle
Included ID 6406 · 2025 · 3 mark(s)
(b) Write a function in Python to display the line which has the maximum number of vowels from a text file, "Novel.txt"
File Handling → Text file reading writing searching and counting
Included ID 6694 · 2025 · 3 mark(s)
A. Write a Python function that displays the number of times the word "Python" appears in a text file named "Prog.txt".
File Handling → Text file reading writing searching and counting
Included ID 6695 · 2025 · 3 mark(s)
B. Write and call a Python function to read lines from a text file STORIES.TXT and display those lines which doesn't start with a vowel (A, E, I, O, U) irrespective of their case.
File Handling → Text file reading writing searching and counting
Included ID 6253 · 2026 · 3 mark(s)
(a) Write a Python function that counts and returns the number of digits appearing in the text file "Space.txt". For example, if the file contains : Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in 1969, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about 400 km, serves as a hub for research. With missions planned for 2030, humanity's cosmic journey continues! Then the function should return 11.
File Handling → Text file reading writing searching and counting
Included ID 6254 · 2026 · 3 mark(s)
(b) Write a Python function that displays the words in which the lowercase letter 'e' appears at least twice in the text file 'Space.txt'. For example, if the file contains : Space exploration has unlocked incredible advancements in technology and science. Since the first moon landing in 1969, space agencies have sent probes to Mars, Jupiter and beyond. The ISS, orbiting Earth at about 400 km, serves as a hub for research. With missions planned for 2030, humanity's cosmic journey continues! Then the function should display : incredible advancements science. agencies serves research.
File Handling → Text file reading writing searching and counting
.txt