- 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 that reads a csv file and creates another csv file with the same content except the lines beginning with 'check'.
View Answer5 Likes
Python File Handling
Give any one point of difference between a binary file and a CSV file.
Write a Program in Python that defines and calls the following user defined functions :
(a) add(). To accept and add data of an employee to a CSV file 'furdata.csv'. Each record consists of a list with field elements as fid, fname and fprice to store furniture id, furniture name and furniture price respectively.
(b) search(). To display the records of the furniture whose price is more than 10000.
View Answer1 Likes
Python Data Handling
Create a CSV file "Groceries" to store information of different items existing in a shop. The information is to be stored w.r.t. each item code, name, price, qty. Write a program to accept the data from user and store it permanently in CSV file.
View Answer3 Likes
Python File Handling
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.
View Answer2 Likes
Python File Handling
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.
View Answer1 Likes
Python File Handling
(i) Differentiate between r+ and w+ file modes in Python.
(ii) Consider a file, SPORT.DAT, containing records of the following structure: [SportName, TeamName, No_Players]
Write a function, copyData(), that reads contents from the file SPORT.DAT and copies the records with Sport name as “Basket Ball” to the file named BASKET.DAT. The function should return the total number of records copied to the file BASKET.DAT.
View Answer5 Likes
Python File Handling
(i) How are text files different from binary files?
(ii) A Binary file, CINEMA.DAT has the following structure:
{MNO:[MNAME, MTYPE]}
Where
MNO – Movie Number
MNAME – Movie Name
MTYPE is Movie TypeWrite a user defined function, findType(mtype), that accepts mtype as parameter and displays all the records from the binary file CINEMA.DAT, that have the value of Movie Type as mtype.
View Answer5 Likes
Python File Handling
Write a program that copies one file to another. Have the program read the file names from user ?
View Answer3 Likes
Python File Handling
Write a program that appends the contents of one file to another. Have the program take the filenames from the user.
View Answer4 Likes