Ce 705
Ce 705
Ce 705
:___________________
RK UNIVERSITY
B.TECH./SEM-VII/REGULAR/NOV-2022
Instructions:
1. Attempt all questions.
2. Make suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Programmable calculator is not permissible.
SECTION – I
Q.1 (a) Select the most appropriate option: (Each of one mark) 06
1. The total number of tokens that are present in the following
statement in C is:
printf(“i=%d, &i=%x”, i&i);
a. 6
b. 10
c. 9
d. 13
2. Look at the grammar A → AA | (A) | ε
It is not suitable for the process of predictive-parsing since the
grammar is:
a. an operator-grammar
b. right-recursive
c. left-recursive
d. ambiguous
3. 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 these
4. Left factoring is the process of factoring out the common
a. Prefixes of alternates
b. Suffixes of alternates
c. Both a and b
d. None of these
Page 1 of 5
5. Which of the following component is important for semantic
analysis?
a. Yacc
b. Lex
c. Symbol Table
d. Type Checking
6. Which derivation uses a top-down parser while parsing some input
strings? Assume that the input is scanned in the order of left to
right.
a. The rightmost derivation that is traced out in reverse
b. The rightmost derivation
c. The leftmost derivation that is traced out in reverse
d. The leftmost derivation
Q.2 (a) Design NFA for a regular expression r= ((a⋅ b)|c)*. Also, Convert 06
NFA into DFA.
(b) Explain phases of compiler using example of Position = initial + rate 05
* 60
(c) Construct LL(1) parsing table for the following grammar. 05
E -> E + T | T
T -> T * F | F
F ->(E) | a | b
Also parse the string id+id*id
OR
Q.2 (a) Consider the following grammar- 06
S→(L)|a
L→L,S|S
Page 2 of 5
(b) Discuss LR(0) parser for the grammar. Also Draw DFA and parsing 05
table.
1. S → AA
2. A → aA | b
(c) Consider the grammar 05
S –> S + S
S –> S * S
S –> id
Perform Shift Reduce parsing for input string “id + id + id”.
SECTION – II
Q.4 (a) Select the most appropriate option: (Each of one mark) 06
1. Which is not True for Data flow Analysis.
a. Useful in register allocation
b. Dead code elimination is not possible
c. Eliminates common sub expression
d. Used in constant and variable propagation
Page 3 of 5
2. Which one of the following is FALSE?
a. A basic block is a sequence of instructions where control enters
the sequence at the beginning and exWhich one of the following
is FALSE?ists at the end
b. Available expression analysis can be used for common sub-
expression elimination
c. Live variable analysis can be used for dead code elimination
d. x=4 * 5=>x=20 is an example of common subexpression
elimination
3. Which is not the type of storage allocation strategies
a. Static allocation
b. Stack allocation
c. Heap allocation
d. memory allocation
4. Which of the following structure has four fields?
a. Parse Tree
b. Quadruples
c. Triples
d. Indirect Triples
5. Which of the following statements about peephole optimization is
False?
a. It is applied to a small part of the code
b. It can be used to optimize the Intermediate code
c. To get the best out of this,it has to be applied repeatedly.It can
be applied to the portion of the code that is not contiguous
d. It can be applied to the portion of the code that is not contiguos
6. DAG is an abbreviation of ?
a. Detecting Acyclic Graph
b. Data Acyclic Graph
c. Dynamic Acyclic Graph
d. Directed Acyclic Graph
*************
Page 5 of 5