Binary File Handling Question Bank
Binary File Handling Question Bank
13. a. i) Explain the process of reading and writing data to a binary file in 5
Python.
ii) Write the difference between a and a+ mode?
15. a. When do you think text files should be preferred over binary files? (2+3)
b. A binary file “student.dat” has structure [rollno, name, marks].
Write a user defined function insertRec() to input data for a
student and add to student.dat.
16. Consider a binary file stock.dat that has the following data: OrderId, (2+3)
MedicineName, Qty and Price of all the medicines of wellness medicos,
write the following functions:
a) AddOrder() that can input all the medicine orders.
b) DisplayPrice() to display the details of all the medicine that have Price
more than 10.
17. a. Binary file is unreadable and open and close through a function only so (2+3)
what are the advantages of using binary file.
b. Write a user-defined function named SumSalary(Post) that will accept
an argument the post of employees & read the contents of emp.dat and
calculate the sum of salary of all employees of that Post.