0% found this document useful (0 votes)
10 views1 page

ST4

Uploaded by

fairnal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

ST4

Uploaded by

fairnal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.A binary file “student.dat” has structure [rollno, name, marks].

i. Write a user defined function insertRec() to input data for a student and add to
student.dat.
ii. Write a function searchRollNo( r ) in Python which accepts the student’s rollno
as parameter and searches the record in the file “student.dat” and shows the
details of student i.e. rollno, name and marks (if found) otherwise shows the
message as ‘No record found’.
2.Write a python program to append a new records in a binary file –“student.dat”.
The record can have Rollno, Name and Marks.
3.A binary file named “EMP.dat” has some records of the structure [EmpNo, EName,
Post, Salary]
(a) Create a binary file “EMP.dat” that stores the records of employees and display
them one by one.
(b) Display the records of all those employees who are getting salaries between
25000 to 30000.
4.A binary file “STUDENT.DAT” has structure (admission_number, Name, Percentage).
Write a function countrec() in Python that would read contents of the file
“STUDENT.DAT” and display the details of those students whose percentage is above
75. Also display number of students scoring above 75%.
5.A binary file named “EMP.dat” has some records of the structure [EmpNo, EName,
Post, Salary]
(a) Write a user-defined function named NewEmp() to input the details of a new
employee from the user and store it in EMP.dat.
(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.

You might also like