Engineering Questions with Answers - Multiple Choice Questions

MCQs on Lexical Analyser – 1

1 - Question

In a compiler the module that checks every character of the source text is called __________
a) The code generator
b) The code optimizer
c) The lexical analyzer
d) The syntax analyzer

View Answer

Answer: a
Explanation: Lexical analysis is the process of converting a sequence of characters into a sequence of tokens.




2 - Question

The context free grammar is ambiguous if ______________
a) The grammar contains non-terminals
b) Produces more than one parse tree
c) Production has two non-terminals side by side
d) None of the mentioned

View Answer

Answer: b
Explanation: Since more than one parse tree is generated hence one than option is available .Therefore it’s ambiguous.




3 - Question

What is another name for Lexical Analyser?
a) Linear Phase
b) Linear Analysis
c) Scanning
d) All of the mentioned

View Answer

Answer: d
Explanation: Lexical Analyzer is also called “Linear Phase” or “Linear Analysis” or “Scanning“.




4 - Question

An individual token is called ________
a) Lexeme
b) Lex
c) Lexeme & Lex
d) None of the mentioned

View Answer

Answer: a
Explanation: Individual Token is also Called Lexeme.




5 - Question

Lexical Analyser’s Output is given to Syntax Analysis.
a) True
b) False

View Answer

Answer: a
Explanation: Lexical Analyzer’s Output is given to Syntax Analysis.




6 - Question

Which phase of the compiler is Lexical Analyser?
a) First
b) Second
c) Third
d) None of the mentioned

View Answer

Answer: a
Explanation: Lexical Analyzer is First Phase of Compiler.




7 - Question

Input to Lexical Analyser is _________
a) Source Code
b) Object Code
c) Lexeme
d) None of the mentioned

View Answer

Answer: a
Explanation: Lexical analyser’s Input is Source Code.




8 - Question

Lexical Analysis Identifies Different Lexical Units in a _______
a) Source Code
b) Object Code
c) Lexeme
d) None of the mentioned

View Answer

Answer: a
Explanation: Lexical Analysis Identifies Different Lexical Units in a source Code.




9 - Question

Which one is a type of Lexeme?
a) Identifiers
b) Constants
c) Keywords
d) All of the mentioned

View Answer

Answer: d
Explanation: All of them along with Operators are different types of lexemes.




10 - Question

A ________ is a string of characters which form a syntactic unit.
a) Lexeme
b) Lex
c) Lexeme & Lex
d) None of the mentioned

View Answer

Answer: a
Explanation: A lexeme is a string of characters that form a syntactic unit.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners