Syntax Analysis questions

Q5

GATE CS 2021 CS-1ParsingMCQ1 mark−1/3 if wrong
Consider the following statements.
S1S_1: Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1).
S2S_2: For any context-free grammar, there is a parser that takes at most O(n3)O(n^3) time to parse a string of length nn.
Which one of the following options is correct?
Show answer without attempting

Answer: C

Q31

GATE CS 2021 CS-1ParsingMCQ2 marks−2/3 if wrong
Consider the following context-free grammar where the set of terminals is {a,b,c,d,f}\{a, b, c, d, f\}.
S→daT∣RfS \to daT \mid Rf
T→aS∣baT∣ϵT \to aS \mid baT \mid \epsilon
R→caTR∣ϵR \to caTR \mid \epsilon
The following is a partially-filled LL(1) parsing table.
aabbccddff$\$
S(1)S→daTS \to daT(2)
TT→aST \to aST→baTT \to baT(3)T→ϵT \to \epsilon(4)
RR→caTRR \to caTRR→ϵR \to \epsilon
Which one of the following choices represents the correct combination for the numbered cells in the parsing table ("blank" denotes that the corresponding cell is empty)?
Show answer without attempting

Answer: A

Q51

GATE CS 2021 CS-2ParsingNAT2 marks
Consider the following augmented grammar with {#,@,<,>,a,b,c}\{\#, @, <, >, a, b, c\} as the set of terminals.

<br>S′→S<br>S→S#cS<br>S→SS<br>S→S@<br>S→<S><br>S→a<br>S→b<br>S→c<br>\begin{aligned}<br>S' & \to S \\<br>S & \to S \# c S \\<br>S & \to S S \\<br>S & \to S @ \\<br>S & \to < S > \\<br>S & \to a \\<br>S & \to b \\<br>S & \to c<br>\end{aligned}

Let I0=CLOSURE({S′→∙S})I_0 = \text{CLOSURE}(\{S' \to \bullet S\}). The number of items in the set GOTO(GOTO(I0,<),<)\text{GOTO}(\text{GOTO}(I_0, <), <) is ____________.
Show answer without attempting

Answer: 8

0/30 correct0 marks