Question:
A stack is a liner data structure in which insertion and deletion of elements are done at only one end, which is known as the top of the stack. Stack is called a last-in, first-out (LIFO) structure because the last element which is added to the stack is the first element which is deleted from the stack.

Read the above paragraph and answer the following.
Which of the following items will be at the top in the stack after removing three items?
स्टैक एक रेखीय डेटा स्ट्रक्चर है जिसमें एलिमेंट्स को इंसर्ट करने और डिलीट करने की प्रक्रियाएं केवल एक ही एंड पर होती हैं जिसे स्टैक के शीर्ष के रूप में जाना जाता है। स्टैक को लास्ट-इन, फर्स्ट-आउट (LIFO) संरचना कहा जाता है क्योंकि स्टैक में जोड़ा गया अंतिम एलिमेंट स्टैक से हटाया जाने वाला पहला एलिमेंट होता है।

उपरोक्त अवतरण को पढ़कर और निम्नलिखित प्रश्न का उत्तर दीजिए।
तीन आइटम्स हटाने के बाद निम्नलिखित में से कौन सा आइटम स्टैक में सबसे ऊपर होगा?
Options:
- O
- L
- N
- P
- O
- L
- N
- P
Correct Answer: a)
Explanation:
In the given stack diagram, the elements are arranged from top to bottom as follows:
– Top: L
– 2nd from Top: M
– 3rd from Top: N
– 4th from Top: O
– 5th from Top: P
– Bottom: Q
A stack follows the Last-In First-Out (LIFO) principle, where elements are deleted (popped) exclusively from the top:
1. Removing the 1st item pops L; the new top is M.
2. Removing the 2nd item pops M; the new top is N.
3. Removing the 3rd item pops N; the new top is O.
Therefore, after removing three items, O will be at the top of the stack. The correct option is a).
दिए गए स्टैक चित्र के अनुसार, शीर्ष (Top) से तल (Bottom) तक तत्वों का क्रम निम्न है:
– शीर्ष (Top): L
– ऊपर से दूसरा: M
– ऊपर से तीसरा: N
– ऊपर से चौथा: O
– ऊपर से पांचवां: P
– तल (Bottom): Q
स्टैक LIFO (लास्ट-इन, फर्स्ट-आउट) सिद्धांत पर कार्य करता है, जिसमें तत्वों को केवल शीर्ष से हटाया (pop) जाता है:
1. पहला आइटम हटाने पर L हटता है, नया शीर्ष M बनता है।
2. दूसरा आइटम हटाने पर M हटता है, नया शीर्ष N बनता है।
3. तीसरा आइटम हटाने पर N हटता है, अब नया शीर्ष O बन जाता है।
अतः तीन आइटम हटाने के बाद स्टैक के शीर्ष पर O होगा। सही उत्तर विकल्प a) है।