Which of the following best describes the role of a lexical analyzer in a…
2025
Which of the following best describes the role of a lexical analyzer in a compiler design?
Answer: D. It partitions the source code into tokens and removes comments and white spaces.
- A.
It converts high-level source code into assembly code.
- B.
It checks semantic consistency in the program.
- C.
It builds the symbol table during code generation.
- D.
It partitions the source code into tokens and removes comments and white spaces.
Attempted by 156 students.
Show answer & explanation
Correct answer: D
Loading lesson…