Question
Consider the following stack operations. What will be
the content of the stack after executing all the operations? Stack stack = new Stack (); stack.push( 5 ); stack.push( 10 ); stack.pop(); stack.push( 15 ); stack.push( 20 ); stack.pop(); stack.push( 25 );Solution
The stack operates on a Last-In, First-Out (LIFO) principle. The operations are executed as follows:
- stack.push(5) → Stack: [5]
- stack.push(10) → Stack: [5, 10]
- stack.pop() → Removes the top element 10 . Stack: [5]
- stack.push(15) → Stack: [5, 15]
- stack.push(20) → Stack: [5, 15, 20]
- stack.pop() → Removes the top element 20 . Stack: [5, 15]
- stack.push(25) → Stack: [5, 15, 25]
सूची – I को सूची – II से सुमेलित कीजिए और सूचियों के नीचे दिए �...
इनमें से हजारी प्रसाद द्विवेदी का उपन्यास कौन सा है :
निम्नलिखित एक की वर्तनी अशुद्ध है।
नीचे दिए गए वाक्यांशों और अभिव्यक्तियों के युग्मों में स�...
- ‘महाकाव्य’ का सही संधि-विच्छेद क्या है?
कौन सा शब्द द्धिज का अनेकार्थी शब्द नहीं है ?
निम्नलिखित में से अशुद वर्तनी वाले का चयन कीजिए-
Accountant का उपयुक्त हिंदी पर्याय है-
‘घाट-घाट का पानी पीना’
राजभाषा में कुल कितने नियम है ?