Explore topic-wise MCQs in Compilers.

This section includes 22 Mcqs, each offering curated multiple-choice questions to sharpen your Compilers knowledge and support exam preparation. Choose a topic below to get started.

1.

The phase of compilation which involves type checking is:

A. Parsing
B. Scanning
C. Syntax directed translation
D. Semantic Analyzer
Answer» D. Semantic Analyzer
2.

The scanner outputs:

A. Stream of tokens
B. Image file
C. Intermediate code
D. Machine code
Answer» B. Image file
3.

Which of the following is the task of lexical analysis?

A. To build the uniform symbol table
B. To initialize the variables
C. To organize the variables in a lexical order
D. None of the mentioned
Answer» B. To initialize the variables
4.

The action of parsing the source code into proper syntactic classes is known as:

A. Parsing
B. Interpretation analysis
C. Lexicography
D. Lexical Analysis
Answer» E.
5.

____________ is used for grouping up of characters into token.

A. Lexical Analyzer
B. oolex
C. jflex
D. All of the mentioned
Answer» E.
6.

Which of the following characters are ignored while lexical analysis?

A. .
B. =
C. #
D. WhiteSpace
Answer» E.
7.

Which phase of compiler includes Lexical Analysis?

A. 1
B. 2
C. 3
D. Its primary function, not in any phase
Answer» B. 2
8.

Lexers and parsers are not found in which of the following?

A. compiler front end processing
B. prettyprinters
C. linters
D. none of the mentioned
Answer» E.
9.

A program that performs lexical analysis is termed as:

A. scanner
B. lexer
C. tokenizer
D. all of the mentioned
Answer» E.
10.

Which among the following is not a tool to construct lexical analyzer from a regular expression?

A. lex
B. flex
C. jflex
D. none of the mentioned
Answer» E.
11.

The output of the lexical and syntax analyzer can stated as:

A. parse stream, parse tree
B. token tree, parse tree
C. token stream, parse tree
D. all of the mentioned
Answer» D. all of the mentioned
12.

State true or false:Statement: A lexical analyzer reads the source code line by line.a) Trueb) False

A. Trueb) False a) Statement 1 is assertion, Statement 2 is the reason
B. False a) Statement 1 is assertion, Statement 2 is the reasonb) Statement 1 is assertion, Statement 2 is the solution
C. There is no such Statement 2
D. This is not a function of Lexical AnalyzerView Answer
Answer» C. There is no such Statement 2
13.

The methodology to show an error when the analyzer faces a keyword over an user’s input is based on:

A. rule priority
B. longest match rule
C. keyword-out rule
D. none of mentioned
Answer» B. longest match rule
14.

If the lexical analyser finds a lexeme with the same name as that of a reserved word,it _________

A. overwrites the word
B. overwrites the functionality
C. generates an error
D. something else
Answer» D. something else
15.

Lexemes can be referred to as:

A. elements of lexicography
B. sequence of alphanumeric characters in a token
C. lexical errors
D. none of the mentioned
Answer» C. lexical errors
16.

A programmer, by mistakes writes a program to multiply two numbers instead of dividing them, how can this error be detecte?

A. Compiler
B. Interpreter
C. Compiler or interpreter
D. None of the mentioned
Answer» E.
17.

A system program that brings together separately compiled modules of a program into a form language that is suitable for execution

A. Assembler
B. Linking loader
C. Cross compiler
D. None of the mentioned
Answer» C. Cross compiler
18.

Which of the following is not feature of compiler?

A. Scan the entire program first and translate into machine code
B. To remove syntax errors
C. Slow for debugging
D. Execution time is more
Answer» E.
19.

System program such a compiler are designed so that they are

A. Re-enterable
B. Non-Usable
C. Serially usable
D. None of the mentioned
Answer» B. Non-Usable
20.

A compiler program written in a high level language is called

A. Source Program
B. Object Program
C. Machine Language Program
D. None of the mentioned
Answer» B. Object Program
21.

The lexical analyzer takes_________as input and produces a stream of_______as output.

A. Source program, tokens
B. Token, source program
C. Either of the two
D. None of the mentioned
Answer» B. Token, source program
22.

What constitutes the stages of the compilation process?

A. Feasibility study, system, design, and testing
B. Implementation and. documentation
C. Lexical analysis, syntax. Analysis and code generation
D. None of the mentioned
Answer» D. None of the mentioned