GATE CS 2022 | Question 47

Theory of Computation › Context Free Grammar · MSQ · 2 marks · Answer: A, B, C

  1. Question 47Theory of Computationmsq2 marks
    and . Which is TRUE?
    • A.
      L1 and L2 are regular.
      ✓
    • B.
      L1 and L2 are context-free.
      ✓
    • C.
      L1 is regular and L2 is context-free.
      ✓
    • D.
      L1 and L2 are context-free but not regular.

    Answer: A, B, C

    Solution

    Answer: (A), (B) and (C) Both languages are in fact REGULAR. - : taking already gives all strings that start and end with 'a' (with a non-empty middle), so collapses to a regular language. - : taking , for a single char - i.e. every string of length whose first and last characters are equal - which is regular. Since both are regular (hence also context-free): (A) both regular, (B) both context-free, and (C) L1 regular and L2 context-free are all TRUE; (D) is false because L1 is regular.

More GATE PYQ on Context Free Grammar

All GATE CS Theory of Computation PYQ →

Attempt GATE CS 2022 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →