0% found this document useful (0 votes)
341 views

Compiler Design MCQ - Javatpoint

compiler design

Uploaded by

joneman502
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
341 views

Compiler Design MCQ - Javatpoint

compiler design

Uploaded by

joneman502
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Home Compiler Data Structure C C++ C# Java SQL HTML CSS JavaScript Ajax Android Cloud Computing Design

CSS JavaScript Ajax Android Cloud Computing Design Pattern Interview Q

Compiler Tutorial
Compiler Tutorial
Compiler Introduction Your reading experience, reimagined
Compiler Phases Kindle Paperwhite (8 GB)
Amazon
Compiler Passes
Bootstrapping
Finite State machine
Regular expression
Optimization of DFA
Compiler Design MCQ ← Prev Next →

LEX
1) Users write the programs in which language?
Formal Grammar
BNF Notation
a. Low-level Language
YACC
Context free Grammars b. High-Level Language
For iPhone Silicone Case
Capabilities of CFG
Derivation
c. Decimal-Format For iPhone 14 13 Pro Max Case Luxury Liquid Silic…
AilExpress
Parse Tree d. Middle-Level Language
Ambiguity

Basic Parsing Hide Answer Workspace


Parser
Shift Reduce Parsing
Operator Precedence Answer: b. High-Level Language

Predictive Parsers
Explanation: Users write the program in a high-level language because it is easier to use,
LR parser
understand and remember.
LR(0) Items
SLR(1) Parsing
CLR(1) Parsing
LALR(1) Parsing 2) Which computer program accepts the high-level language and converts it into assembly language?
Parser Generator
a. Interpreter
SDT
Syntax Directed Translation b. Linker
SDT Translation scheme
SDT Implementation
c. Assembler
Intermediate Code d. Compiler
Postfix Notation
Parse and syntax trees Hide Answer Workspace
Three address code
Quadruples
Triples Answer: d. Compiler
Assignment statements
Boolean expressions Explanation: Compiler is a computer program that accepts the code written in a high-level
Flow altering statements language and converts that code into the assembly language.
Postfix translation
Array references
Procedures call
3) Does the compiler program translate the whole source code in one step?
Declarations
Case Statements
a. No
Symbol Tables
Symbol Table b. Depends on the Compiler
DS for symbols tables
c. Don't Know
Scope Information
d. Yes
Administration
Storage Organization
Hide Answer Workspace
Activation Record
Storage Allocation

Error Detection Answer: d. Yes


Lexical Error
Syntax Error Explanation: The compiler is that program which translates the whole high-level code into the
Semantic Error machine code at once.
Code Generation
Code Generation
Design Issues
4) Which of the following file is an output of the assembler?
Target Machine
Run Time Storage
Lenovo XT80 Bluetooth
Basic Block Bluetooth 5.3 and stereo sound quality, IPX5 waterproof, Ergonomic earhook design
Flow Graph AilExpress

Block Optimization
Code Generator

Code Optimization a. Program file


Machine Independent
b. Object file
Loop optimization
DAG Representation c. Data File
Data-Flow Analysis
d. Task File
The Phases of a compiler-Lexical
Analysis
Hide Answer Workspace
Eliminating Ambiguity of a
Context-Free Grammar

Compiler Design MCQ Answer: b. Object File


Compiler Design MCQ
Explanation: The object file contains the object code, which is an output of an assembler.

5) Which tool is used for grouping of characters in tokens in the compiler?

a. Parser

b. Code optimizer

c. Code generator

d. Scanner

Mini Porcket P… Hide Answer Workspace


MMN Portable Mini T…
AilExpress

Answer: d. Scanner

Explanation: Scanner is a subroutine which is called by the compiler program. The scanner
combines the characters and implements them to produce tokens.

6) What is the linker?

a. It is always used before the program execution.

b. It is required to create the load module.

c. It is the same as the loader

d. None of the above

Hide Answer Workspace

Answer: b. It is required to create the load module.

Explanation: Linker is a program in the compiler which is required to create a load module.

7) Parsing is categorized into how many types?

a. three types

b. four types

c. two types

d. five types

Hide Answer Workspace

Answer: c. two types

Explanation: In the compiler design, the parser is mainly categorized into top-down parsing and
bottom-up parsing.

8) In which parsing, the parser constructs the parse tree from the start symbol and transforms it into the
input symbol.

a. Bottom-up parsing

b. Top-down parsing

c. None of the above

d. Both a and b

