# YOU CAN DOWNLOAD 200+ SUBJECTS PDF BOOK FOR COMPETITIVE EXAMINATIONS

## Balanced Parenthesis Multiple choice Questions and Answers (MCQs)

Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

What is the time complexity of balancing parentheses algorithm?

O (N) | |

O (N log N) | |

O (M log N) | |

O (N ^{2}) |

Question 1 Explanation:

The time complexity of balancing parentheses algorithm is mathematically found to be O (N).

Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

Which application of stack is used to ensure that the pair of parentheses is properly nested?

Balancing symbols | |

Reversing a stack | |

Conversion of an infix to postfix expression | |

Conversion of an infix to prefix expression |

Question 2 Explanation:

Balancing symbols application ensures that the pair of parentheses are properly nested while reversing stack reverses a stack.

Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

In balancing parentheses algorithm, the string is read from?

right to left | |

left to right | |

center to right | |

center to left |

Question 3 Explanation:

Any string is read by the compiler from left to right and not from right to left.

Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

Which is the most appropriate data structure for applying balancing of symbols algorithm?

stack | |

queue | |

tree | |

graph |

Question 4 Explanation:

Stack is the most appropriate data structure for balancing symbols algorithm because stack follows LIFO principle (Last In First Out).

Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER] |

Which of the following does the balancing symbols algorithm include?

balancing double quotes | |

balancing single quotes | |

balancing operators and brackets | |

balancing parentheses, brackets and braces |

Question 5 Explanation:

The balancing symbols algorithm using stack only includes balancing parentheses, brackets and braces and not any other symbols.

There are 5 questions to complete.