Lexical Analysis · Compiler Design
8 questions · asked in 7 of 27 years (2000–2026)
MCQ 7 · NAT 11-mark 7 · 2-mark 1
2000Questions per year2026
Questions 6–8 of 8
In a compiler, keywords of a language are recognized during
Answer: (C)
Keywords such as if, while and int are tokens. The lexical analyzer finds them when it breaks the source program into tokens.
Answer: the lexical analysis of the program
Answer: the lexical analysis of the program
Which data structure in a compiler is used for managing information about variables and their attributes?
Answer: (B)
A symbol table holds each identifier together with its attributes, such as type, scope and location.
Answer: Symbol table
Answer: Symbol table
The number of tokens in the following C statement is
printf("i=%d, &i=%x", i, &i); Answer: (C)
The tokens are: printf, (, "i=%d, &i=%x", ",", i, ",", &, i, ), ;
The full string literal counts as one token. So the total is 10.
Answer: 10
The full string literal counts as one token. So the total is 10.
Answer: 10
Keep practising