Which of the following is not performed during compilation?
Type checking
Variable is declared before its use
Matching of formal and actual parameters
Dynamic memory allocation
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Select the regular expression which generates language containing all strings with even number of a’s and exactly one “b”.
(aa)*b
b(aa)*
(aa)*b(aa)*
None of the above
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following C-code.

int x, a=2;

x=a++;

x+=a;

x/=3;

The number of tokens in following C code is _______

20
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Consider the following SDT which count the number of zeros in string.

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.

X={B.c=0} & Y= {B.c=0}
X={B.c=0} & Y= {B.c=1}
X={B.c=1} & Y= {B.c=0}
X={B.c=1} & Y= {B.c=1}
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Which of the following is/are performed during semantic analysis?
Type checking
Variable is declared before its use
Type casting
All of the above
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
For parsing arithmetic expressions, involving two operators [*, /] the precedence relation between “*” and “*” will be “<” if

Operator * has higher precedence than operator “/”.
Operator * is left associative
Operator * is right associative
Cannot be determined the associativity
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the below given function table, involving following operators “id”, “+”, “−”.

Choose the wrong option:

The precedence relation between “−” and “+” is >.
The precedence relation between “+” and “+” is >.
The precedence relation between “−” and “id” is >.
The precedence relation between “id” and “id” is >.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following grammar.

S → SA | a

A → AS | b

Select the correct option.

First(S) U Follow(S) = {a, $}
First(A) U Follow(S) = {a,b,$}
First(A) U Follow(A) = {a,$}
First(S) U Follow(A) = {a,b}
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following statements.

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.

Both S1 and S2 are true.
Both S1 and S2 are false.
S1 is true and S2 is false.
S1 is false and S2 is true.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the grammar

S → AS | b

A → SA | a

Select the correct option.

First(S) = {b} and First(A) = {a}
First(S) = {b} and Follow(A) = {b}
First(S) = {a,b} and Follow(S) = {a,$}
First(S) = {a,b} and Follow(S) = {a,b,$}
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following grammar.

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.

4
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Consider the following grammar.

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.

Both S1 and S2 are correct.

Both S1 and S2 are wrong.
S1 is correct but S2 is wrong.
S1 is wrong but S2 is correct.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following ambiguous grammar G.

S→SS | aSb | ab| ϵ

Select the unambiguous grammar which is equivalent to G.

G1: S→AB & A→aAb | ab |ϵ & B→ aBb | ab |ϵ
G2: S→AS & A→aAb | ab |ϵ
G3: S→AS |ϵ & A→aAb | ϵ
G4: S→AS |ϵ & A→aAb | ab
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following grammars G1 and G2.

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.

Both G1 and G2 are operator grammars.
G1 is operator grammar and G2 is not an operator grammar.
G1 is not an operator grammar and G2 is an operator grammar.

Both G1 and G2 are not operator grammars.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the below given statements:

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:

Both S1 and S2 are true.
S1 is correct, while S2 is false.
S1 is false, while S2 is true.
Both S1 and S2 are false.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the below given statements:

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:

Both S1 and S2 are true.
S1 is correct, while S2 is false.
S1 is false, while S2 is true.
Both S1 and S2 are false.
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider the following regular expressions

R1: a(a+b)*

R2: (a+b)*b

Select the option which is not correct.

L(R1) ∩ L(R2)= a(a+b)*b
L(R1) U L(R2)=(a+b)(a+b)* = (a+b)+

L(R1) ∩ L(R2)= L(R1). L(R2)
Complement(L(R1))≠ L(R2)
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the given below regular expressions over ∑={a,b}

r1 : (a*b*)*

r2 : (a*+b*)*

The regular expression for L(r1) ∩ L(r2) is:

Φ
{ϵ}
(a*b+b*a)*
None of the above
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar.

S→aS

S→Sab

S→b

Select the correct option.

The grammar is LL(1).
The grammar is LR(0).
The grammar is CLR(1).
The grammar is ambiguous.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar.

S → XY

X → YS| a

Y → SX | b

The resulting grammar after removing left recursion is

S → XY

X → YS| a

Y → bZ

Z → ϵ | SYXZ

S → XY

X → YS| a

Y → aYXZ

Z → ϵ | SYXZ

S → XY

X → YS| a

Y → aYXZ | bZ

Z → ϵ | SYXZ

None of these
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammars G1 and G2

G1: A → bA | ϵ

G2: A → Ab | ϵ

Select the correct option.

Both are LR(0) grammars.
G1 is LR(0) while G2 is not LR(0)
G2 is LR(0) while G1 is not LR(0)
None of the G1 and G2 are LR(0)
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar where {A,B} are non-terminals and {x,y} are terminal symbols.

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.

Both S1 and S2 are true.
S1 is true and S2 is false.
S1 is false and S2 is true.
Both S1 and S2 are false.

Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following Grammar G, whose productions are:

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.

Both S1 and S2 are true.
S1 is true and S2 is false.
S1 is false and S2 is true.
Both S1 and S2 are false.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammars, where {x,y,z} are terminal symbols.

G1:

S → PxPzy

P → yzP | y

G2:

S → PxyzP

P → yQ

Q → zyQ | ϵ

Select the correct option.

Both are LL(1) grammar.
G2 is LL(1) but G(1) is not LL(1)
Both G1 and G2 are ambiguous
G1 has left factoring and G2 is ambiguous
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar G

S → Ax | yAz | tz | ypx

A → t

Select the correct option.

Grammar G is ambiguous
Grammar G is SLR(1) but not LR(0)
Grammar G is LALR(1) but not SLR(1)
Grammar G is LR(1) but not LALR(1)
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammars G1 and G2. Non-terminal is {A} and terminals are {r,t}.

G1: A → AAr | t

G2: A → Atr | tAr | ttr | t

Select the option which is not correct.

G1 is not an operator grammar but G2 is an operator grammar.
G1 is ambiguous and G2 is unambiguous grammar.
G1 is unambiguous and G2 is ambiguous grammar.
G1 and G2 are equivalent grammars.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following statements

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.

Both S1 and S2 are true.
Both S1 and S2 are false.
S1 is true and S2 is false.
S1 is false and S2 is true.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following production rules. Each of the non-terminals has two attributes: “k” is a synthesized attribute and “i” is an inherited attribute.

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?

Only Rule 2 is L-attributed
Both Rule 1 and Rule 2 are L-attributed
Neither Rule 1 nor Rule 2 are L-attributed
Only Rule 1 is L-attributed
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following grammar along with SDT rules.

For input string (44+45)*41, the output produced by Syntax directed translator is __________

2021
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the following quadruples

Select the correct arithmetic expression with reference to the given quadruple

–(y+x)+z*(y+x)
–(x+y)+z*(x+y)
–y+x+z*y+x
–x+y+z*x+y
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following three address code:

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:

a[i] = f(n,a[j])
n = f(a[i],a[j])
a[j] = f(n, a[i])
a = f(n[i],n[j])
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following expression (a−b) * (a−b+c). The DAG representation of the above expression contains ___________number of internal nodes.
3
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Consider the following expression R such that

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.

# can be any operator from set {+, −, *}.
# can be any operator from set {+, −}.
# can be any operator from set {−, *}.
# can only be operator {+}.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66