Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
6.7k views
in Computer by (71.2k points)

Consider the following class declaration and answer the question that follows:

Anuj 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” assuming it stores all the object of the class Student mentioned above.

1 Answer

+1 vote
by (76.3k points)
selected by
 
Best answer

def displaydata():

x=open("student.dat", "rb")

S = Student()

try:

while (X):

s=pickle.load(X)

if (s.returnpercent () < 40):

s.displaydata()

except EOFError:

pass

x.close()

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...