Text file reading writing searching and counting PYQ part 4
Text file reading writing searching and counting
PYQ reference preview8 included1 excluded
Review every matched question before generating. Flag a wrongly categorised question to
quarantine it from both study and PPT prompts until it is corrected in CBSE Paper Analyzer.
Included in reference
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
· Concept U1_CSV_OPS;U1_TEXT_FILE_OPERATIONS
(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.
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
· Concept U1_FILE_BASICS_MODES;U1_TEXT_FILE_OPERATIONS
Included in reference
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".
(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
· Concept U1_TEXT_FILE_OPERATIONS
Included in reference
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
· Concept U1_FILE_BASICS_MODES;U1_TEXT_FILE_OPERATIONS
Included in reference
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
· Concept U1_TEXT_FILE_OPERATIONS
Included in reference
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
· Concept U1_TEXT_FILE_OPERATIONS
Included in reference
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
· Concept U1_TEXT_FILE_OPERATIONS
Pick a lecture from the panel on the left, configure the board and student level,
then click Generate Prompt. The result includes PYQ data,
frequency analysis, exam trends, and a full 15-section teaching package request —
ready to paste into any AI assistant.
ChatGPTClaudeGeminiDeepSeek
PYQ Analysis
Frequency, marks & high-yield concepts
Lecture Flow
Exact time-allocation plan
15 Sections
From objectives to ranked exam questions
Export
Copy or download as .txt
Reset All Progress?
This will clear all Done and Missed marks and rebuild the schedule from scratch.
A backup will be created automatically before resetting. You can restore it from the Backups page.