Online IDE
Free Mock
Improve your coding skills with our resources
Compete in popular contests with top coders

Welcome to Interviewbit, help us create the best experience for you!

Currently, You are a:

Few details about your education

College/University *
Enter the name of your college
Branch *
Year of completion *

Few details about your education

College/University *
Enter the name of your college
Branch *
Year of completion *

Few details about your career...

Current Company *
Enter company name
Experience *

You're all set!

Begin your success journey!

Sign Up using
Full name *
Email *
Password *

By creating an account, I acknowledge that I have read and agree to InterviewBit’s Terms and Privacy Policy .

Welcome back!

Log In using
Email *
Password *

Compiler Design MCQ

Compiler -  It is a software program that converts a program written in High-level language to a low-level language(object/ target language). It also reports errors present in source programs.

Types of compilers:

  • Single-pass compilers: It is a type of compiler that processes the source code only once.
  • Multi-pass compilers: It is a type of compiler that processes the source code multiple time(to convert High-level language to Low-level language) i.e. to convert source code to target/ object code.

There are two phases of the compilation process:

  • Analysis: It breaks up the source code/program into small parts and creates an intermediate representation of the source program.
  • Synthesis phase: It takes the intermediate representation of the source program as input and creates the desired target code/program.

There are five phases of a compiler:

Lexical analyzer 

  • Reads the program and converts it into tokens using the LEX tool.
  • Tokens are defined by regular expressions which are understood by the lexical analyzer
  • Removes white spaces, comments, tabs.

Syntax analyzer

  • Constructs the parse tree.
  • Takes the tokens one by one and uses CFG to construct the parse tree.
  • Using these productions we can represent what the program actually is.
  • The input has to be checked whether it is in the desired format or not.

Semantic analyzer

  • Verifies the parse tree, whether it is meaningful or not.
  • It uses the parse tree and info in the symbol table to check the source program for semantic consistency with the language definition.

Intermediate code generator

  • Generates the intermediate code. Example: Three address codes.
  • This code is converted to machine language using the last two phases which are platform dependent. 

Code optimizer

  • We can get optimized code.
  • The code optimization phase attempts to improve the intermediate code so that it runs faster and consumes fewer resources.

Target code generator

  • The final phase of the compiler generates the target code/assembly code.

Symbol Table

  • The data structure is used by the compiler to store all the information related to identifiers, for example, their types, scope, location name, etc.
  • It helps the compiler to function smoothly by finding the identifiers quickly.
  • All the phases interact with the symbol table manager.

Error handler

It is a module that takes care of the events which are encountered during compilation and it takes care to continue the compilation process even if the error is encountered. The task of the error handling process is to detect each error, report it to the user and implement them to handle errors.


It is basically a set of rules that defines the valid structure of a particular language.

A grammar consists of four components:

  • Set of terminals: They are not replaced by any other thing further.
  • Set of non-terminals: Values/variables that are replaced by terminals.
  • Set of productions
  • Start symbol: One of the non-terminals is designated as the start symbol from where the production begins.

Compiler Design MCQs


What is the action of parsing the source program into proper syntactic classes known as?


What does a bottom-up parser generate?


What is the bottom-up parsing method also known as?


Identify the method which merges the bodies of two loops?


Which of the compiler allows the only modified sections of source code to be recompiled?


Identify the data structure which has minimum access time in case of symbol table implementation?


What does a top-down parser generate?


Identify the most powerful parser?


Through which type of grammar can synthesized attributes can be simulated?


Another name of top-down parsing is?


Identify the most general phase of structured grammar.


Identify the technique used to replace run-time computations with compile-time computations.


Identifying the class of statement when compiled does not produce any executable code.


What does the lexical analyzer take as input?


What does the lexical analyzer take as output?


What is a linear analysis called in a compiler?


Identify the correct definition of lexical analysis?


On what basis is the phase syntax analysis modeled?


What is the role of optimizing the compiler?


What is the compiler called which runs on one machine and produces code for a different machine?


What is the graph called which shows basic blocks along with their successor relationship?


What is the action of parsing the source program into proper syntactic classes known as?


Which part produces the target code from the intermediate representation of source code?


Identify the method to determine whether tokens can be generated by a given grammar?


Which parsing technique avoids backtracking?


What of the following can recognize Context-sensitive grammar?


Identify the data structure which is based on the locality of reference used for implementation of the symbol table.


What is the process of searching for match tokens described using?


When is an interpreter preferred over a compiler?


Identify which among the following is used for grouping characters into tokens.


When is type checking done?


Identify the term which is recognized as a sequence of characters in token.


What does LR stand for?


In which class does recursive descent parsing belong?


Why is the minimum Hamming distance method used?


Which of the following errors can a compiler check?


Why is the symbol table used?


Identify the language processor among the following.


Why is handle pruning used?


When can semantic errors be detected?


Identify the correct phase of the compiler.


In which does the compiler translate the source code?


In which phase of the compiler is grammar checked?


Why is semantic analysis responsible for?


Identify the interpreted language.


What is the process of finding a parse tree for a string of tokens called?


In which language do users write the programs?


Check whether the following statement is true or false: Ambiguous grammar produces more than one parse tree for some sentence.


Identify the output of the assembler.

Get Placed at Top Product Companies with Scaler Know More 
Get Placed at Top Product Companies with Scaler Know More 
Get Placed at Top Product Companies with Scaler
Sat transparent 640a34d454880bf68e3bfdf33f2389f2214043f59ad18b4c7f7b114e834fb257.svg

Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Personalised feedback report with solutions
Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Real life Interview Questions
Point markers b3add1cc88e4996b2df6e0aedb9f0d1b65fa73c51b7ada8fbee3895a2aa11802.svg Identify exact topics to improve

Your feedback is important to help us improve.
Free Mock Assessment
Help us know you better for the best experience
Current Employer *
Enter company name
College you graduated from *
Enter university name
Phone Number *
OTP will be sent to this number for verification
Change Number
Resend OTP
By Continuing I agree to be contacted by Scaler in the future.
Already have an account? Log in