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

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 Correct Answer III and IV only

Consider the options one by one:

Option 1:

L1 = {ap | p is a prime number}

Prime numbers do not have fixed pattern. So, it is not possible to solve it using pushdown

automaton. So, L1 is not context free language.

Option 2:

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

It can be solved easily using single stack.  Comparison is done between b and c. We can make a pushdown automaton for this. So, L2 is context free language.

Option 3:

L3 = {anbnc2n | n ≥ 0}

First comparison is between a and b, then between b and c, therefore two stacks are required.

So, it is context sensitive language. L3 is recursive language.

Option 4:

L4 = { anbn | n ≥ 1}

First push a into a stack then pop a for each b from the stack. The given language is accepted by

Deterministic Pushdown Automaton. Therefore, L4  is deterministic context-free.

Related Questions

In the question below, are given a statement followed by three courses of actions numbered I, II and III. On the basis of the information given, you have to assume everything in the statement to be true, and then decide which of the suggested courses of action logically follow(s) for pursuing. Statement: With just two days to go for the second edition of Amazon Prime Day, the e-commerce giant has been keeping its loyalists busy with a seven-day entertainment marathon. Started on July 10 with the release of Amitabh Bachchan starrer '102 Not Out', Amazon has been dropping one title every day for its Prime members. With Video and Music, Amazon clearly wants to showcase that Prime day is not merely about products. Courses of action: I. Building on the success of its previous sales, Amazon is gearing up for a bigger event, with extra perks for its Prime members in the form of quality video and music content - and not just early access and quicker deliveries. II. Started on July 3, Prime members who play three songs from the millions on Amazon Prime Music stand a chance to win an Echo Dot every day, with two winners announced daily. III. With Raazi and Transformers: The Last Night slated for release in the next two days, members already have access to Dunkirk, Telugu hit Officer as well as Prime Original show, Comicstaan - a reality TV show to find India's next stand-up comedy star.