TOC GATE Questions

If you are preparing for the Graduate Aptitude Test in Engineering (GATE), practicing Theory of Computation (TOC) GATE questions is essential for scoring well in the Computer Science and Information Technology (CSE) paper. The subject Theory of Computation is a core topic in GATE and usually contributes multiple conceptual and problem-solving questions every year.

In this section, we will explore important TOC GATE questions with explanations, which can help students improve their problem-solving skills and perform better in the GATE examination.

TOC GATE Question 01

How many substrings “aab” are in wwR w, where w = aabbab?

Solution:

Given w = aabbab

First compute wᴿ (reverse of w):

  • w = aabbab

  • wᴿ = babbaa

Now construct the string wwᴿw: wwᴿw = (aabbab)(babbaa)(aabbab) = aabbabbabbaaaabbab

Result: Total occurrences of “aab” = 2

Look at the following diagram to understand TOC GATE question 01 more clearly

TOC GATE Question - 1

TOC GATE Question 02

Show that | un | = n | u | for all strings “u” and all “n”, where n ≥ 0

Solution

  • Let u be any string in Formal Language Theory and |u| denote its length.
  • The notation uⁿ means the string u concatenated with itself n times.
  • Since each copy of u has length |u|, the total length is the sum of |u| added n times.
  • Therefore, |uⁿ| = n|u| for all n ≥ 0

Look at the following diagram to understand TOC GATE Question 02 more clearly

TOC GATE Question - 02

Common mistake !!

It is a common mistake that some people assume |uⁿ| = |u|ⁿ, but this is not correct in TOC. So, |uⁿ| |u|ⁿ

TOC GATE Question 03

Prove that ( uv )R = vR uR for all u, v ∈ Σ+

Solution

Let u,v ∈ Σ+ be two strings over alphabet Σ. We prove that the reverse of the concatenation of two strings is equal to the concatenation of their reverses in opposite order.

General Proof: Look at the following diagram to understand TOC GATE Question 03 more clearly with general proof

TOC GATE Question - 03 - General Proof

Example Proof: Look at the following diagram to understand TOC GATE Question 03 more clearly with Example

TOC GATE Question - 03

 

Common mistake !!

It is a common mistake that some people assume (uv)R = uR vR, but this is not correct in TOC. So, (uv)R| ≠ uR vR

TOC GATE Question 04

Prove that ( wR )R= w for all w ∈ Σ*

Solution

Let w ∈ Σ* be any string over alphabet Σ. We prove that reversing a string twice gives the original string.

General Proof: Look at the following diagram to understand TOC GATE Question 04 more clearly with general proof

TOC GATE Question - 04 - General Proof

Example Proof: Look at the following diagram to understand TOC GATE Question 04 more clearly with Example

TOC GATE Question - 04

TOC GATE Question 05

Let L = {ab, aa, baa}. Which of the following strings are in L*: abaabaaabaa, aaaabaaaa, baaaaabaaaab, baaaaabaa? Which strings are in L4?

Solution

Look at the following diagram to understand TOC GATE Question 05 more clearly 

TOC GATE Question - 05

  • All given strings are in L*
  • Strings in L4: aaaabaaaa and baaaaabaa.
  • Strings in L5: abaabaaabaa and baaaaabaaaab.

TOC GATE Question 06

If Σ = {a, b} and L = {aa, bb}. Use set notation to describe Lc.

Solution

Look at the following diagram to understand TOC GATE Question 06 more clearly 

TOC GATE Question - 06

The above diagram also shows that Lc will contain all strings over Σ except and “.

  • Example strings: Lc = {ε,a,b,ab,ba,aaa,aab,aba,… } 

"Your Support, Our Priority"

"We Make It Easy"