All mock tests are FREE till 31 December — register to save your progress
Unit 8 · Theory of Computation and Compilers Paper 2 CS · December 2018

Consider the languages L₁ = {x | for some y with |y| = 2|x|, xy ∈ L} and L₂ = {x | for some y with |x| = |y|, xy ∈ L}, where L is a regular language. Which one is correct?

Pick an option to check yourself, or open the answer below.

Show answer & explanation

Correct answer: C. Both L₁ and L₂ are regular

Explanation

Regular languages are closed under 'first half' and 'first third' operations: run the DFA forward on x while guessing in parallel the states reachable by some suffix of length |x| (or 2|x|). Both are regular.

More Theory of Computation and Compilers questions