0% found this document useful (0 votes)
18 views2 pages

Compilation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views2 pages

Compilation

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Compilation Process Questions and Answers

1. What process in compilation translates the source code into machine code?
Answer: c. Code generation
Explanation: This phase translates the intermediate representation of the code into machine
code.
2. What is the first step in the compilation process?
Answer: Lexical Analysis
Explanation: This phase breaks the source code into tokens.
3. What does the compiler generate after lexical analysis?
Answer: Tokens
Explanation: The lexer produces tokens from the source code for further analysis.
4. Error handling is the task of the final code generation stage.
Answer: False
Explanation: Error handling occurs at multiple stages of compilation, not just the final code
generation.
5. The Symbol Table holds all identifiers and their attributes.
Answer: True
Explanation: The symbol table stores information about identifiers, including types and
scopes.
6. What is the main function of the lexer in the compilation process?
Answer: Convert the source code into a series of tokens.
Explanation: The lexer tokenizes the source code for further processing.
7. During the compilation process, what is the purpose of the parser?
Answer: Analyzing the tokenized source code to check its syntactic structure and build a
parse tree.
Explanation: The parser checks syntax and constructs a hierarchical representation of the
code.
8. What is the process in compilation that converts high-level programming language into low-
level language?
Answer: d. Translation
Explanation: Translation refers to converting high-level code into machine or assembly
language.
9. Type checking strategy is the role of the code optimization phase.
Answer: False
Explanation: Type checking is part of semantic analysis, not the code optimization phase.
10. There is only one output in lexical analysis.
Answer: False
Explanation: The lexer produces tokens and may also generate error messages and track
positions.
11. Semantic analysis can be combined with syntactic analysis.
Answer: True
Explanation: Many compilers perform semantic checks alongside syntax analysis for
efficiency.
12. Intermediate code generation connects:
Answer: c. Semantic Analysis to Code optimization
Explanation: Intermediate code serves as a bridge between these two phases.
13. Which stage of compilation checks the source code with the help of grammar?
Answer: a. Syntax checking
Explanation: Syntax checking verifies the grammatical structure of the code.
14. Three Address Code is an intermediate representation.
Answer: True
Explanation: TAC is a form of intermediate representation used in compilers.
15. During the compilation process, the binary code is immediately generated in memory.
Answer: False
Explanation: Binary code is typically written to a file and loaded into memory when executed.
16. What is the output of semantic analysis in the compilation process?
Answer: d. Symbol table
Explanation: The symbol table stores information about identifiers for semantic verification.
17. Code generation is based on register allocation.
Answer: True
Explanation: Efficient register allocation is crucial for optimizing the generated code.
18. Abstract Parse Tree is the result of syntax checking.
Answer: False
Explanation: Syntax checking produces an Abstract Syntax Tree (AST), not an Abstract Parse
Tree.

You might also like