Symbol Table Management MCQs December 19, 2025December 14, 2024 by u930973931_answers 15 min Score: 0 Attempted: 0/15 Subscribe 1. What is the primary purpose of a symbol table in a compiler? (A) To store variables and their attributes (B) To store syntax tree nodes (C) To perform semantic analysis (D) To optimize the code 2. Which of the following is typically stored in a symbol table? (A) Function calls (B) Tokens and keywords (C) Code generation instructions (D) Variable names and their data types 3. What does a symbol table entry typically contain? (A) The source code of the program (B) A list of all keywords used in the program (C) The address of the code that uses the variable (D) The variable’s name and its type, scope, and memory location 4. When is a symbol table created during the compilation process? (A) During lexical analysis (B) During syntax analysis (C) During code generation (D) During semantic analysis 5. Which of the following operations is NOT performed by the symbol table manager? (A) Insertion of new symbols (B) Parsing of source code (C) Deletion of used symbols (D) Lookup of symbol information 6. What happens when a symbol with the same name is declared in a different scope? (A) The new symbol overwrites the previous one (B) A new entry is added for the new scope (C) The new symbol is ignored (D) The compiler throws a syntax error 7. Which of the following is true about the scope of a symbol in a symbol table? (A) A symbol’s scope is independent of its declaration (B) A symbol’s scope is determined by its data type (C) A symbol’s scope determines its visibility throughout the program (D) Symbols in the same scope must have unique names 8. What is one way to manage nested scopes in a symbol table? (A) Use a linked list to store symbols in different scopes (B) Use a single array to store all symbols (C) Use a stack to push and pop symbols as scope changes (D) Use a queue to store the symbols 9. How does the symbol table help in type checking? (A) It stores the types of variables, which can be checked against each other during semantic analysis (B) It automatically corrects type errors (C) It stores the source code with type annotations (D) It performs type inference during compilation 10. Which of the following is NOT typically a component of a symbol table entry? (A) The symbol’s value at runtime (B) The symbol’s type (C) The memory location of the symbol (D) The symbol’s name 11. What is a hash table commonly used for in a symbol table? (A) To optimize memory allocation (B) To maintain the order of symbol declarations (C) To store the symbol’s data (D) To speed up the lookup of symbols 12. How is the scope of a variable typically determined in a symbol table? (A) By the number of times the variable is referenced (B) By the variable’s data type (C) By the function in which the variable is used (D) By the block of code in which the variable is declared 13. What is the role of the symbol table during the code generation phase? (A) To provide information about variables, functions, and their locations for code generation (B) To assist in syntax checking (C) To check for type errors (D) To optimize the generated machine code 14. In which phase of compilation is the symbol table most actively used? (A) Semantic analysis (B) Syntax analysis (C) Lexical analysis (D) Code optimization 15. What is the main advantage of using a symbol table in the context of code generation? (A) It reduces the size of the code (B) It allows for faster execution of the program (C) It provides essential information for generating correct and optimized code (D) It helps in detecting runtime errors