Question:

Consider the following statements regarding the front-end and back-end of a compiler.
S1: The front-end includes phases that are independent of the target hardware.
S2: The back-end includes phases that are specific to the target hardware.
S3: The back-end includes phases that are specific to the programming language used in the source code.
Identify the CORRECT option.

Show Hint

Remember: Front-end is language-dependent but machine-independent}, while Back-end is machine-dependent but language-independent}.
Updated On: Aug 26, 2025
  • Only S1 is TRUE.
  • Only S1 and S2 are TRUE.
  • S1, S2, and S3 are all TRUE.
  • Only S1 and S3 are TRUE.
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Understand the role of the front-end.
The front-end of a compiler performs lexical analysis, syntax analysis, and semantic analysis. These phases are independent of the target hardware. They depend only on the source programming language.
Thus, S1 is TRUE.
Step 2: Understand the role of the back-end.
The back-end deals with code generation, machine-specific optimization, and register allocation. These steps depend on the target hardware.
Thus, S2 is TRUE.
Step 3: Evaluate S3.
S3 states: "The back-end includes phases that are specific to the programming language used in the source code." This is incorrect. Programming language-specific phases (lexical, syntax, semantic analysis) belong to the front-end, not the back-end.
Hence, S3 is FALSE.
Step 4: Conclusion.
From the above analysis, only S1 and S2 are TRUE. \[ \boxed{\text{Correct Option: (B) Only S1 and S2 are TRUE.}} \]
Was this answer helpful?
0
0

Questions Asked in GATE CS exam

View More Questions