After performing following set of operations, what does the final list look…
2023
After performing following set of operations, what does the final list look contain? InsertFront(10); InsertFront(20); InsertRear(30); DeleteFront(); InsertRear(40); InsertRear(10); DeleteRear(); InsertFront(15); display();
- A.
10 30 10 15
- B.
20 30 40 15
- C.
10 30 40 15
- D.
More than one of the above
- E.
None of the above
Attempted by 477 students.
Show answer & explanation
Correct answer: E
Step 1: Start with an empty list. InsertFront(10) → [10].
Step 2: InsertFront(20) → [20, 10].
Step 3: InsertRear(30) → [20, 10, 30].
Step 4: DeleteFront() → [10, 30].
Step 5: InsertRear(40) → [10, 30, 40].
Step 6: InsertRear(10) → [10, 30, 40, 10].
Step 7: DeleteRear() → [10, 30, 40].
Step 8: InsertFront(15) → [15, 10, 30, 40].
Final list: 15 10 30 40.
हिन्दी उत्तर:
चरण 1: खाली सूची से शुरू करें। InsertFront(10) → [10]।
चरण 2: InsertFront(20) → [20, 10]।
चरण 3: InsertRear(30) → [20, 10, 30]।
चरण 4: DeleteFront() → [10, 30]।
चरण 5: InsertRear(40) → [10, 30, 40]।
चरण 6: InsertRear(10) → [10, 30, 40, 10]।
चरण 7: DeleteRear() → [10, 30, 40]।
चरण 8: InsertFront(15) → [15, 10, 30, 40]।
अंतिम सूची: 15 10 30 40।