Stack Reversal using Recursion Multiple choice Questions and Answers (MCQs)

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<

Stack Reversal using Recursion Multiple choice Questions and Answers (MCQs)

Click on any option to know the CORRECT ANSWERS

Question 1
Which of the following statement is true about stack?
A
Pop operation removes the top most element
B
Pop operation removes the bottom most element
C
Push operation adds new element at the bottom
D
Push operation removes the top most element
Economics Questions answers

Question 1 Explanation: 
As stack is based on LIFO(Last In First Out) principle so the deletion takes place from the topmost element. Thus pop operator removes topmost element.

Question 2
What is the space complexity of program to reverse stack recursively?
A
O(1)
B
O(log n)
C
O(n)
D
O(n log n)
Civics Test Questions answers

Question 2 Explanation: 
The recursive program to reverse stack uses memory of the order n to store function call stack.

Question 3
Stack can be reversed without using extra space by .....
A
using recursion
B
using linked list to implement stack
C
using an extra stack
D
it is not possible
Data interpretation (DI) Questions answers

Question 3 Explanation: 
If linked list is used for implementing stack then it can be reversed without using any extra space.

Question 4
Which of the following is considered as the top of the stack in the linked list implementation of the stack?
A
Last node
B
First node
C
Random node
D
Middle node
Commerce Questions answers

Question 4 Explanation: 
First node is considered as the top element when stack is implemented using linked list.

Question 5
What is the time complexity of the program to reverse stack when linked list is used for its implementation?
A
O(n)
B
O(n log n)
C
O(n2)
D
O(log n)
Sociology Questions answers

Question 5 Explanation: 
As a linked list takes O(n) time for getting reversed thus linked list version of stack will also take the same time.

There are 5 questions to complete.

 

 Download all FREE PDF Ebook >>>CLICK HERE<<<