CS Atlas GATE 2027
TOC course
0 / 91 complete

TOC/Phase 2 · Regular Expressions & Regular Languages

Checkpoint CP2 · Item 45 of 91

Regular expressions & regular languages

Read at your own pace. Try the questions before opening the answers.

On this page

Introduction

15 questions across Phase 2: regex reading and equivalence, conversions, grammars, closure, algorithms and classification.

Practice questions

  1. MCQ · 1 mark

    Which string is in L((0 + 10)*1*)?

    1. 0110
    2. 1101
    3. 0011
    4. 110
  2. MSQ · 2 marks

    Which are equivalent to (a + b)*a(a + b)*?

    1. b*a(a + b)*
    2. (a + b)*ab*
    3. (a + b)*a
    4. b*a b*
  3. NAT · 1 mark

    Number of strings of length 6 over {0,1} with no two consecutive 0s?

    Write your answer before opening the key.

  4. NAT · 1 mark

    Strict Thompson states for a + b + c (as (a + b) + c)?

    Write your answer before opening the key.

  5. MCQ · 2 marks

    Solve: A = ε + Aa + Bb, B = Aa (A start, B accepting). B = ?

    1. (a + ab)*a
    2. a(a + ba)*
    3. (a + ab)*
    4. Both A and B are correct
  6. MCQ · 1 mark

    S → aS | aB, B → bB | b generates:

    1. a*b*
    2. a⁺b⁺
    3. (ab)⁺
    4. a⁺b*
  7. MSQ · 2 marks

    Which grammars generate non-regular languages?

    1. S → aSb | ε
    2. S → aA, A → Sb | b
    3. S → aS | Sb | ε
    4. S → abS | ε
  8. MSQ · 2 marks

    L regular, N not regular. Which are always regular?

    1. L ∩ Σ*
    2. L / N
    3. L ∪ N
    4. Lᴿ
  9. MCQ · 1 mark

    For a DFA with n states, L is infinite iff it accepts some string of length:

    1. < n
    2. between n and 2n − 1
    3. exactly 2n
    4. > 2ⁿ
  10. MCQ · 2 marks

    To show { aⁿbⁿ } non-regular, a valid winning choice is:

    1. w = aᵖbᵖ, i = 2
    2. w = ab, i = 0
    3. w = aᵖbᵖ, i = 1
    4. w = (ab)ᵖ, i = 2
  11. MSQ · 2 marks

    Which are regular?

    1. { aⁱbʲcᵏ : i + j + k ≡ 0 mod 2 }
    2. { aⁿbⁿcⁿ }
    3. { w x w : w, x ∈ {a,b}⁺ }
    4. { a^{n²} }
  12. MCQ · 1 mark

    { w ∈ {0,1}* : value of w in binary is a power of 2 } is:

    1. regular: 0*10*
    2. not regular
    3. finite
    4. regular: 1*0*
  13. NAT · 2 marks

    Minimal DFA states for L((a + b)*b(a + b)) over {a,b}?

    Write your answer before opening the key.

  14. MCQ · 2 marks

    Regex for strings over {a,b} with an odd number of b’s:

    1. a*b(a*ba*b)*a*
    2. (a*ba*ba*)*b
    3. a*(ba*b)*a*
    4. (ab)*b
  15. MSQ · 1 mark

    Which operations can turn a regular language into a non-regular one?

    1. taking a subset
    2. infinite union of regular languages
    3. complement
    4. reversal

Answer key

Reveal answers when you’re ready
  1. C — Blocks 0, 0, then 11 from 1*.
    • A: After 0, “11” must come from 1*, and then the final 0 cannot follow.
    • B: A leading 1 must be the block 10, but the next symbol is 1.
    • D: 11 from 1* cannot be followed by 0.

    Review lesson 2.1.1

  2. AB — Both say “at least one a” (first a or last a).
    • C: Ends with a.
    • D: Exactly one a.

    Review lesson 2.1.2

  3. 21 — Fibonacci: 2,3,5,8,13,21 for n = 1..6.

    Review lesson 2.1.2

  4. 10 — a,b,c: 6; first union +2; second union +2 = 10.

    Review lesson 2.2.1

  5. D — A = ε + A(a + ab) ⇒ A = (a + ab)*; B = (a + ab)*a. By shifting, (a + ab)*a = a(a + ba)*.
    • A: Correct but not the only correct option.
    • B: Correct but not the only correct option.
    • C: That is A.

    Review lesson 2.2.2

  6. B — At least one a, then at least one b.
    • A: ε, a, b missing.
    • C: Not alternating.
    • D: Needs a b.

    Review lesson 2.3.2

  7. AB — Both generate aⁿbⁿ.
    • C: a*b*: regular.
    • D: (ab)*.

    Review lesson 2.3.2

  8. ABD — Quotient by anything; reversal; trivially L.
    • C: L = ∅ gives N.

    Review lesson 2.4.1

  9. B — Pumping window.
    • A: Those decide emptiness.
    • C: Not the standard bound.
    • D: Too large; not the criterion.

    Review lesson 2.4.2

  10. A — i = 1 changes nothing; ab may be shorter than p; (ab)ᵖ ∉ L.
    • B: |w| may be < p.
    • C: i = 1 gives w back.
    • D: Not in L.

    Review lesson 2.4.3

  11. AC — Parity; free middle.
    • B: Not even context-free (Phase 3).
    • D: Not eventually periodic.

    Review lesson 2.4.4

  12. A — Binary powers of 2 are a single 1 followed by 0s (with optional leading zeros).
    • B: In binary it is easy.
    • C: Infinite.
    • D: Allows 11.

    Review lesson 2.4.4

  13. 4 — Second-from-end is b: 2² = 4.

    Review lesson 1.3.2

  14. A — One b, then pairs of b’s, a’s anywhere.
    • B: Forces a final b.
    • C: Even number of b’s.
    • D: Too restrictive.

    Review lesson 2.1.2

  15. AB — Only non-closure operations.
    • C: Closed.
    • D: Closed.

    Review lesson 2.4.1

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.