Which of the following are applications of symbol table? (A) Storage…
2020
Which of the following are applications of symbol table?
(A) Storage allocation
(B) Checking type compatibility
(C) Suppressing duplicate error messages
Choose the correct answer from the options given below:
- A.
(A) and (B) Only
- B.
(A) and (C) Only
- C.
(B) and (C) Only
- D.
(A), (B) and (C)
Attempted by 324 students.
Show answer & explanation
Correct answer: D
Answer: All three are applications of the symbol table.
Explanation:
Storage allocation: The symbol table records memory locations, offsets, or addresses for variables and other program entities so the compiler or linker can allocate and reference storage correctly.
Checking type compatibility: The symbol table stores type information (such as integer, float, array types, function signatures) for identifiers, enabling the compiler to validate operations and enforce type rules.
Suppressing duplicate error messages: By recording declarations and previously reported errors related to identifiers, the symbol table helps avoid reporting the same error multiple times for the same entity.
Therefore, storage allocation, checking type compatibility, and suppressing duplicate error messages are all valid applications of the symbol table.
A video solution is available for this question — log in and enroll to watch it.