Stack MCQ : Puzzles ( Multiple Choice)
Congratulations - you have completed Data Structure.
You scored %%SCORE%% out of %%TOTAL%%.
Your performance has been rated as %%RATING%%
Your answers are highlighted below.
Question 1 |
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.
R P | |
Q P | |
Q R | |
R Q |
Question 2 |
If memory for the run-time stack is only 150 cells(words), how big can N be in Factorial(N) before stack overflow?
66 | |
26 | |
12 | |
60 |
Question 3 |
A postfix expression is just the reverse of the prefix expression !
False | |
True |
Question 4 |
Stack A has 3 Elements in it Say X,Y and Z with X on top.
- Stack B is empty.
- An Element popped out from Stack A can be printed immediately or pushed to stack B.
- An Element popped out from Stack B can only be printed.
Y X Z | |
Z X Y | |
Y Z X | |
Z Y X |
Question 4 Explanation:
Consider Y X Z :
- X is Popped from Stack A and Pushed to Stack B
- Y gets printed.
- X is Popped from Stack B and Printed.
- Z is Popped from Stack A and Printed.
- X is Popped from Stack A and Pushed to Stack B
- Y is Popped from Stack A and Printed.
- Z is Popped from Stack A and Printed.
- X is Popped from Stack B and Printed.
- X is Popped from Stack A and Pushed to Stack B
- Y is Popped from Stack A and Pushed to Stack B
- Z is Popped from Stack A and Printed.
- Y is Popped from Stack B and Printed.
- X is Popped from Stack B and Printed.
Question 5 |
An item that is read as input can be either pushed to a stack and later popped and printed, or printed directly. Which of the following will be the output if the input is the sequence of items 1, 2, 3, 4, 5 ?
3 4 5 2 1 | |
3 4 5 1 2 | |
1 5 2 3 4 | |
5 4 3 1 2 |
Once you are finished, click the button below. Any items you have not completed will be marked incorrect.
There are 5 questions to complete.