GATE Computer Science · Databases, Theory of Computation, and Compiler Design · hard
Which two statements regarding formal language classes and bottom-up LR parsers are always true? (Select two.)
Published · Last updated · checked before publication — how we verify questions
Options
Answers: B. Regular languages are closed under union, intersection, and complement; C. LALR(1) has the same state count as SLR(1) and sits between SLR(1) and CLR(1)
Regular languages are closed under complement, intersection, union, concatenation, and Kleene star ( whereas Context-Free Languages are NOT closed under intersection or complement). In parser power, LR(A) ⊂ SLR(B) ⊂ LALR(B) ⊂ CLR(B), and LALR(B) has the same number of states as LR(A)/SLR(B) by merging CLR(B) states with identical LR(A) cores.
Why the other options are wrong
- A. Context-free languages are closed under intersection and set complement — Context-free languages are closed under union, concatenation, and Kleene star, but NOT intersection or complement.
- D. LL(1) grammars strictly contain ambiguous context-free grammars — No ambiguous grammar can be LL(B) or LR(k).
More Databases, Theory of Computation, and Compiler Design questions
- Consider a relation schema R(A, B, C, D, E) with the functional dependency set F = {AB -> C, C -> D, D -> B, D -> E}…
- Consider two concurrent transactions T1 and T2 in schedule S: R1(X), W2(X), W1(Y), R2(Y). Which two statements about…
- Consider a relation R(A, B, C) with functional dependencies F = {AB -> C, C -> B}. What is the highest normal form…
All Databases, Theory of Computation, and Compiler Design questions and the topic overview →
GATE is a mark of the Indian Institute of Science and the Indian Institutes of Technology. PrepIQ Hub is not affiliated with, endorsed by, or sponsored by the GATE Committee.