Data Structures MCQs with Answers
Practice important Data Structures MCQs with answers and explanations.
Multiple Choice Questions
Q131: Which of the following is a correct postfix conversion of the infix expression (A + B) * C?
- A: AB+C*
- B: ABC+*
- C: A*BC+
- D: AB+C*
View Answer
D
Q132: During the postfix expression evaluation, when an operator is encountered, what should be done?
- A: Push to stack
- B: Pop two operands
- C: Add to postfix
- D: Skip it
View Answer
B
Q133: In the algorithm for infix to postfix conversion, when an operand is encountered, where is it added?
- A: Stack
- B: Postfix string
- C: Ignored
- D: Prefix string
View Answer
B
Q134: In the expression 4+3*2 without parentheses, which operation is performed first according to the precedence rule?
- A: Addition
- B: Multiplication
- C: Subtraction
- D: None
View Answer
B
Q135: In the algorithm for infix to postfix conversion, what is the purpose of the second while loop at the end?
- A: Add operands to postfix
- B: Add operators to postfix
- C: Add parentheses to postfix
- D: Add all characters to postfix
View Answer
B
Q136: In the example of 6 2 3 + -, after applying -, what is the result?
- A: 1
- B: -1
- C: 4
- D: 2
View Answer
A
Q137: How is the precedence of operators managed during the infix to postfix conversion?
- A: Using a precedence function
- B: By ignoring it
- C: Using a stack
- D: Direct conversion
View Answer
A
Q138: When an operator in the stack has higher precedence than the current input operator during conversion, what is done with the operator in the stack?
- A: It is popped
- B: It is pushed back
- C: It is swapped
- D: It is ignored
View Answer
A
Q139: In the infix to postfix conversion, what is done when the end of the input is reached?
- A: The stack is cleared
- B: The expression is re-evaluated
- C: The input is discarded
- D: The program terminates
View Answer
A
Q140: In the provided algorithm, what is the primary function of the stack?
- A: Store operands
- B: Store operators
- C: Evaluate expressions
- D: Handle errors
View Answer
B