CS450 - DLP - External Exam
CS450 - DLP - External Exam
SECTION - I
Answer all the questions. Section Duration: 40 mins
1 Which of the following is responsible for generating anintermediate representation of the source
program?
(1)
Syntax Semantic Code Intermediate code
1) 2) 3) 4)
analyzer analyzer generator generator
2 Which phase of a language processor is responsible for syntaxanalysis and error detection?
4 Which phase of the language processor is responsible for convertingthe intermediate code into the
target machine code?
(1)
Code Code Lexical Syntax
1) 2) 3) 4)
optimization generator analysis analysis
6 Which phase of the language processor performs code transformationsto improve its quality without
changing its functionality?
(1)
Lexical Syntax Code Semantic
1) 2) 3) 4)
analysis analysis optimization analysis
8 Which of the following generates a syntax tree or an abstractsyntax tree (AST) in a language
processor?
(1)
Code Lexical Semantic
1) 2) Parser 3) 4)
generator analyzer analyzer
9 Which phase of a language processor involves the creation andmanagement of temporary variables and
addresses?
(1)
Code Lexical Semantic Code
1) generation 2) analysis 3) analysis 4) optimization
12 Which phase of a language processor is responsible for identifyingand resolving references to variables
and their correspondingmemory locations?
(1)
Semantic Code Code Syntax
1) 2) 3) 4)
analysis optimization generation analysis
13 Match all items in Group 1 with correct options from those given inGroup 2.
Group 1 Group 2
P. Regular expression 1. Syntax analysis
Q. Pushdown automata 2. Code generation
(1)
R. Dataflow analysis 3. Lexical analysis
S. Register allocation 4. Code optimization
P-4. Q-1, R-2, P-3, Q-1, R-4, P-3, Q-4, R-1, P-2, Q-1, R-4,
1) 2) 3) 4)
S-3 S-2 S-2 S-3
14 An LALR(1) parser for a grammar G can have shift-reduce (S-R)conflicts if and only if
15 Assume that the SLR parser for a grammar G has n1 states and theLALR parser for G has n2 states.
The relationship between n1 and n2is:
none (1)
n1 is necessarily n1 is necessarily n1 is necessarily
1) 2) 3) 4) of
less than n2 equal to n2 greater than n2
these
LR
In LL(1), the 1
LALR A parsing algorithm which parser
indicates that (1)
parser is performs a left to right is
1) 2) 3) 4) there is a one -
Bottom - scanning and a right most Bottom -
symbol look -
Up parser deviation is RL (1) Up
ahead.
parser.
19 In the context of abstract-syntax-tree (AST) and control-flow-graph(CFG), which one of the following is
True?
List-I List-II
A. Lexical analysis 1. Graph coloring
B. Parsing 2. DFA minimization
C. Register allocation 3. Post-order traversal
D. Expression evaluation 4. Production tree
(1)
Codes:
ABCD
(a) 2 3 1 4
(b) 2 1 4 3
(c) 2 4 1 3
(d) 2 3 4 1
1) a 2) b 3) c 4) d
SECTION - II
Answer 5 out of 7 questions.
1 Define symbol table and outline the purposes for which a compilerutilizes it. (4)
2 Determine the First and Follow sets for the provided grammar.
S → AaB | bC
A → cD | ε
B→e|ε (4)
C→f|ε
D→g|ε
4 Define lexical analysis and enumerate the tasks carried out by alexical analyzer. (4)
SECTION - III
Answer 6 out of 8 questions.
1 Give the rule to remove left recursive grammar. And Eliminate leftrecursion from following grammar.
S → Aa | b (5)
A → Ac | Sd | f
6 Provide an explanation of the input, output, and actions carriedout by each phase of the compiler,
accompanied by an example. (5)
-----End-----