Data Structures | Misc | Question 1
Which data structure is used for balancing of symbols?
(A) Stack
(B) Queue
(C) Tree
(D) Graph
Answer: (A)
Explanation: Stack is used for balancing of symbols. This is extensively used by the compiler to check for missing or additional symbols. The start of the symbol(like (, [, {) are pushed to the stack. When the end of the symbol(like ), \, }) are encountered, it is matched with the corresponding peek element of the stack. If the match is found, the element is popped, else error is flashed.
Quiz of this Question
Recommended Posts:
- Data Structures | Misc | Question 10
- Data Structures | Misc | Question 9
- Data Structures | Misc | Question 6
- Data Structures | Misc | Question 5
- Data Structures | Misc | Question 8
- Data Structures | Misc | Question 4
- Data Structures | Misc | Question 2
- Data Structures | Misc | Question 3
- Data Structures | Misc | Question 7
- Introduction to Data Structures | 10 most commonly used Data Structures
- Data Structures | Heap | Question 5
- Data Structures | Heap | Question 8
- Data Structures | Stack | Question 6
- Data Structures | B and B+ Trees | Question 1
- Data Structures | Hash | Question 4



