A compiler which allows only the modified section of the source code to be recompiled is called
(A) Subjective compiler
(B) Dynamic compiler
(C) Re-configurable compiler
(D) Incremental compiler Ans: D Question: 2
A compiler is preferable to an interpreter because
(A) Debugging can be faster and easier
(B) If one changes a statement, only that statement needs re-compilation
(C) It is much helpful in the initial stages of program development
(D) It can generate stand alone programs that often take less time for execution Ans: D
Question: 3
Which of the following symbol table implementation has the minimum access time?
(A) Self-organizing list
(B) Linear
(C) Search tree
(D) Hash table Ans: D
Question: 4
A top-down parser generates
(A) Left-most derivation in reverse
(B) Left-most derivation
(C) Right-most derivation in reverse
(D) Right –most derivation Ans: B
Question: 5
Which of the following parsers is the most powerful?
(A) SLR
(B) LALR
(C) Canonical LR
(D) Operator-precedence Ans: C
Question: 6
Which table is a permanent database that has an entry for each terminal symbol?
(A) Reductions
(B) Identifier table
(C) Literal table
(D) Terminal table Ans: D
Question: 7
The action of parsing the source program into proper syntactic classes is called
(A) General syntax analysis
(B) Interpretation analysis
(C) Syntax analysis
(D) Lexical analysis Ans: D
Q8.A bottom-up parser generates
(A) Left-most derivation in reverse
(B) Left-most derivation
(C) Right-most derivation in reverse
(D) Right –most derivation Ans: C
Question: 9
The bottom-up parsing method is also called
(A) Shift reduce parsing
(B) Predictive parsing
(C) Recursive descent parsing
(D) None of these Ans: A
Question: 10
The method which merges the bodies of two loops is
(A) Constant folding
(B) Loop jamming
(C) Loop unrolling
(D) None of these Ans: B
Question: 11
Synthesized attribute can be easily simulated by a
(A) LR grammar
(B) LL grammar
(C) Ambiguous grammar
(D) None of these Ans: A
Question: 12
The top-down parsing method is also called
(A) Operator precedence parsing
(B) Recursive descent parsing
(C) Shift reduce parsing
(D) None of these Ans: B
Question: 13
Which of the following techniques is used to replace run-time computations by compile time
computations?
(A) Constant folding
(B) Code hoisting
(C) Pee phole optimization
(D) Invariant computation Ans: A
Question: 14
The most general phase structured grammar
(A) Context sensitive
(B) Context free
(C) Regular
(D) None of these Ans: A
Question: 15
Which of the following class of statement usually produces no executable code when compiled?
(A) Assignment statement
(B) Structural statements
(C) Input and output statements
(D) Declaration Ans: B
Question: 16
The lexical analyzer takes as input and produces a list of
of output.
(A) Machine code, mnemonic
(B) Tokens, source code
(C) Source code, tokens
(D) Both a and b Ans: C
Question: 17
Linear analysis is called in a compiler.
(A) Lexical analysis
(B) Scanning
(C) Testing
(D) Both a and b Ans: D
Question: 18
Lexical analysis is about breaking a sequence of characters into
(A) Tokens
(B) Lines
(C) Groups
(D) Packets Ans: A
Question: 19
The phase Syntax Analysis is modeled on the basis of
(A) High level language
(B) Low level language
(C) Context free grammar
(D) Regular grammar Ans: C
Question: 20
Compiler is a program that
(A) Accepts a program written in a high level language and produces an object program
(B) Appears to execute a source program as if it were machine language
(C) Automates the translation of assembly language into machine language
(D) Places programs into memory and prepares them for execution Ans: A
Question: 21
An optimizing compiler
(A) Is optimized to occupy less space
(B) Optimized the code
(C) Is optimized to take less time for execution
(D) None of these Ans: B
Question: 22
A compiler for a high level language that runs on one machine and produce code for different
machine is called
(A) One pass compiler
(B) multipass compiler
(C) croos compiler
(D) optimizing compiler Ans: C
Question: 23
The graph that shows the basic blocks and their successor relationship is called
(A) Hamiltonian graph
(B) Control graph
(C) Flow graph
(D) DAG
Ans: C
Question: 24
constructs the desired target program from the intermediate representation of the source
program.
(A) Analysis part
(B) Lexical part
(C) Synthesis part
(D) None of these Ans: C
Question: 25
What is the name of the process that determining whether of tokens can be generated by a
grammar?
(A) Analysing
(B) Parsing
(C) Translating
(D) Recognizing Ans: B
Question: 26
grammars are not phase structured grammar.
(A) Regular
(B) Context free
(C) Context sensitive
(D) None of these Ans: D
Question: 27
The parsing technique that avoids backtracking is
(A) Top-down parsing
(B) Recursive-descent parsing
(C) Predictive parsing
(D) Both (b) and (c) Ans: D
Question: 28
CSG (COntext Sensitive Grammar) can be recognized by
(A) Push down automata
(B) Finite state automata
(C) 2-way linear bounded automata
(D) All of the above Ans: C
Question: 29
Which of the following symbol table implementation is based on the property of locality of
reference?
(A) Linear list
(B) Self-organizing list
(C) Search tree
(D) Hash table Ans: B
1. Who is responsible for the creation of the symbol table?
[ ]
a) Assembler b) Compiler
c) Interpreter d) All of the mentioned
2. Which of the following is a definition of compiler?
[ ]
a) Acceptance of a program written in a high-level language and 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
3. Which of the following phase of the compiler is Syntax Analysis?
[ ]
a) Second b) Third
c) First d) All of the mentioned
4. Which of the following concept of FSA is used in the compiler?
[ ]
a) Code optimization b) Code generation
c) Lexical analysis d) Parser
5. In which of the following phase of the compiler is Lexical Analyzer?
[ ]
a) Second b) Third
c) First d) All of the mentioned
6. A form of recursive-descent parsing that does not require any back-tracking is known
as? [ ]
a) predictive parsing b)non-predictive parsing
c) recursive parsing d)non-recursive parsing
7. Which of the following derivations does a top-down parser use while parsing an
[ ]
input string?
a) Leftmost derivation b) Leftmost derivation in reverse
c) Rightmost derivation d) Rightmost derivation in reverse
8. A bottom-up parser generates __________
[ ]
a) Right most derivation b) Rightmost derivation in reverse
c) Leftmost derivation d) Leftmost derivation in reverse
9. A grammar that produces more than one parse tree for some sentence is called ___
[ ]
a) Ambiguous b) Unambiguous
c) Regular d) None of the mentioned
10. Which one of the following is a top-down parser?
[ ]
a) Recursive descent parser b) Operator precedence parser
c) An LR(k) parser d) An LALR(k) parser
1. The lexical analyzer takes ________________________________________as
input.
2. The entity which generate Language is termed as________________________
3. The Grammar can be defined as: G=(V, ∑, p, S) In the given definition, what does S
represents__________________
4. _________________________derivations does a top-down parser use while parsing
an input string
5. _________________________derivations does a bottom-up parser use while parsing
an input string
6. A bottom up parser generates __________
7. A grammar that produces more than one parse tree for some sentence is called
__________
8. Shift reduce parsers are __________
9. _____________________________________table implementation is based on the
property of locality of reference
10. Object program means__________________________________________
1Q)Explain the Phases in Compiler Design with neat diagram and with the given example?
X=a+b*c
2Q)Define Regular Expression. Explain conversion from FA to RE with given example?
3Q)Define ambiguous Grammer. Explain the procedure to convert from Ambiguous to
Unambiguous Grammar using operator precedence and associativity concept?
4Q)Explain LL(1) Parser and construct LL(1) parsing table with the given example
E --> TE'
E' --> +TE' | ε
T --> FT'
T' --> *FT' | ε
F --> id | (E)
5Q) Explain operator predence grammar and construct operator precedence parsing table
and function table for following example?
E->E+T/id
6Q)Explain functions of lexical analyzer And Explain LEX tool?
7Q) Explain Input Buffering with example ?
8Q)Explain conversion NFA with ε to NFA with given example?
9Q) Explain Left recursion and Left factoring and how to eliminate ?
1)Eliminate left recursion from the given productions
E→E+T|T
T→T∗F|F
F→(E)|id
2)Eliminate Left factoring from the given productions
S → iEtS / iEtSeS / a
E→b
10Q)Explain SLR(1) Parser and construct SLR(1) parsing table with the given example
S ->AA
A -> aA | b
11Q)Explain operator predence grammar and construct operator precedence parsing table
and function table for following example?
E->E*T/id
12Q) Explain Tokens, lexemes and patterns And
Explain LEX tool?