Hide Answer Workspace

Answer: b. Top-Down Parsing

Explanation: Top-down parsing is a technique which constructs the parse tree from the start
symbol and transforms it to the input symbol. This type of parsing is also referred to as predictive
or recursive parsing.

9) Which derivation is generated by the top-down parser?

a. Right-most derivation in reverse

b. Left-most derivation in reverse

c. Right-most derivation

d. Left-most derivation

Hide Answer Workspace

Answer: d. Left-most derivation

Explanation: Top-down parser generates the left-most derivation. It constructs the parse tree
from left to right and constructs the left-most derivation of the specified sentence.

10) Which derivation is generated by the bottom-up parser?

Funny cat toys


BESTOYARD 2pcs Cat Teaser Doll Toys
Amazon

a. Right-most derivation in reverse

b. Left-most derivation in reverse

c. Right-most derivation

d. Left-most derivation

Hide Answer Workspace

Answer: a. Right-most derivation in reverse.

Explanation: Bottom-up parser generates the right-most derivation in reverse. It constructs the
parse tree from the input string to the root and tries to construct the right-most derivation of the
specified string backward.

11) Which parser is most powerful in the following parsers?

a. Operator Precedence

b. SLR

c. Canonical LR

d. LALR

Hide Answer Workspace

Answer: c. Canonical LR

Explanation: Canonical LR (CLR) is the most powerful parser than LALR and SLR.

12) The output of the lexical analyzer is _______

a. string character

b. a syntax tree

c. a set of RE

d. a set of tokens

Hide Answer Workspace

Answer: d. a set of tokens

Explanation: Lexical analyzer gives the set of tokens as output. The set of tokens contains
keywords, separators, literals, identifiers, and operators.

13) From the following grammars, which describes the lexical syntax?

a. Lexical Grammar

b. Context-free Grammar

c. Syntactic Grammar

d. Regular Grammar

Show Answer Workspace

14) Which grammar gives multiple parse trees for the same string?

a. Unambiguous

b. Regular

c. Ambiguous

d. All of the above

Show Answer Workspace

15) In Compiler lexical analyzer is used for?

a. removing comments

b. removing whitespace

c. breaking the syntaxes in the set of tokens

d. All of the mentioned

Hide Answer Workspace

Answer: d. All of the mentioned

Explanation: Lexical analyzer is used in the compiler for removing the Whitespace and
comments. It is also used in breaking the syntaxes into the set of tokens.

16) Which is considered as the sequence of characters in a token?

a. Mexeme

b. Lexeme

c. Texeme

d. Pattern

Hide Answer Workspace

Answer: b. Lexeme

Explanation: Lexemes are the string of alphanumeric characters in a single token. In the source
program, lexemes are characters which are identified by the pattern for a token.

17) Which part of the compiler highly used the grammar concept?

Retro mechanical bluetooth keyboard


7KEYS Retro Typewriter Keyboard
Amazon

a. Code optimization

b. Code generation

c. Parser

d. Lexical Analysis

Hide Answer Workspace

Answer: c. Parser

Explanation: The concept of grammar is much used in the parser phase of the compiler.

The parser phase is next to the lexical analysis phase in the compiler. Parser generated the parse
tree using the predefined grammar. The parser has two different techniques for creating a
different parse tree.

18) Which phase of the compiler checks the grammar of the programming?

a. Code Optimization

b. Semantic Analysis

c. Code Generation

d. Syntax Analysis

Hide Answer Workspace

Answer: d. Syntax Analysis

Explanation: Syntax Analysis is the 2nd phase of the compiler, which checks the given input
string is the correct syntax of the programming language.

19) Which of the following component is important for semantic analysis?

a. Yacc

b. Lex

c. Symbol Table

d. Type Checking

Hide Answer Workspace

Answer: d. Type checking

Explanation: In the semantic analysis, type checking is an important component because it


verifies the program's operations from the semantic conventions.

20) Which phase of the compiler is also known as Scanner?

Great portable monitor for laptop


Cocopar Portable Monitor 15.6 Inch
Amazon

a. Syntax Analysis

b. Lexical Analysis

c. Semantic Analysis

d. Code generation

Hide Answer Workspace

Answer: b. Lexical Analysis

Explanation: The first part of the compiler (lexical analysis) is also known as a scanner. It scans
the characters from the source program and implements them to produce tokens.

21) Which phase of the compiler is also known as Parser?

a. Code Optimization

b. Semantic Analysis

