Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Prepare a word/pdf file with code and snapshots. Timing: 45 mins.

Q1. Title: Linked List Management System in C Full Marks: 20 Marks

Scenario:

You have been assigned the task of creating a Linked List Management System for a student database.
The system will be used to store and manage information about students, such as their names, IDs, and
grades. As part of your assignment, you need to implement various operations on a singly linked list data
structure using C programming.

Instructions:

Define the Linked List Structure:

Define a structure named Student with the following members:

 int student_id: A unique identifier for each student.


 char name[50]: The name of the student.
 float grade: The grade of the student.
 struct Student* next: A pointer to the next student in the linked list.

Implement Linked List Operations:

 Create a function named addStudent that adds a student to the linked list. This function should
prompt the user to enter the student's details and insert the student at the end of the list.
 Create a function named removeStudent that removes a student from the linked list based on
their student_id.
 Create a function named displayStudents that displays the details of all students in the linked
list.
 Create a function named searchStudent that searches for a student in the linked list based on
their student_id.
 Create a function named countStudents that counts the number of students in the linked list.

Implement the Linked List Management System:

Create a menu-driven program that allows the user to perform the following actions:

 Add a student.
 Remove a student.
 Display all students.
 Search for a student.
 Count the number of students.
 Sort the students based on their names or grades.
 Update the details of a student.
 Exit the program.
Test the Linked List Management System:

 Create a few sample students and add them to the linked list.
 Test each operation by selecting the respective option from the menu.
 Ensure that the system behaves correctly by adding, removing, displaying, searching, and
counting students as expected.

Note: While implementing the linked list, ensure that you handle edge cases appropriately. For example,
what should happen if a student is not found in the list? Also, consider how the program should handle
duplicate student IDs.

You might also like