MCQ Answer

The data structure required to check whether an expression contains a balanced parenthesis is?

The data structure required to check whether an expression contains a balanced parenthesis is?

Topic : Stack

A. Stack

B. Queue

C. Array

D. Tree




Correct Answer is :

A. Stack



Explanation
The stack is a simple data structure in which elements are added and removed based on the LIFO principle. Open parenthesis is pushed into the stack and a closed parenthesis pops out elements till the top element of the stack is its corresponding open parenthesis. If the stack is empty, parenthesis is balanced otherwise it is unbalanced.
Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2026 Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Best Website and Software Company in Allahabad