What happens when you pop from an empty stack while implementing using the Stack ADT in Java? a) Undefined error b) Compiler displays a warning c) EmptyStackException is thrown d) NoStackException is thrown
Option: c Explanation: The Stack ADT throws an EmptyStackException if the stack is empty and a pop() operation is tried on it.
Consider the following operation performed on a stack of size 5. Push(1); Pop(); Push(2); Push(3); Pop(); Push(4); Pop(); Pop(); Push(5); After the completion of all operation, the no of element present on stack are a) 1 b) 2 c) 3 d) 4
Consider the usual implementation of parentheses balancing program using stack. What is the maximum number of parentheses that will appear on stack at any instance of time during the analysis of ( ( ) ( ( ) ) ( ( ) ) )? a) 1 b) 2 c) 3 d) 4