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]
R – S * T + C % F, what is the shortest distance between R and T, T and F respectively?
What is the code for ‘ right it plus ’?
G % B * S + U % R, what is the direction of G with respect to U?
Select the option in which the words share the same relationship as that shared by the given pair of words.
Cat : Mew :: ?
Which of the following expression is correct where X is to the north east of T?
Dinesh walks 2 km towards South and turns to his right and walks 3 km. He then turns to his right and walks 4 km and turns again to his right and walks ...
What is the code for ‘plus’ in the given coded language?
One day, Priya left home i.e. A and cycled 15 km southwards reached point B, turned right and cycled 8 km to point C and turned right and cycled 15 km t...
Seven friends, A, E, I, O, U, X and Z are sitting around a round table facing towards the center. A is neighbor of E and I. O is not neighbor of I and Z...