2 2 votes Let S be a stack with operations push, pop, top, empty. What is displayed after following segment of code executes . for(i=1; i<=5; i++) s.push(i); while(!s.empty()) printf("%d", s.top()); ans with explanation Data Structures stack + – amit166 1.6k views answer comment Share Follow Print See all 10 Comments 10 10 Comments reply Show 7 previous comments arvin commented Aug 8, 2018 reply Follow flag @soumya29 yes because its not s.pop() @srestha it will be having overflow 1 1 replyShare amit166 commented Aug 8, 2018 reply Follow flag THANKU 0 0 replyShare kr.ankit commented Aug 14, 2018 reply Follow flag @arvin the while loop will execute infinite times but should we call the final answer as Stack Overflow? Because the contents of the stack will be fixed to 5,4,3,2,1. The while loop will print infinite times but the stack is not overflowing right? 0 0 replyShare Please log in or register to add a comment.