Data Structure Questions and Answers-Reverse a Word using Stack

Data Structure Questions and Answers-Reverse a Word using Stack

 Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Reversing a word using stack can be used to find if the given word is a palindrome or not.
 A True B False
Question 1 Explanation:
This application of stack can also be used to find if the given word is a palindrome because, if the reversed is same as that of the original word, the given word is a palindrome.

 Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which is the most appropriate data structure for reversing a word?
 A queue B stack C tree D graph
Question 2 Explanation:
Stack is the most appropriate data structure for reversing a word because stack follows LIFO principle.

 Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Operations required for reversing a word or a string using stack are push() and pop().
 A True B False
Question 3 Explanation:
Push operation inserts a character into the stack and pop operation pops the top of the stack.

 Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the time complexity of reversing a word using stack algorithm?
 A O (N log N) B O (N2) C O (N) D O (M log N)
Question 4 Explanation:
The time complexity of reversing a stack is mathematically found to be O (N) where N is the input.

 Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What will be the word obtained if the word "abbcabb" is reversed using a stack?
 A bbabbca B abbcabb C bbacbba D bbacabb
Question 5 Explanation:
The string "abbcabb" is pushed on to the stack. If the characters are popped one by one, the word obtained will be bbacbba.

There are 5 questions to complete.