c. Syntax Analysis

d. Lexical Analysis

Hide Answer Workspace

Answer: c. Syntax Analysis

Explanation: The phase of the compiler next to the lexical analysis phase is also known as Parser.

Syntax analysis or parser accepts the tokens produced by the lexical analysis and gives the parse
tree in the output.

22) Which of the following parser is a top-down parser?

a. An LALR parser

b. A LR parser

c. Operator precedence parser

d. Recursive descent parser

Hide Answer Workspace

Answer: d. Recursive descent parser

Explanation: Recursive descent parser is a type of top-down parser which generates the parse
tree from top to bottom and reads the input string from left to right.

23) Keywords are recognized in a compiler during -

Flame Aroma Difusor


Kinscoter LED Essential Oil Flame Lamp Difusor
AilExpress

a. the code generation

b. the data flow analysis

c. the lexical analysis of the program

d. the program parsing

Hide Answer Workspace

Answer: c. the lexical analysis of the program

Explanation: Keywords are firstly recognized during the lexical analysis of the program in the
compiler.

24) Leaf nodes in a parse tree indicate?

a. sub-terminals

b. half-terminals

c. non-terminals

d. terminals

Hide Answer Workspace

Answer: d. terminals.

Explanation: All the leaf nodes in the parse tree indicate the terminals. And all the interior nodes
indicate non-terminals.

25) Which graph describes the basic block and successor relationship?

a. Control graph

b. DAG

c. Flow graph

d. Hamilton graph

Show Answer Workspace

26) Which language is accepted by the push-down automata?

a. Type 0 language

b. Type 1 language

c. Type 2 language

d. Type 3 language

Show Answer Workspace

27) The most general phase of structured grammar is?

a. Context-sensitive grammar

b. Context-free grammar

c. Regular grammar

d. All of these

Show Answer Workspace

28) In the compiler, the function of using intermediate code is:

a. to improve the register allocation

b. to increase the error reporting & recovery.

c. to make semantic analysis easier.

d. to increase the chances of re-using the machine-independent code optimizer in other


compilers.

Hide Answer Workspace

Answer: d. to increase the chances of re-using the machine-independent code optimizer in other
compilers.

Explanation: After semantic analysis, the intermediate code increases the chances of reusing the
machine-independent code optimizer in other compilers.

29) In how many types of optimization can be divided?

Wide QHD resolution


KOORUI 34 Inch Ultrawide Curved Gaming Monitor
Amazon

a. two types

b. three types

c. four types

d. five types

Show Answer Workspace

30) The value of which variable is updated inside the loop by a loop-invariant value?

a. loop

b. strength

c. induction

d. invariable

Show Answer Workspace

31) Which compiler runs on one machine and generates code for multiple machines?

a. Multipass compiler

b. Cross compiler

c. Optimizing compiler

d. Onepass compiler

Hide Answer Workspace

Answer: b. Cross compiler

Explanation: Cross compiler is a compiler which runs on one machine and generates code for
more than one machine.

32) Which of the following is not a characteristic of the compiler?

a. More execution time

b. Debugging process is slow

c. The execution takes place after the removal of all syntax errors

d. Firstly scans the entire program and then transforms it into machine-understandable code

Hide Answer Workspace

Answer: a. More execution time

Explanation: The compiler does not take more time to execute. So, more execution time is not a
characteristic of the compiler.

33) Which phenomenon happens when the non-terminal on the left side is repeated as the first symbol on
the right side?

a. Left-most derivation

b. Left recursion

c. Left factoring

d. Left parsing

Hide Answer Workspace

Answer: b. Left recursion

Explanation: Left recursion is the process in which non-terminal on the left side of the
production is the same on the right side as the leftmost symbol.

34) In which derivation the right-most non-terminal symbol is replaced at each step?

a. Right look ahead

b. Right claim

c. Rightmost

d. Right non-terminal

Show Answer Workspace

35) In which derivation the leftmost non-terminal symbol is replaced at each step?

Great portable monitor for laptop


Cocopar Portable Monitor 15.6 Inch
Amazon

a. Left recursion

b. Left non-terminal

c. Left pushdown

d. Leftmost

Hide Answer Workspace

Answer: d. Leftmost

Explanation: The leftmost derivation is that derivation of context-free grammar which replaces
the leftmost non-terminal symbol at each step.

36) The compiler can detect what type of errors?

a. neither logical nor grammatical error

b. logical errors only

c. grammatical errors only

d. both grammatical and logical errors

Hide Answer Workspace

Answer: c. grammatical errors only.

Explanation: Compiler is a computer program that detects grammatical errors, not logical errors.

37) Which symbol is not related to context-free grammar?

a. End symbol

b. Start symbol

c. Non-terminal symbol

d. Terminal symbol

Hide Answer Workspace

Answer: a. End symbol

Explanation: Context-free grammar is that grammar which consists of the start symbol, set of
terminals, set of non-terminal symbols and the set of productions.

38) Which method merges the multiple loops into the single one?

a. Constant Folding

b. Loop rolling

c. Loop fusion or jamming

d. None of the above

Show Answer Workspace

39) Which parser is known as the shift-reduce parser?

a. Bottom-up parser

b. Top-down parser

c. Both Top-down and bottom-up

d. None of the Above

Hide Answer Workspace

Answer: a. Bottom-up parser

Explanation: Bottom-up parser in the compiler is also called the shift-reduce parser.

40) Which of the following tree is the pictorial identification of the derivation?

a. The oct tree

b. The parse tree

c. The binary tree

d. None of the above

Show Answer Workspace

41) The full form of YACC is:

Retro mechanical bluetooth keyboard


7KEYS Retro Typewriter Keyboard
Amazon

a. Yet Another Computer Computer

b. Yet Another Computer Compiler

c. Yet Another Compiler Computer

d. Yet Another Compiler Compiler

Show Answer Workspace

42) What type of conflicts can occur in the shift-reduce parsing?

a. reduce/reduce

b. shift/reduce

c. Both shift/reduce and reduce/reduce

d. None of the above

Show Answer Workspace

43) Which of the following grammar can be translated into DFAs?

a. Generic Grammar

b. Left Linear Grammar

c. Right Liner Grammar

d. All of the above

Show Answer Workspace

44) Which algorithm invokes a function GETREG()?

a. Code motion algorithm

b. Code optimization algorithm

c. Intermediate Code

d. Code generation algorithm

Show Answer Workspace

45) FORTRAN programming language is a _______

a. Turing language

b. Context-sensitive language

c. Context-free language

d. Regular language

Show Answer Workspace

46) The execution time of the code depends on?

a. the usage of machine idioms

b. the way the registers are used

c. the orders in which the computations are performed

d. All of the mentioned

Hide Answer Workspace

Answer: d. All of the mentioned

Explanation: None

47) Which optimization technique is used to reduce the multiple jumps?

a. Latter optimization technique

b. Peephole optimization technique

c. Local optimization technique

d. Code optimization technique

Show Answer Workspace

48) Which of the following term is used to keep track of the location where the current values of the name
are stored?

a. Register descriptor

b. Address descriptor

c. Allocation descriptor

d. Flag register

Show Answer Workspace

49) Which of the following are labeled by operator symbol?

a. Root

b. Interior nodes

c. Leaves

d. Nodes

Hide Answer Workspace

Answer: b. Interior nodes

Explanation: In the compiler, interior nodes are specified by the operator symbol.

50) DAG is an abbreviation of?

a. Detecting Acyclic Graph

b. Data Acyclic Graph

c. Dynamic Acyclic Graph

d. Directed Acyclic Graph

Show Answer Workspace

51) Which of the following is used in various stages or phases of the compiler?

a. Records

b. Program

c. Symbol Table

d. Table

Show Answer Workspace

52) Which of the following structure has four fields?

a. Parse tree

b. Triples

c. Indirect Triples

d. Quadruples

Show Answer Workspace

53) In which of the following tree, the leaf indicates the operand, and the interior node represents the
operator.

a. Syntax tree

b. Parser tree

c. Structured tree

d. Sematic tree

Hide Answer Workspace

Answer: a. Syntax tree

Explanation: Syntax tree is a tree in the compiler which represents operands by leaf and operator
by interior nodes.

54) Which statement is an abstract form of intermediate code?

a. 3- address

b. 2-address

c. address

d. Intermediate code

Show Answer Workspace

55) Which mapping is described by the implementation of the syntax-directed translator?

Mini Porcket Printer


MMN Portable Mini Thermal Printer Wirelessly
AilExpress

a. Parse table

b. Input

c. Output

d. Input-Output

Show Answer Workspace

56) Which of the following function is called the canonical collection of LR(0) item.

a. FIRST

b. GOTO

c. COMPUTE

d. FOLLOW

Show Answer Workspace

57) Which of the following option is not a function of the shift-reduce parser?

a. Reduce

b. Accept

c. Go

d. Shift

Hide Answer Workspace

Answer: c. Go

Explanation: The shift-reduce parser contains only shift, reduce, error and accept action. That's
why Go is not a function of the shift-reduce parser.

58) Which of the following grammar has no two adjacent non-terminals?

a. Irregular grammar

b. Regular grammar

c. Operator

d. Precedence grammar

Show Answer Workspace

59) DFA is an abbreviation of.

a. Non Deterministic Finite set Automata

b. Deterministic Finite Automata

c. Non Deterministic Finite Automata

d. Deterministic Finite set Automata

Show Answer Workspace

60) NFA is an abbreviation of.

8BitDo Ultimate Wireless 2.4G Controller


For PC, Windows 10, 11, Steam Deck, Android & iPhone, iPad (Officially supported by Apple)
AilExpress

a. Non Deterministic Finite set Automata

b. Deterministic Finite Automata

c. Non Deterministic Finite Automata

d. Deterministic Finite set Automata

Show Answer Workspace

Next Topic Compiler Design Tutorial

← Prev Next →

Funny cat toys


BESTOYARD 2pcs Cat Teaser Doll Toys
Amazon

For Videos Join Our Youtube Channel: Join Now

Feedback

Send your Feedback to feedback@javatpoint.com

Help Others, Please Share

Learn Latest Tutorials

Splunk SPSS Swagger Transact-SQL

Tumblr ReactJS Regex Reinforcement


Learning

R Programming RxJS React Native Python Design


Patterns

Python Pillow Python Turtle Keras tutorial


tutorial tutorial
Keras
Python Pillow Python Turtle

Preparation

Aptitude Logical Verbal Ability Interview


Reasoning Questions
Aptitude Verbal Ability
Reasoning Interview Questions

Company
Interview
Questions
Company Questions

Trending Technologies

Artificial AWS Tutorial Selenium Cloud


Intelligence tutorial Computing
AWS
Artificial Selenium Cloud Computing
Intelligence

Hadoop tutorial ReactJS Data Science Angular 7


Tutorial Tutorial Tutorial
Hadoop
ReactJS Data Science Angular 7

Blockchain Git Tutorial Machine DevOps


Tutorial Learning Tutorial Tutorial
Git
Blockchain Machine Learning DevOps

B.Tech / MCA

DBMS tutorial Data Structures DAA tutorial Operating


tutorial System
DBMS DAA
Data Structures Operating System

Computer Compiler Computer Discrete


Network tutorial Design tutorial Organization and Mathematics
Architecture Tutorial
Computer Network Compiler Design
Computer Discrete
Organization Mathematics

Ethical Hacking Computer Software html tutorial


Graphics Tutorial Engineering
Ethical Hacking Web Technology
Computer Graphics Software
Engineering

Cyber Security Automata C Language C++ tutorial


tutorial Tutorial tutorial
C++
Cyber Security Automata C Programming

Java tutorial .Net Python tutorial List of


Framework Programs
Java Python
tutorial
Programs
.Net

Control Data Mining Data


Systems tutorial Tutorial Warehouse
Tutorial
Control System Data Mining
Data Warehouse

Like/Subscribe us for latest updates or newsletter

LEARN TUTORIALS INTERVIEW QUESTIONS ABOUT CONTACT

Learn Java Java Interview Questions This website is developed to help students on Contact Us
various technologies such as Artificial
Learn Data Structures SQL Interview Questions Intelligence, Machine Learning, C, C++, Privacy Policy
Learn C Programming Python Interview Questions Python, Java, PHP, HTML, CSS, JavaScript, Sitemap
Learn C++ Tutorial JavaScript Interview Questions jQuery, ReactJS, Node.js, AngularJS,
Bootstrap, XML, SQL, PL/SQL, MySQL etc. About Me
Learn C# Tutorial Angular Interview Questions
Learn PHP Tutorial Selenium Interview Questions This website provides tutorials with examples,
code snippets, and practical insights, making it
Learn HTML Tutorial Spring Boot Interview Questions suitable for both beginners and experienced
Learn JavaScript Tutorial HR Interview Questions developers.
Learn jQuery Tutorial C++ Interview Questions There are also many interview questions
Learn Spring Tutorial Data Structure Interview Questions which will help students to get placed in the
companies.

© Copyright 2011-2021 www.javatpoint.com. All rights reserved. Developed by Tpoint Tech.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy