Font size
WorksheetsTopic 3 (Stacks)
Total questions: 20
Worksheet time: 40mins
Process of inserting an element in stack is called (a)
In a stack, if a user tries to remove an element from empty stack it is called (a)
Pushing an element into stack already having five elements and stack size of 5, then stack becomes (a)
Which of the following is true about linked list implementation of stack?
In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.
In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.
Both of the above
None of the above
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
2,2,1,1,2
2,2,1,2,2
2,1,2,2,1
2,1,2,2,2
Consider the following operations performed on a stack of size 5 : Push (a); Pop() ; Push(b); Push(c); Pop(); Push(d); Pop();Pop(); Push (e) Which of the following statements is correct?
Underflow occurs
Overflow occurs
Stack operations are performed smoothly
None of the above
Consider the linked list implementation of a stack. Which of the following node is considered as Top of the stack?
Last node
Any node
First node
Middle node
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
1
2
3
4
What type of data structure does a Stack is?
Linear
Non -linear
In stacks, the possibility to do insertion and deletion is ____
at one end only
at both ends
From the following which are static and dynamic representations of stacks?
Linked lists – Static, Arrays – Dynamic
Arrays – Static, Linked lists – Dynamic
Queues –Dynamic, Arrays – Static
None of the mentioned
The concept “Pile of Plates” is applicable in which one of the following.
Linked list
Queue
Tree
Stack
When does top value of the stack changes?
Before deletion
After deletion
At the time of deletion
While checking underflow
In the linked list implementation of the stack class, where does the push member function place the new entry on the linked list?
At the head
At the tail
At the middle
None
In linked representation of stack the null pointer of the last node in the list signals __________
Beginning of the stack
Bottom of the stack
Middle of the stack
In between some value
Only top element can be accessed in stack.
True
False
Consider following Scenario -
The five items : P,Q,R,S and T are inserted into stack A one after other starting from T in reverse order.
The stack is popped three times and each element is inserted into another stack B.
Then two elements are deleted from the stack B and pushed back onto the stack A.
What are the topmost elements of stack A and Stack B respectively?
Q P
R P
Q R
R Q
User perform following operations on stack of size 5 then -
push(1);
pop();
push(2);
push(3);
pop();
push(2);
pop();
pop();
push(4);
pop();
pop();
push(5);
Which of the following is correct statement for stack ?
Underflow Occurs
Overflow Occurs
Stack operations will be performed smoothly
What will be the initial value with which top is initialized.
1
0
-1
Choose correct output for the following sequence of operations.
push(5)
push(8)
pop
push(2)
push(5)
pop
pop
pop
push(1)
pop
8 5 2 5 1
8 5 5 2 1
8 2 5 5 1
8 1 2 5 5
