NEW
Font size
WorksheetsStacks
Total questions: 17
Worksheet time: 10mins
Which condition does stack apply?
FILO
LIFO
FIFO
LILO
Only top element can be accessed in stack
True
False
Operation to add values into stack is called
Push
Pop
None
Empty
Operation to remove an element from the stack
Pop
Push
Create
Emplace
Operation that returns the topmost element of the stack
Top
Empty
Size
Swap
Operation to construct and insert new element to the top of the stack
Emplace
Top
Push
Size
If the sequence of operations
push(1)
push(3)
pop
push(2)
push(2)
pop
pop
pop
push(3)
pop
are performed on a stack, the order of popped out values
3, 2, 2, 3, 1
3, 2, 1, 3, 2
2, 3, 2, 3, 1
1, 3, 2, 2, 3
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?
Stack operations performed smoothly
Underflow occurs
Overflow occurs
None of the above
Which of the following is not an application of stack?
Job schedulling
Undo-redo feature
Infix conversion
Tower of hanoi
Which of the following statement about stack data structure is not correct?
Stack is a FIFO data structure
Stack data structure can be implemented using linked list
New element can only be added at the top of the stack
The last node at the bottom of the stack has a NULL link
If the elements “A”, “B”, “C”, and “D” are placed in a stack and are deleted one at a time, in what will be the last element removed?
A
B
C
D
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)
The number of elements left in the stack
1
2
3
4
If a user tries to remove an element from empty stack it is called
Underflow
Overflow
Empty collection
Garbage collection
Convert to postfix form of A * B + C / D is
AB*CD/+
*AB/CD+
A*BC+/D
ABCD+/*
Convert the following Infix to Postfix form
v * w + (x * y) + z
vw*xy*+z+
vw*xy+*z*
vw+xy*z+
none
What is the value of the postfix expression 6 3 2 4 + – *
-18
1
40
74
Analyze the following code and determine the order of stacks from the shortest to longest
stack1.push(12);
stack2.push(24);
stack3.push(11);
stack1.push(37);
stack2.push(59);
stack3.push(46);
stack1.pop();
stack1.pop();
stack2.pop();
stack1.emplace(12);
stack2.emplace(20);
stack3.emplace(41);
stack1.emplace(19);
stack2.emplace(23);
stack3.emplace(10);
stack1.swap(stack2);
stack2.swap(stack3);
Stack2, stack1, stack3
Stack1, stack2, stack3
Stack3, stack2, stack1
None of the above
