Data Structures
CSE · Midterm · Spring 25
Paper 2 of 3Batch ALL · Abrar Hasan ChowdhurySwitch
Batch ALL
Paper 2 of 3
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
[Figure: University Logo] | Daffodil International University | Department of Computer Science and Engineering | Faculty of Science & Information Technology | Midterm Examination, Spring 2025 | Course Code: CSE123, Course Title: Data Structures | Level: 1 Term: 2 Batch: ALL | Time: 1.5 Hours | Marks: 25
Answer ALL Questions
[The figures in the right margin indicate the full marks and corresponding course outcomes. All portions of each question must be answered sequentially.]
1. a) Explain the concept of a self-referential structure in C. Provide an example. | 3 | CO1
1. b) Write necessary code using C language to implement a Linear Linked List with the following operations: | 7 | CO2
1. Insert at End
2. Delete from Beginning
3. Display the List
Requirements:
- Define node containing data (int) and a pointer (self referential).
- Use dynamic memory allocation (malloc and free) for node creation and deletion.
- Provide reasoning for using a linked list in applications like data storage for Library.
(Full correct implementation: 7 marks, Partial correctness: 4-5 marks, Minor issues: 2-3 marks)
2. a) Why is dynamic memory allocation preferred when implementing linked lists? Explain with an example. | 2 | CO1
2. b) Implement a Stack using a Linked List in C with the following operations: | 8 | CO2
1. Push (Insert an element)
2. Pop (Remove the top element)
3. Peek (View the top element)
4. isEmpty (Check if the stack is empty)
Requirements:
- Explain the time complexity of each operation.
- Provide appropriate output for sample inputs.
(Full correct implementation: 8 marks, Partial correctness: 5-6 marks, Minor issues: 3-4 marks)
3. Problem Solving (Analysis & Synthesis Level) | 5 | CO2
Problem Scenario:
A printer management system requires efficient handling of print jobs. Each print job has a priority value. The system should process:
- High-priority jobs immediately (Stack behavior: LIFO).
- Normal jobs in the order they were received (Queue behavior: FIFO).
Task:
1. Propose a combination of Stack and Queue to design this system.
2. Draw a flowchart or diagram to represent the process.
3. Explain how the system handles multiple job requests with varying priorities.
(Solution approach: 3 marks, Diagram: 1 mark, Explanation: 1 mark)
Good Luck