Question
In a compiler, keywords of a language are recognized during
Official answer and solution
- Official answer
- C
- From
- Official GATE 2011 answer key
Solution
Recall the phases of a compiler and the specific role of the lexical analysis phase.
- In compiler design, the lexical analysis phase (scanner) is responsible for reading the raw input character stream and converting it into a sequence of meaningful tokens.
- Language keywords (such as
if,while,int), identifiers, constants, and operators are identified and matched against regular expressions during this initial lexical scanning.
- The parser (syntax analyzer) takes these tokens to construct the parse tree, while code generation and dataflow analysis operate on intermediate representations later in compilation.
Final answer
C
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2011 Computer Science and Information Technology (CS)
- Question
- 1 of 65, printed as CS Q.1
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.