Skip to content
GATEiit

GATE CSE 2017 Session 2 Q50: Classifying four languages: regular, CFL, DCFL, recursive

Syllabus topics: Regular and context-free languages; pumping lemma; Turing machines and undecidability

Question

Consider the following languages.

L1={ap∣p is a prime number}

L2={anbmc2m∣n≥0,m≥0}

L3={anbnc2n∣n≥0}

L4={anbn∣n≥1}

Which of the following are CORRECT?

I. L1 is context-free but not regular.

II. L2 is not context-free.

III. L3 is not context-free but recursive.

IV. L4 is deterministic context-free.

Try it: multiple choice: exactly one correct option

Select one option
Wrong answer costs 2/3 mark in GATE.
Show answer and explanation

Answer: D (official GATE 2017 final answer key)

Concept used: A unary language is context-free only if it is regular (prime lengths are neither); one counter comparison is context-free (even deterministic), while two linked comparisons are not.

Concept notes

Loading notes…

First step: Decide for each language how many independent count comparisons it needs, and recall that unary context-free languages are regular.

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Regular and context-free languages; pumping lemma

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2017 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key