0% found this document useful (0 votes)
52 views8 pages

MCQ - CD

Cd

Uploaded by

kumari2004ramesh
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)
52 views8 pages

MCQ - CD

Cd

Uploaded by

kumari2004ramesh
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/ 8

DATE: REG.NO.

GRT INSTITUTE OF
ENGINEERING AND
TECHNOLOGY, Tiruttani
(An Autonomous Institution)
Accredited by NBA (ECE), NAAC with “A++” Grade &An ISO 9001:2015 Certified Institution
Approved by AICTE, New Delhi& Affiliated to Anna University, Chennai.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

MULTIPLE CHOICE QUESTIONS


ACADEMIC YEAR 2024-2025 (ODD SEMESTER) –NOV / DEC 2024
Third Year / Fifth Semester
CD3501 COMPILER DESIGN (Regulations 2021)
UNIT I
Q.NO ANSWER ALL QUESTIONS (10x2) =20 Marks OPTION MARKS
What is the output of lexical analyzer?
a) A set of RE
1 b) Syntax Tree
c) Set of Tokens
d) String Character
Which symbol table implementation is based on the property of
locality of reference?
2 a) Linear list
b) Search tree
c) Hash Table
d) Self Organisationc
Which of the following is true for operator precedence parsing?
a) For all pair of non-terminal
3 b) For all pair of non-terminals
c) To delimit the handle
d) None of the mentioned
What is an Object program?
a) Program written in machine language
4 b) Program to be translated into machine language
c) Translation of high-level language into machine language
d) None of the mentioned
Which concept of FSA is used in the compiler?
a) Lexical analysis
5 b) Parser
c) Code generation
d) Code optimization
Which concept of grammar is used in the compiler?
a) Lexical analysis
6 b) Parser
c) Code generation
d) Code optimization
Which of the following are Lexemes?
27 a) Identifiers
b) Constants
c) Keywords
d) All of the mentioned

The context free grammar is ambiguous if ______________


a) The grammar contains non-terminals
8 b) Produces more than one parse tree
c) Production has two non-terminals side by side
d) None of the mentioned
What is another name for Lexical Analyser?
a) Linear Phase
9 b) Linear Analysis
c) Scanning
d) All of the mentioned
An individual token is called ________
a) Lexeme
10 b) Lex
c) Lexeme & Lex
d) None of the mentioned
Total Marks (20 Marks)
UNIT II
Q.NO ANSWER ALL QUESTIONS (10x2) =20 Marks OPTION MARKS
Which phase of the compiler is Syntax Analysis?
a) First
1 b) Second
c) Third
d) None of the mentioned
Syntax Analyser is also known as ___________
a) Hierarchical Analysis
2 b) Hierarchical Parsing
c) None of the mentioned
d) Hierarchical Analysis & Parsing
Syntax Analyser takes Groups Tokens of source Program into
3 Grammatical Production.
a) True
b) False
From where it takes its input from?
a) Lexical analyser
4 b) Syntactic Analyser
c) Semantic Analyser
d) None of the mentioned
Parsers are expected to parse the whole code.
5 a) True
b) False
A grammar for a programming language is a formal description of
_______________
a) Syntax
6
b) Semantics
c) Structure
d) Library
Which of these is not true about the Symbol Table?
a) All the labels of the instructions are symbols
7 b) Table has entry for symbol name address value
c) Perform the processing of the assembler directives
d) Created during pass 1
Which of these features of assembler are Machine-Dependent?
a) Instruction formats
8 b) Addressing modes
c) Program relocation
d) All of the mentioned
A compiler can check?
a) Logical Error
9 b) Syntax Error
c) Both Logical and Syntax Error
d) Not Logical and Syntax Error
The fourth Generation computer was made up of ______________
a) Transistor
10 b) Vacuum tubes
c) Chips
d) Microprocessor chips
Total Marks (20 Marks)
UNIT-III
Q.NO ANSWER ALL QUESTIONS (10x2) =20 Marks OPTION MARKS
The below grammar and the semantic rules are fed to a yacc tool
(which is an LALR (1) parser generator) for parsing and evaluating
arithmetic expressions. Which one of the following is true about the
action of yacc for the given grammar?
E -> number Eval number val
E E .val E .VAL E .val
E # E E .val E .VAL E .val
1 ;
a) It detects recursion and eliminates recursion
b) It detects reduce-reduce conflict and resolves
c) It detects shift-reduce conflict and resolves the conflict in favor of
a shift over a reduce action
d) It detects shift-reduce conflict and resolves the conflict in favor of
a reduce over a shift action

Assume the conflicts part (a) of this question are resolved and an
LALR (1) parser is generated for parsing arithmetic expressions as
per the given grammar. Consider an expression 3 # 2 + 1. What
precedence and associativity properties does the generated parser
realize?
E -> number Eval number val
E E .val E .VAL E .val
E#E E .val E .VAL E .val
;
2
a) Equal precedence and left associativity; expression is evaluated to
7
b) Equal precedence and right associativity, expression is evaluated
to 9
c) Precedence of ‘x’ is higher than that of ‘+’, and both operators are
left associative; expression is evaluated to 7
d) Precedence of ‘ # ‘ is higher than that of ‘#’, and both operators
are left associative; expression is evaluated to 9

Consider the following grammar.

S -> S * E
S -> E
E -> F + E
E -> F
F -> id
Consider the following LR (0) items corresponding to the grammar
above.
3
(i) S -> S * .E
(ii) E -> F. + E
(iii) E “F + .E
Given the items above, which two of them will appear in the same
set in the canonical sets-of-items for the grammar?
a) (ii)
b) (i) and (iii)
c) (iii)
d) None of the mentioned
Consider the following grammar:
S -> FR
R -> * S | ε
F -> id
In the predictive parser table, M, of the grammar the entries M [S,
4 id] and M [R, $] respectively.
a) {S ” FR} and {R ” ε}
b) {S ” FR} and {}
c) {S ” FR} and {R ” * S}
d) {F ” id} and {R ” ε}

Consider the following translation scheme.


S -> ER
R -> * E{print{’ * ’);
R|f
E -> F + E{print(’ + ’); | F
F -> (S) | id{print(id.value);}
5 Here id is a taken that represents an integer and id. value represents
the corresponding integer value. For an input ‘2 * 3 + 4’, this
translation scheme prints?
a) 2 * 3 + 4
b) 2 * + 3 4
c) 2 3 * 4 +
d) 2 3 4 + *

consider the following C code segment.


for for if i # i } } }
Which one to the following false?
a) The code contains loop-in variant computation
6 b) There is scope of common sub-expression elimination in this
code
c) There is scope strength reduction in this code
d) There is scope of dead code elimination in this code

Which one of the following is a top-down parser?


a) Recursive descent parser
7 b) Operator precedence parser
c) An LR(k) parser
d) An LALR(k) parser
In the correct grammar above, what is the length of the derivation
(number of steps starting from S to generate the string a l b m with l
! m?
8 a) max (l, m) + 2
b) l+m+2
c) l + m + 3
d) max (l, m) + 3
The grammar is NOTLL(1) because ________
a) It is left recursive
9 b) It is right recursive
c) It is ambiguous
d) It is not context-free
A bottom up parser generates __________
a) Right most derivation
10 b) Rightmost derivation in reverse
c) Leftmost derivation
d) Leftmost derivation in reverse
Total Marks (20 Marks)

UNIT IV
Q.NO ANSWER ALL QUESTIONS (10x2) =20 Marks OPTION MARKS
This set of Compilers Multiple Choice Questions & Answers
(MCQs) focuses on “Runtime Storage Location – 1”.
1. The load instruction is mostly used to designate a transfer from
1 memory to a processor register known as _______
a) Accumulator
b) Instruction Register
c) Program counter
d) Memory address Register
A group of bits that tell the computer to perform a specific operation
is known as ________
a) Instruction code
2
b) Micro-operation
c) Accumulator
d) Register
The time interval between adjacent bits is called the __________
a) Word-time
3 b) Bit-time
c) Turnaround time
d) Slice time
A k-bit field can specify any one of __________
a) 3k registers
4 b) 2k registers
c) K2 registers
d) K3 registers
MIMD stands for __________
a) Multiple instruction multiple data
5 b) Multiple instruction memory data
c) Memory instruction multiple data
d) Multiple information memory data
Logic gates with a set of input and outputs are arrangement of
___________
6 a) Computational circuit
b) Logic circuit
c) Design circuits
d) Register
The average time required to reach a storage location in memory
and obtain its contents is called __________
7 a) Latency time
b) Access time
c) Turnaround time
d) Response time
The BSA instruction is ___________
a) Branch and store accumulator
8 b) Branch and save return address
c) Branch and shift address
d) Branch and show accumulator
A floating point number that has an O in the MSB of mantissa is
said to have __________
9 a) Overflow
b) Underflow
c) Important number
d) Undefined
Translation from symbolic program into Binary is done in
__________
10 a) Two passes
b) Directly
c) Three passes
d) Four passes
Total Marks (20 Marks)

UNIT V
Q.NO ANSWER ALL QUESTIONS (10x2) =20 Marks OPTION MARKS
What is a compiler?
a) system program that converts instructions to machine language
1 b) system program that converts machine language to high-level
language
c) system program that writes instructions to perform
d) None of the mentioned
Which of the following is a stage of compiler design?
a) Semantic analysis
2 b) Intermediate code generator
c) Code generator
d) All of the mentioned
What is the use of a symbol table in compiler design?
a) Finding name’s scope
3 b) Type checking
c) Keeping all of the names of all entities in one place
d) All of the mentioned
Which of the following error can a compiler check?
a) Syntax Error
4 b) Logical Error
c) Both Logical and Syntax Error
d) Compiler cannot check errors
A programmer, writes a program to multiply two numbers instead
of dividing them by mistake, how can this error be detected?
5 a) Compiler or interpreter
b) Compiler only
c) Interpreter only
d) None of the mentioned
Who is responsible for the creation of the symbol table?
6 a) Assembler
b) Compiler
c) Interpreter
d) All of the mentioned
Which of the following is known as a compiler for a high-level
language that runs on one machine and produces code for a different
machine?
7 a) Cross compiler
b) Multipass compiler
c) Optimizing compiler
d) One pass compiler
Which of the following is a system program that integrates a
program’s individually compiled modules into a form that can be
executed?
8 a) Interpreter
b) Assembler
c) Compiler
d) Linking Loader
Which of the following is a definition of compiler?
a) Acceptance of a program written in a high-level language and
9 produces an object program
b) Program is put into memory and executes it
c) Translation of assembly language into machine language
d) None of the mentioned
Which of the following phase of the compiler is Syntax Analysis?
a) Second
10 b) Third
c) First
d) All of the mentioned
Total Marks (20 Marks)

Faculty Incharge HOD/CSE

You might also like