Skip to content
GATEiit

GATE CSE 2021 Set 2 Q51: Which reversal-based languages are context-free

Question

For a string ww, we define wRw^R to be the reverse of ww. For example, if w=01101w = 01101 then wR=10110w^R = 10110.

Which of the following languages is/are context-free?

Try it: multiple select: one or more correct options

Select one or more options
Select all correct options. No negative marking, no partial marks.
Show answer and explanation

Answer: B, C, D (official GATE 2021 final answer key)

Concept used: A single stack can match nested (properly bracketed) pairs but not crossing pairs.

First step: Draw arcs matching ww with wRw^R and xx with xRx^R: they nest or sit side by side in B, C, D, but cross in A.

Full step-by-step solution

Detailed working, common mistakes and linked mock tests will be available with a free GATEiit account. Log-in is coming soon.

Share this question

WhatsAppDownload image

Source: official GATE 2021 Set 2 CS question paper and final answer key, organised by IIT Bombay. Question paper · Answer key