Knowee
Questions
Features
Study Tools

Write a program to write data into binary file marks.dat anddisplay the records of students who scored more than 95marks.

Question

Write a program to write data into binary file marks.dat anddisplay the records of students who scored more than 95marks.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, here is a step-by-step guide to write a program that writes data into a binary file marks.dat and displays the records of students who scored more than 95 marks:

  1. Import the necessary libraries or modules for file handling and data manipulation.

  2. Define a class or structure to represent a student record. This class should have attributes such as name, roll number, and marks.

  3. Create a list or array to store multiple student records.

  4. Prompt the user to enter the number of student records they want to input.

  5. Use a loop to iterate over the number of student records and prompt the user to enter the details for each student (name, roll number, and marks). Store these details in the student record object and add it to the list of student records.

  6. Open the marks.dat file in binary write mode using the appropriate file handling function or method.

  7. Iterate over the list of student records and write each record to the binary file using the appropriate file handling function or method. Make sure to convert the data into a binary format before writing.

  8. Close the marks.dat file.

  9. Reopen the marks.dat file in binary read mode.

  10. Iterate over the records in the binary file and read each record. Convert the binary data back into the appropriate data format and check if the student's marks are greater than 95.

  11. If the marks are greater than 95, display the student's details (name, roll number, and marks).

  12. Close the marks.dat file.

That's it! You have now written a program that writes data into a binary file and displays the records of students who scored more than 95 marks.

This problem has been solved

Similar Questions

.Write a Python program to store marks scored in subject “Fundamental of DataStructure” by N students in the class and perform different operations.

You are developing a Student Record Management System in C. The system needs to store and manage information for multiple students, including their names, roll numbers, and marks obtained in different subjects. Implement array in structures to read, write, and compute average marks and the students scoring above and below the average marks for a class of N students. INPUT/OUTPUT EXAMPLE: Enter the number of students: 3 Enter details for 3 students: Student 1: Name: A Roll Number: 1 Marks in 5 subjects: Subject 1: 12 Subject 2: 13 Subject 3: 14 Subject 4: 15 Subject 5: 16 Student 2: Name: BB Roll Number: 2 Marks in 5 subjects: Subject 1: 11 Subject 2: 13 Subject 3: 12 Subject 4: 15 Subject 5: 14 Student 3: Name: CC Roll Number: 10 Marks in 5 subjects: Subject 1: 13 Subject 2: 14 Subject 3: 16 Subject 4: 17 Subject 5: 11 Class average marks: 13.73 Students scoring above average: A (Roll Number: 1) CC (Roll Number: 10) Students scoring below average: BB (Roll Number: 2)

Write a C program to compute the maximum marks and average marks of a class using sentinel controlled repetition (-1 as the sentinel value)?- If user enters negative marks then display INVALID INPUT and and read the marks again.- If number of students is 0, then display "NO DATA"- If number of students > 0, then display maximum marks and the average marks separated by space.-You can assume that marks are integers and average also you discard decimal value.

Write a C program using structure student which allows users to input details for three students including their names, roll numbers, and marks in 5 subjects. Use a function calculateTotalMarks(struct Student) which calculates the total marks and percentage for each student and displays the information. Each subject test is for 10 marks. Total marks = 50. Percentage = (marks obtained/total marks)*100.

Single File Programming QuestionProblem StatementA school administrator needs to display the information of a student. The student has an ID (an integer) of 15, an age (an integer) of 23 and achieved a grade (a character) 'B'. Write a C program to print these details using appropriate data types and formatting.Input format :No console input.Output format :The output displays the values in the below format:Student id: 15Student age: 23Student grade: BRefer to the sample output for the formatting specification

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.