Time Left - 10:00 mins
GATE 2020 : Compiler Quiz 2
Attempt now to get your rank among 260 students!
Question 1
Consider the following two statements:
P: Every regular grammar is LL(1)
Q: Every regular set has a LR(1) grammar
Which of the following is TRUE?
P: Every regular grammar is LL(1)
Q: Every regular set has a LR(1) grammar
Which of the following is TRUE?
Question 2
Consider the following sets os items for some CFG produced while constructing LR (1) parser.
Set 1 (State):
A →a.{b}
B→ba.{b,c}
Set 2 (State):
A→B.a {$}
B →aB.{b}
Each item has look-a-head part which is computed using CLR (1) parser.
Assume the grammar has follow sets for non-terminals as: Follow (A)={A,b} and follow (B) = {b,c}.
Which of the following can be concluded from above two states of CLR (1). [Assume all other states are not in conflict].
Set 1 (State):
A →a.{b}
B→ba.{b,c}
Set 2 (State):
A→B.a {$}
B →aB.{b}
Each item has look-a-head part which is computed using CLR (1) parser.
Assume the grammar has follow sets for non-terminals as: Follow (A)={A,b} and follow (B) = {b,c}.
Which of the following can be concluded from above two states of CLR (1). [Assume all other states are not in conflict].
Question 3
Consider the following CFG ‘G’:
S → ABC
A → Aa/aB
B → Bb/ε
C → Cc/ε
Which of the following is correct?
S → ABC
A → Aa/aB
B → Bb/ε
C → Cc/ε
Which of the following is correct?
Question 4
Find the C statement which has a syntax error.
Question 5
Which of the following could result shift-reduced conflict in LR (0) parser?
Question 6
The grammar which is equivalent to -
E -> E+/ES+/+
S-> */S*
After eliminating the left recursion is-
E -> E+/ES+/+
S-> */S*
After eliminating the left recursion is-
- 260 attempts
- 0 upvotes
- 2 comments
Tags :
GATE & PSU CSGeneralApr 9GATE & PSU CS