YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS
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.
True | |
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?
queue | |
stack | |
tree | |
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().
True | |
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?
O (N log N) | |
O (N2) | |
O (N) | |
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?
bbabbca | |
abbcabb | |
bbacbba | |
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.