int x, a=2;
x=a++;
x+=a;
x/=3;
The number of tokens in following C code is _______
N→L {N.c=L.c}
L→L1 B {L.c=L1.c+B.c}
L→B {L.c=B.c}
B→0 {X}
B→1 {Y}
Select the correct semantic action in place of X and Y.
Choose the wrong option:
S → SA | a
A → AS | b
Select the correct option.
S1: A context free grammar is ambiguous if every string generated by the grammar must have two parse trees.
S2: A context free grammar is ambiguous if atleast one string generated by the grammar must have exactly two parse trees.
Select the correct option.
Both S1 and S2 are true.
S → AS | b
A → SA | a
Select the correct option.
S → AB | ϵ
A → Ba | ϵ
B → Ab | ϵ
The number of conflicts (in cells) in LL(1) parsing table is / are _____
Note: Please enter zero in case of no conflict.
S → PQ
P → aQ | ϵ
Q → Pb | a
Consider the following statements.
S1: The given grammar is LL(1).
S2: The given grammar is linear grammar.
Select the correct option.
S→SS | aSb | ab| ϵ
Select the unambiguous grammar which is equivalent to G.
G1: S → AB
A → A+A | id
B → B−B | id
G2: S → S+T | T
T → T*F | F
F → ϵ
Select the correct option.
S1: There are some LL(1) grammars which are not LALR(1).
S2: Every unambiguous grammar must be LALR(1) grammar.
Select the correct option:
S1: Symbol table is the data structure in the compiler, which is used for managing information about variables and their attributes.
S2: Every regular grammar must be parsed by CLR(1) parser.
Select the correct option:
R1: a(a+b)*
R2: (a+b)*b
Select the option which is not correct.
r1 : (a*b*)*
r2 : (a*+b*)*
The regular expression for L(r1) ∩ L(r2) is:
S→aS
S→Sab
S→b
Select the correct option.
S → XY
X → YS| a
Y → SX | b
The resulting grammar after removing left recursion is
G1: A → bA | ϵ
G2: A → Ab | ϵ
Select the correct option.
G1: A → Ay | xAy | xy
G2: A → xAy | xy | By & B → By |y
Select the correct option:
S1: G1 is not LR(k) for any k.
S2: G2 is LR(k) for k>0 but not for k=0.
Select the correct option.
S → X | Y
X → a | ϵ
Y → b | ϵ
where {S, X, Y} are a set of non-terminals and {a,b} are a set of terminals.
Consider the following statements.
S1: Grammar G can be parsed by CLR(1) parser
S2: Grammar G can be parsed by LL(1) parser
Select the correct option.
G1:
S → PxPzy
P → yzP | y
G2:
S → PxyzP
P → yQ
Q → zyQ | ϵ
Select the correct option.
S → Ax | yAz | tz | ypx
A → t
Select the correct option.
G1: A → AAr | t
G2: A → Atr | tAr | ttr | t
Select the option which is not correct.
S1: A context free unambiguous grammar always generates DCFL.
S2: Every context free grammar which generates a DCFL must be unambiguous.
Select the correct option.
Rule 1: S → DT {D.i = S.i+1, T.i = S.i + D.i, and S.k = 10}
Rule 2: S → LR {L.i = S.i + R.s and R.i = S.i}
Which of the following is true?
For input string (44+45)*41, the output produced by Syntax directed translator is __________
Select the correct arithmetic expression with reference to the given quadruple
1) t1 = i*4
2) t2 = a[t1]
3) t3 = j*4
4) t4 = a[t3]
5) param t2
6) param t4
7) t5 = call f, 2
8) n = t5
Select the correct expression for which this three address code belongs to:
R: a*b + c # d
Here # is one of the operator from set {+, −, *}, where the precedence and associativity of these operators are the same as defined in C language. If the CPU with single register is used to evaluate the expression R, then what could be possible value of operator #, if expression need to be evaluated without storing the intermediate value into memory, i.e., without swapping any intermediate value from register into memory and fetching back from memory into register.