livemcqs.com livemcqs.com 500+ Application Of Stacks MCQs with FREE PDF 1. Which application of stack is used to ensure that the pair of parentheses is properly nested? a) Balancing symbols b) Reversing a stack c) Conversion of an infix to postfix expression d) Conversion of an infix to prefix expression Answer: Balancing symbols 2. In balancing parentheses algorithm, the string is read from? a) right to left b) left to right c) center to right d) center to left Answer: left to right 3. Which is the most appropriate data structure for applying balancing of symbols algorithm? a) stack b) queue c) tree d) graph Answer: stack 4. Which of the following does the balancing symbols algorithm include? a) balancing double quotes b) balancing single quotes c) balancing operators and brackets d) balancing parentheses, brackets and braces Answer: balancing parentheses, brackets and braces 5. Which of the following statement is incorrect with respect to balancing symbols algorithm? a) {[()]} b) ([ )] c) {( )} d) { [ ] } Answer: ([ )]
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
livemcqs.com
livemcqs.com
500+ Application Of Stacks MCQs with FREE PDF
1. Which application of stack is used to ensure that the pair of parentheses is properly nested?
a) Balancing symbols
b) Reversing a stack
c) Conversion of an infix to postfix expression
d) Conversion of an infix to prefix expression
Answer: Balancing symbols
2. In balancing parentheses algorithm, the string is read from?
a) right to left
b) left to right
c) center to right
d) center to left
Answer: left to right
3. Which is the most appropriate data structure for applying balancing of symbols algorithm?
a) stack
b) queue
c) tree
d) graph
Answer: stack
4. Which of the following does the balancing symbols algorithm include?
a) balancing double quotes
b) balancing single quotes
c) balancing operators and brackets
d) balancing parentheses, brackets and braces
Answer: balancing parentheses, brackets and braces
5. Which of the following statement is incorrect with respect to balancing symbols algorithm?
a) {[()]}
b) ([ )]
c) {( )}
d) { [ ] }
Answer: ([ )]
livemcqs.com
livemcqs.com
6. What should be done when an opening parentheses is read in a balancing symbols algorithm?
a) push it on to the stack
b) throw an error
c) ignore the parentheses
d) pop the stack
Answer: push it on to the stack
7. When the corresponding end bracket/braces/parentheses is not found, what happens?
a) The stack is popped
b) Ignore the parentheses
c) An error is reported
d) It is treated as an exception
Answer: An error is reported
100+ Balanced Parenthesis Question and Answer with FREE PDF
8. Which is the predefined method available in Java to convert decimal to binary numbers?
a) toBinaryInteger(int)
b) toBinaryValue(int)
c) toBinaryNumber(int)
d) toBinaryString(int)
Answer: toBinaryString(int)
9. What is the time complexity for converting decimal to binary numbers?
a) O(1)
b) O(n)
c) O(logn)
d) O(nlogn)
Answer: O(logn)
Decimal to Binary Using Stacks Question with FREE PDF
10. Which of the following is an example for a postfix expression?