We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
Q1. Choose the correct answer.
1. In a stack, if a user tries to remove an element from an empty stack it is called__
A. Underflow B. Empty collection C. Overflow D. Garbage Collection 2. Pushing an element into stack already having 5 elements and stack size of 5, then stack becomes ___________ A. Overflow B. Crash C. Underflow D. User flow 3. If the sequence of operations, push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop, are performed on a stack, the sequence of popped out values A. 2, 2, 1, 1, 2 B. 2, 2, 1, 2, 2 C. 2, 1, 2, 2, 2 D. 2, 1, 2, 2, 1 4. The data structure required to check whether an expression contains balanced parenthesis is? A. Stack B. Queue C. Array D. Tree 5. Which data structure is needed to convert infix notation to postfix notation? A. Branch B. Tree C. Queue D. Stack 6. Which data structure is used for implementing recursion? A. Queue B. Stack C. Array D. List 7. Which of the following statement(s) about stack data structure is/are NOT correct? A. Stack data structure can be B. New node can only be added at the top implemented using linked list of the stack C. Stack is the FIFO data structure D. The last node at the bottom of the stack has a NULL link 8. A stack is implemented with an array of ‘A [0..N – 1]’ and a variable ‘pos’. The push and pop operations are defined by the following code. push(x) A[pos] ← x pos ← pos – 1 end push pop( ) pos ← pos + 1 return A[pos] end pop Which of the following will initialize an empty stack with capacity N for the above implementation? A. pos ← -1 B. pos ← 0 C. pos ← 1 D. pos ← N - 1 9. Consider the linked list implementation of a stack. Which of the following node is considered as Top of the stack? A. First node B. Last node C. Any node D. Middle node 10. 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 11. Which one of the following is an application of Stack Data Structure? A. Managing function calls B. The stock span problem C. Arithmetic expression evaluation D. All of the above 12. If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, in what order will they be removed? A. ABCD B. DCAB C. DCBA D. ABDC 13. Below is a stack operation int x = a[top--]; return x; if top becomes zero, then what is that condition called? A. pop B. push C. overflow D. underflow 14. Which of the following is not the correct statement for a stack data structure? A. Arrays can be used to implement B. Elements are stored in a sequential the stack manner C. Top of the stack contains the last D. Stack follows FIFO inserted element 15. Arranging the books in order and removing from the topmost book is an example for________ A. Structure B. Linked List C. Queue D. Stack 16. Stack is a Primitive data type A. False B. True
Q2. Implement the codes for stack operations as discussed in the lecture.