- Home
- Studylists
Class - 12 CBSE Computer Science Important File Handling Questions 2025
Class - 12 CBSE Computer Science Important File Handling Questions 2025
Python File Handling
Write a function to search and display details of all trains, whose destination is "Delhi" from a binary file "TRAIN.DAT". Assuming the binary file is containing the objects of the following dictionary type:
Train = {'Tno': ..............., 'From': ...............,'To': ...............}
View Answer2 Likes
Python File Handling
A binary file "Book.dat" has structure [BookNo, Book_Name, Author, Price].
(i) Write a user defined function CreateFile() to input data for a record and add to Book.dat.
(ii) Write a function CountRec(Author) in Python which accepts the Author name as parameter and count and return number of books by the given Author are stored in the binary file "Book.dat"
View Answer22 Likes
Python Data Handling
Anant has been asked to display all the students who have scored less than 40 for Remedial Classes. Write a user-defined function to display all those students who have scored less than 40 from the binary file "Student.dat".
View Answer1 Likes
Python Data Handling
Following is the structure of each record in a data file named "PRODUCT.DAT".
{"prod_code": value, "prod_desc": value, "stock": value}
The values for prodcode and proddesc are strings and the value for stock is an integer.
Write a function in Python to update the file with a new value of stock. The stock and the product_code, whose stock is to be updated, are to be inputted during the execution of the function.
View Answer2 Likes
Python Data Handling
Given a binary file "STUDENT.DAT", containing records of the following type:
[S_Admno, S_Name, Percentage]
Where these three values are:
S_Admno — Admission Number of student (string)
S_Name — Name of student (string)
Percentage — Marks percentage of student (float)Write a function in Python that would read contents of the file "STUDENT.DAT" and display the details of those students whose percentage is above 75.
View Answer9 Likes
Python File Handling
Write statements to open a binary file C:\Myfiles\Text1.txt in read and write mode by specifying file path in two different formats.
View Answer5 Likes
Python File Handling
Surya is a manager working in a recruitment agency. He needs to manage the records of various candidates. For this, he wants the following information of each candidate to be stored:
- Candidate_ID – integer
- Candidate_Name – string
- Designation – string
- Experience – float
You, as a programmer of the company, have been assigned to do this job for Surya.
(I) Write a function to input the data of a candidate and append it in a binary file.
(II) Write a function to update the data of candidates whose experience is more than 10 years and change their designation to "Senior Manager".
(III) Write a function to read the data from the binary file and display the data of all those candidates who are not "Senior Manager".
View Answer1 Likes
Python File Handling
Write a Python program to read a given CSV file having tab delimiter.
View Answer4 Likes
Python File Handling
Write a Python program to write a nested Python list to a csv file in one go. After writing the CSV file read the CSV file and display the content.
View Answer3 Likes
Python File Handling
Write a function that reads a csv file and creates another csv file with the same content, but with a different delimiter.
View Answer4 Likes