0% found this document useful (0 votes)
211 views15 pages

COMPUTER PRACTICAL-Binary and CSV File

This document contains questions about writing programs to work with binary and CSV files. It includes questions about writing functions to write and read binary files containing product data, a menu-driven program to work with student data in a binary file, another menu program for employee data, writing to a CSV file called PRODUCTS.CSV, and getting multiple item details from a user to write to a CSV file. Sample programs and outputs are requested for each question.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
211 views15 pages

COMPUTER PRACTICAL-Binary and CSV File

This document contains questions about writing programs to work with binary and CSV files. It includes questions about writing functions to write and read binary files containing product data, a menu-driven program to work with student data in a binary file, another menu program for employee data, writing to a CSV file called PRODUCTS.CSV, and getting multiple item details from a user to write to a CSV file. Sample programs and outputs are requested for each question.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

COMPUTER PRACTICAL

BINARY AND CSV FILE

(MADE BY-ANUBHAV CHAUHAN,XIIC)


INDEX
S. Description Date Remark
No
.
BINARY FILE
1. Write a function definition to write a new 14.09.21
binary file called ‘Data’ which stores
name and price of the product in the
format shown in the example.
The data is stored in the following format:
[{‘name’:’file’,’price’:112},{‘name’:
‘pen’,’price’:90}] and so on.
1) Write a function to increase the
price of all products by 10 percent.
The data is stored in the binary file
‘data2’.
2) Write a function to transfer all the
records from binary ‘data’ to ‘data3’
whose price is less than 100.
2. Write a menu driven program(Append, 14.09.21
Update Display, Exit ) to append data of a
student (name and age), update and then
display those students whose age >=18
(Data is in dictionary/list/tuple) (File to be
written and read in binary mode).
3. Write a menu driven program(Append, 14.09.21
Display, Search, Delete, Update and Exit )
to process data of an employee ( emp no,
emp name and salary). Search, Delete and
Updatemust work on empno.

CSV FILE
4. Write a python function to write the file 14.09.21
PRODUCT.CSV and display the data.The
first record of the file should be

PID, PNAME, COST, QUANTITY


5. Write a program to get item details ( code, 14.09.21
description and price) for multiple items
from the user and create a csv file by
writing all the item details in one go.

Q1 Write a function definition to write a new binary file called ‘Data’


which stores name and price of the product in the format shown in the
example.
The data is stored in the following format:
[{‘name’:’file’,’price’:112},{‘name’: ‘pen’,’price’:90}] and so on.
1) Write a function to increase the price of all products by 10 percent.
The data is stored in the binary file ‘data2’.
2)Write a function to transfer all the records from binary ‘data’ to
‘data3’ whose price is less than 100.
PROGRAM-
OUTPUT-
Q2 Write a menu driven program(Append, Update Display, Exit ) to
append data of a student (name and age), update and then display
those students whose age >=18 (Data is in dictionary/list/tuple) (File to
be written and read in binary mode).
PROGRAM-
OUTPUT-
Q3 Write a menu driven program(Append, Display, Search, Delete,
Update and Exit ) to process data of an employee ( emp no, emp name
and salary). Search, Delete and Updatemust work on empno.
PROGRAM-
OUTPUT-

Q4 Write a python function to write the file PRODUCT.CSV and


display the data.The first record of the file should be
PID, PNAME, COST, QUANTITY
PROGRAM-

OUTPUT-

Q5 Write a program to get item details ( code, description and price) for
multiple items from the user and create a csv file by writing all the item
details in one go.
PROGRAM-

OUTPUT-

You might also like