Question 1 |
Consider the following context-free grammar where the set of terminals is \{a,b,c,d,f\}.
\begin{array}{lll} S & \rightarrow & d \: a \: T \mid R \: f \\ T & \rightarrow & a \: S \: \mid \: b \: a \: T \: \mid \epsilon \\ R & \rightarrow & c \: a \: T \: R \: \mid \epsilon \end{array}
The following is a partially-filled LL(1) parsing table.

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)?

\begin{array}{lll} S & \rightarrow & d \: a \: T \mid R \: f \\ T & \rightarrow & a \: S \: \mid \: b \: a \: T \: \mid \epsilon \\ R & \rightarrow & c \: a \: T \: R \: \mid \epsilon \end{array}
The following is a partially-filled LL(1) parsing table.

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)?

A | |
B | |
C | |
D |
Question 1 Explanation:
Question 2 |
The language which is generated by the grammar S \rightarrow a S a\mid b S b\mid a\mid b over the alphabet of {a,b} is the set of
Strings that begin and end with the same symbol | |
All odd and even length palindromes | |
All odd length palindromes | |
All even length palindromes |
Question 2 Explanation:
Question 3 |
Context free languages are closed under
union, intersection | |
union, kleene closure | |
intersection, complement | |
complement, kleene closure |
Question 3 Explanation:
Question 4 |
A CFG (Context Free Grammar) is said to be in Chomsky Normal Form (CNF), if all the productions are of the form \mathrm{A} \rightarrow \mathrm{BC} or \mathrm{A} \rightarrow \mathrm{a}. Let G be a CFG in CNF. To derive a string of terminals of length x, the number of products to be used is:
2x-1 | |
2x | |
2x+1 | |
2^{x} |
Question 4 Explanation:
Question 5 |
CFG (Context Free Grammar) is not closed under:
Union | |
Complementation | |
Kleene star | |
Product |
Question 5 Explanation:
Question 6 |
Consider the following expression grammar G:
E\rightarrowE-T|T
T\rightarrowT+F|F
F\rightarrow(E)|id
Which of the following grammars is not left recursive, but is equivalent to G?
E\rightarrowE-T|T
T\rightarrowT+F|F
F\rightarrow(E)|id
Which of the following grammars is not left recursive, but is equivalent to G?
E\rightarrowE-T|T T\rightarrowT+F|F F\rightarrow(E)|id | |
E\rightarrowTE' E'\rightarrowTE'|\in T\rightarrowT+F|F F\rightarrow(E)|id | |
E\rightarrowTX X\rightarrow-TX|\in T\rightarrowFY Y\rightarrow+FY|\in F\rightarrow(E)|id | |
E\rightarrowTX|(TX) X\rightarrow -TX|+TX|\in T \rightarrowid |
Question 6 Explanation:
Question 7 |
Identify the language generated by the following grammar, where S is start variable.
S\rightarrow XY
X\rightarrow aX|a
Y \rightarrowaYb|\in
S\rightarrow XY
X\rightarrow aX|a
Y \rightarrowaYb|\in
\{a^{m}b^{n}|m\geq n,n \gt 0\} | |
\{a^{m}b^{n}|m\geq n,n \geq 0\} | |
\{a^{m}b^{n}|m\gt n,n\geq 0\} | |
\{a^{m}b^{n}|m\gt n,n \gt 0\} |
Question 7 Explanation:
Question 8 |
Which of the following statements about parser is/are CORRECT?
I. Canonical LR is more powerful than SLR.
II. SLR is more powerful than LALR
III. SLR is more powerful than Canonical LR.
I. Canonical LR is more powerful than SLR.
II. SLR is more powerful than LALR
III. SLR is more powerful than Canonical LR.
I only | |
II only | |
III only | |
II and III only |
Question 8 Explanation:
Question 9 |
If G is grammar with productions
S\rightarrow SaS|aSb|bSa|SS|\epsilon
where S is the start variable, then which one of the following is not generated by G?
S\rightarrow SaS|aSb|bSa|SS|\epsilon
where S is the start variable, then which one of the following is not generated by G?
abab | |
aaab | |
abbaa | |
babba |
Question 9 Explanation:
Question 10 |
Consider the following grammar.
P\rightarrowxQRS
Q\rightarrowyz|z
R\rightarroww|\varepsilon
S\rightarrowy
What is FOLLOW (Q) ?
P\rightarrowxQRS
Q\rightarrowyz|z
R\rightarroww|\varepsilon
S\rightarrowy
What is FOLLOW (Q) ?
{R} | |
{w} | |
{w, y} | |
{w, $} |
Question 10 Explanation:
There are 10 questions to complete.
Please add a function to Sort the PYQs like (a) Older to Latest and (b) Latest to Older
Dear Tirth,
It’s already sorted from latest to Older order for Subject and Topicwise practice. From the analysis it is observed that practice of latest questions are very important.
Question no 25th answer is wrong ,
it should be option A.
Thank you shivam,
We have updated the answer.
qes no 9 is wrong
production is S→SaS∣aSb∣bSa∣SS∣ϵ
Thank You devendra,
We have updated the question.
Q1 belongs to compiler design section…
Que 14 option c and d are same
they are different. check and and or in it.