Data Structures
CSE · Midterm · Summer 26
Paper 2 of 4Batch 70 · Md. Mehedi Hasan KhanSwitch
Batch 70
Paper 2 of 4
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Daffodil International University
Faculty of Science & Information Technology
Department of Computer Science & Engineering
Midterm Examination, Summer 2026
Course Code: CSE123, Course Title: Data Structure
Level: 1 Term: 3 Batch: 70
Time: 01:30 Hrs
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 | Daffodil International University (DIU) has introduced a new bus service for the Mirpur area. From 1:00 PM to 4:00 PM, there will be one bus every hour traveling from DIU to Mirpur. Each bus has:
- a unique ID number (integer),
- a capacity (integer),
- and a pointer (*next) that stores the address of the next bus in the service schedule.
This arrangement can be represented using a linked list, where each bus is a node, and the pointer connects it to the next bus.
[Figure: Linked list representing 4 buses with IDs 1, 23, 31, 17, capacities 25, 28, 28, 28, and respective next pointers and addresses] | CO2
a) Write a C program to create a linked list of buses for the given schedule (1 PM to 4 PM) as the figure in the question portrayed and display all the information. | [4]
b) It is seen that at 3pm, usually there are more students than 28 capacity so the authority introducing new bus having ID 13 which has capacity 40.
Write a C program to create a new bus node (Bus ID = 13, Capacity = 40) and insert it at position 3 (after the node having ID: 23) in the linked list of DIU-Mirpur bus schedule. | [4]
c) Write a function to delete the nodes containing Bus IDs 23 and 31 from the linked list of the DIU-Mirpur bus schedule, considering that in the first week after the Eid vacation student attendance is low, and reconnect the remaining nodes so that the linked list structure is preserved. | [4]
2 | A logic circuit simulator converts arithmetic expressions representing signal computations into a form that can be executed sequentially. A stack is used to handle operators while transforming the expression.
Expression: (2+3)^2/5 + 3 - 2 * (1+2)
Convert the expression into postfix and then evaluate the expression using stack. | CO1
[3+2]
3 | Daffodil International University (DIU) uses a queue to manage bus seat reservations. The following sequence of operations occurs:
i. Enqueue passengers: P1, P2, P3, P4, P5
ii. Dequeue two passengers
iii. Enqueue passengers: P6, P7
iv. Dequeue one passenger
v. Enqueue passenger: P8 | CO1
a) Draw the state of the queue after each operation to visualize how the queue changes. Ensure that the nature of the queue is clearly represented. | [5]
b) Explain why a queue is an appropriate data structure for managing bus seat reservations at DIU and what would happen if a stack were used instead of a queue for this reservation system. | [3]