Compiler-10
Compiler-10
(1)
1) 1 2) 2 3) 3 4) 4
4) In assembler, OPTAB is
Generated by analysis phase and Generated by synthesis phase and Used by analysis phase as (1)
1) 2) 3)
used by synthesis phase used by analysis phase well as synthesis phase
5) Which one of the following is invalid three address code?
(1)
1) 1 2) 2 3) 3 4) 5
7) S → Sa | b
Which of the following is True?
(2)
There will be SR conflict There will be RR conflict There will be There will be
1) 2) 3) 4)
during parsing during Parsing both conflict no conflict
8) The equivalent expression for the DAG is
(1)
a + (b*c –
1) ((a + b) *c) *(b*(c – a)) 2) 3) (a + (b*c))*((b*c) – a) 4) a*(a + b * c) – a
a)
9) Which one of the following is not the macro pre-processor data structure?
(1)
1) APTAB 2) SYMTAB 3) SSNTAB 4) MNT
10) P → PαQ | Q Q → QβR | R R → num
If 2α3α4β1α2β1 is evaluated to 18, then which of the following is the correct value for β and α ? (2)
1) 1 2) 2 3) 3 4) 4
12) _____ is the first software to run when the computer is switched on
Static (1)
Control stack keep State gives In case of heap allocation, same
allocation
1) track of all process 2) information of storage 3) storage is allocated for each 4)
can grow at
activation. and value binding. activation of the process.
run time.
14) Size of the data object must be known in case of
Dependency
In parse tree-based In rules-based Parse tree based and
graph is not (1)
methods dependency methods is oblivious methods both are
1) 2) 3) 4) constructed in
graph is not evaluation order is more efficient then rule
rule based
constructed. decided at run time. based methods.
method.
16) Identify the phase of a compiler detecting following types of errors/warnings.
S → aB | aAb
A → bAb | a
B → aB | ε
(1)
1) (a)(2), (b)(1), (c)(3) 2) (a)(3), (b)(1), (c)(2) 3) (a)(1), (b)(2), (c)(3) 4) (a)(3), (b)(2), (c)(1)
Section II-A
Answer 5 out of 7 questions.
17) Check whether below grammar is LL (1) or not. Justify your answer
18) Symbol Table is an important data structure created and maintained by the compiler. What information is stored in symbol table?
Also explain which data structures are used to implement symbol table with its pros and cons.( (5)
19) Deign Syntax Direction Translation (SDT), which can process below given input string. Also construct annotated parse tree and
dependency graph for the same input string. Follow the precedence rule of C programming while processing the string. (5)
Input string: a = b + c * (d – f)
21) Find basic block and draw control graph for following code written in higher level language.
(5)
22) Generate the machine code for the given assembly code.
(5)
23) Generate three address code for below expression. Also show implementation ways using (a) Quadruple (b) triple and (c) Indirect
triple.
(5)
Expression: a + ( b * c)* d ^ e
Section II-B
Answer 5 out of 6 questions.
24) Explain the technique that reduces the amount of overhead required to process an input character during scanning process. (5)
(5)
26) Generate SLR parsing table for following grammar and check whether grammar is SLR or not.
E -> E + T
E -> T (5)
T -> id | ( E )
T -> id
27) What is run time environment? Give brief idea of memory allocation done during compilation with block structured language. What
are the limitations of stack based memory allocation? (5)
28) Code generation phase of the compiler takes an intermediate code as an input and generates target machine code as an output.
Discuss some common issues in design of the code generator phase. (5)
29) Process the given macro and show the entries of all macro pre-processor data structures
(5)
-----End-----