TOC Gate Questions

Here, We will see (Theory of Computation) TOC GATE Questions from previous year’s papers and the syllabus of Theory of Computation for the GATE Exam.

1. Theory of Computation in Gate CSE Exam

The Theory of Computation (TOC) is a foundational subject in computer science, forming a critical part of the GATE CSE syllabus. It explores the mathematical underpinnings of computation, focusing on what problems can be solved algorithmically and the inherent limitations of computational models. For GATE aspirants, mastering TOC is essential due to its recurring weightage (6–9% in recent years) and its role in testing analytical and problem-solving skills.

2. Theory of Computation Syllabus

The syllabus for Theory of Computation in GATE CSE includes:

  1. Regular Languages and Finite Automata: Topics include regular expressions, deterministic/non-deterministic finite automata (DFA/NFA), and equivalence between them.
  2. Context-Free Languages and Pushdown Automata: Context-free grammars (CFGs), parsing, and the relationship between CFGs and pushdown automata (PDA).
  3. Turing Machines and Computability: Understanding Turing machines as universal computational models and exploring decidability, reducibility, and the Halting Problem.
  4. Undecidability and Complexity: The Pumping Lemma for proving language non-regularity/non-context-freeness and an introduction to complexity classes like P, NP, and NP-completeness.

Q. The CFG S → aS |bS |a |b is equivalent to

  1. (a+b)
  2. (a+b)(a+b)*
  3. (a+b)(a+b)
  4. all of these
Answer

(a+b)(a+b)*
NIELIT 2016 MAR Scientist B

Q. Let G be a grammar in CFG and let W1,W2 Є L(G) |W1|=|W2| such that then which of the following statements is true?

  1. Any derivation of W1 has exactly the same number of steps as any derivation of W2.
  2. Different derivation have different length.
  3. Some derivation of W1 may be shorter than the derivation of W2.
  4. None of the options
Answer

Some derivation of W1 may be shorter than the derivation of W2.
NIELIT 2017 DEC Scientist B

Q. If L1 is CFL and L2 is regular language which of the following is false?

  1. L1-L2 is not Context free
  2. L1 intersection L2 is Context free
  3. ~L1 is Context free
  4. Both 1 and 3
Answer

Both 1 and 3
NIELIT 2016 DEC Scientist B (CS)

Q. _________ is the class of decision problems that can be solved by non-deterministic polynomial algorithms.

  1. NP
  2. P
  3. Hard
  4. Complete
Answer

NP
NIELIT 2021 Dec Scientist B

Q. If L1 and L2 are context free language and R a regular set, then which one of the languages below is not necessarily a context free language?

  1. L1L2
  2. L1∩L2
  3. L1∩R
  4. L1∪L2
Answer

L1∩L2
NIELIT 2016 MAR Scientist B

Q. Which of the following definitions generates the same languages as L, where
L={xnyn,n≥1}
i. E → xEy | xy
ii. xy | x+ xyy+
iii. x+ y+

  1. i only
  2. i and ii only
  3. ii and iii only
  4. ii only
Answer

i only
NIELIT 2017 OCT Scientific Assistant A (CS)

Q. Let n is the length of string to test for membership, then the number of table entry in CYK algorithm is

  1. n(n+1)
  2. n2+1
  3. n2-1
  4. n(n+1)/2
Answer

n(n+1)/2
NIELIT 2017 DEC Scientist B

Q. The following grammer is an example of ________ .
A→aABC
CB→Bc
A→abc
bB→bb
B→cba

  1. Type 0 Grammer
  2. Type 1 Grammer
  3. Type 2 Grammer
  4. Type 3 Grammer
Answer

Type 2 Grammer
NIELIT 2021 Dec Scientist B

Q. Consider the finite automata given below
The language b accepted by this automata is a given by the regular expression :

  1. b*ab*ab*ab
  2. (a+b)*
  3. b*a(a+b)*
  4. b*ab*ab*
Answer

b*ab*ab*
NIELIT 2021 Dec Scientist A

Q. Given a graph with n vertices, deciding if there exists a clique of size≥195 is :

  1. Solvable in polynomial time
  2. NP
  3. NP-Complete
  4. None of the above
Answer

NP-Complete
NIELIT 2021 Dec Scientist A

Q. A language L is recognizable by a turing machine M if and only if L is a ________ language.

  1. Type 0
  2. Type 1
  3. Type 2
  4. Type 3
Answer

Type 0
NIELIT 2021 Dec Scientist B

Q. Bounded minimalization is a technique for

  1. proving whether a promotive recursive function is turning computable or not
  2. proving whether a primitive recursive function is a total function or not
  3. generating primitive recursive functions
  4. generating partial recursive functions
Answer

generating primitive recursive functions
NIELIT 2016 MAR Scientist B

Q. Which of the following are undecidable?
P1 : The language generated by some CFG contains any words of length less than some given number n.
P2 : Let L1 be CFL and L2 be regular, to determine whether L1 and L2 have common elements
P3 : Any given CFG is ambiguous or not.
P4 : For any given CFG G, to determine whether epsilon belongs to L(G)

  1. P2 only
  2. P1 and P2 only
  3. P2 and P3 only
  4. P3 only
Answer

P3 only
NIELIT 2017 DEC Scientist B

Q. Consider the grammar with non terminals N={S,C,S1} terminals T = {a,b,i,t,e} with S as the start symbol, and the following set of rules :
S → iCtSS1|a
S1 → eS|Є
C → b
The grammar is not LL(1) because:

  1. It is left recursive
  2. It is right recursive
  3. It is ambiguous
  4. It is not context free
Answer

It is ambiguous
NIELIT 2021 Dec Scientist A

Q. If T1 and T2 are two Turing machines. The composite can be represented using the expression :

  1. T1T2
  2. T1ՍT2
  3. T1×T2
  4. None of the options
Answer

T1T2
NIELIT 2021 Dec Scientist A

Q. Which of the following statements is true ?

  1. Melay and Moore machines are language acceptors.
  2. Finite State automata is language translator.
  3. NPDA is more powerful than DPDA.
  4. Melay machine is more powerful than Moore machine.
Answer

NPDA is more powerful than DPDA.
NIELIT 2017 DEC Scientific Assistant A

Q. Palindromes can’t be recognized by any Finite State Automata because:

  1. FSA cannot remember arbitrarily large amount of information.
  2. FSA cannot deterministically fix the midpoint.
  3. Even if the mid-Point is known an FSA cannot find whether the second half of the string matches the first half.
  4. All of the above.
Answer

All of the above.
NIELIT 2016 DEC Scientist B (CS)

Q. Given two DFA’s M1 and M2. They are equivalent if

  1. M1 and M2 has the same number of states
  2. M1 and M2accepts the same language i.e L(M1)=L(M2)
  3. M1 and M2 has the same number of final states
  4. None of the above
Answer

M1 and M2accepts the same language i.e L(M1)=L(M2)
NIELIT 2016 DEC Scientist B (CS)

Q. (00+01+10)(0+1)* represents

  1. Strings not starting with 11
  2. Strings of odd length
  3. Strings starting with 00
  4. Strings of even length
Answer

Strings not starting with 11
NIELIT 2016 DEC Scientist B (CS)

Q. Let L = L1∩L2, where L1 and L2 are language defined below :
L1 = {ambmanbn m,n>0}
L2 = {aibjck i,j,k>0}
Then L is

  1. Not Recursive
  2. Regular
  3. Context free but not regular
  4. Recursively enumerable but not context free
Answer

Context free but not regular
NIELIT 2021 Dec Scientist A

Q. Two finite state machines are said to be equivalent if they

  1. have same number of states
  2. have same number of edges
  3. have same number of states and edges
  4. recognize same set of tokens
Answer

have same number of edges
NIELIT 2016 MAR Scientist C

Q. The automatIon which allows transformation to a new state without consuming any input symbols

  1. NFA
  2. DFA
  3. NFA-1
  4. All of the options
Answer

NFA-1
NIELIT 2017 DEC Scientific Assistant A

Q. _______ is the most general phase structured grammar.

  1. Regular
  2. Context free
  3. Context sensitive
  4. All of the above
Answer

Context sensitive
NIELIT 2021 Dec Scientist A

Q. Complement of a DFA can be obtained by :

  1. making starting state as final state.
  2. make final as a starting state.
  3. making final states non-final and non-final as final.
  4. None of the option
Answer

making final states non-final and non-final as final.
NIELIT 2017 DEC Scientific Assistant A

Q. What is the relation between DFA and NFA on the basis of computational power ?

  1. DFA>NFA
  2. NFA>DFA
  3. Equal
  4. Can’t be said
Answer

Equal
NIELIT 2017 DEC Scientific Assistant A

Q. Concatenation Operation refers to which of the following set operations :

  1. Union
  2. Dot
  3. Kleene
  4. None of the options
Answer

Dot
NIELIT 2017 DEC Scientific Assistant A

Q. Finite automata requires minimum ________ number of stacks.

  1. 1
  2. 0
  3. 2
  4. None of the options
Answer

0
NIELIT 2017 DEC Scientific Assistant A

Q. Assume that P and NP are different i.e. P!=NP then for the expression NP-Complete∩P=?. Which among the following is correct ?

  1. NP-Hard
  2. 🚫
  3. P
  4. NP-Complete
Answer

🚫
NIELIT 2021 Dec Scientist A

Q. What is the complement of the language accepted by the NFA shown below?
1.O
2. {Є}
3. a*
4. {a,Є}

  1. 1
  2. 2
  3. 3
  4. 4
Answer

2
NIELIT 2017 July Scientist B (CS)

Q. Consider the following Finite State Automaton. The language accepted by the automaton is given by the regular expression.

  1. ab*b*
  2. a*b*
  3. b*b
  4. b*ab*
Answer

b*ab*
NIELIT 2018

Q. Regarding power of recognition of language, which of the following statements is false?

  1. Non deterministic finite-state automata are equivalent to deterministic finite-state automata.
  2. Non-deterministic push-down automata are equivalent to deterministic push-down automata.
  3. Non-deterministic Turing Machines are equivalent to deterministic push-down automata.
  4. Multi-tape Turing Machines are equivalent to Single-tape Turing Machines.
Answer

Non-deterministic push-down automata are equivalent to deterministic push-down automata.
NIELIT 2016 MAR Scientist B

Q. Consider the following problem X. Given a Turing machine M over the input alphabet ∑, any state q of M and a word ꙍ Є ∑*, does the computation of M on ꙍ visit the state of q?
Which of the following statements about X is correct?

  1. X is decidable
  2. X is undecidable but partially decidable
  3. X is undecidable and not even partially decidable
  4. X is not a decision problem
Answer

X is undecidable but partially decidable
NIELIT 2022 April Scientist B

  1. decidable
  2. undecidable
  3. interpretive
  4. non-deterministic
Answer

decidable
NIELIT 2016 MAR Scientist C

Q. The defining language for developing a formalism in which language definitions can be stated, is called

  1. syntactic meta language
  2. decidable language
  3. intermediate language
  4. high level language
Answer

syntactic meta language
NIELIT 2016 MAR Scientist C

Q. A finite automaton accepts which type of language :

  1. Type 0
  2. Type 1
  3. Type 2
  4. Type 3
Answer

Type 3
NIELIT 2017 DEC Scientific Assistant A

Q. Which of the following statement is true?

  1. Deterministic context free language are closed under complement.
  2. Deterministic context free language are not closed under Union.
  3. Deterministic context free language are closed under intersection with the regular set.
  4. All of the options
Answer

All of the options
NIELIT 2017 DEC Scientist B

Q. Which of the following is a correct hierarchical relationships of the following where
L1 : set of languages accepted by NFA
L2 : set of languages accepted by DFA
L3 : set of languages accepted by DPDA
L4 : set of languages accepted by NPDA
L5 : set of recursive language
L6 : set of recursive enumerable languages?

  1. L1,L2⊂L3⊂L4⊂L5⊂L6
  2. L1⊂L2⊂L3⊂L4⊂L5⊂L6
  3. L2⊂L1⊂L3⊂L4⊂L5⊂L6
  4. L1⊂L2⊂L3⊂L4⊂L6⊂L5
Answer

L1,L2⊂L3⊂L4⊂L5⊂L6
NIELIT 2017 DEC Scientist B

Q. How many DFA’s exits with two states over input alphabet {0,1}

  1. 16
  2. 26
  3. 32
  4. 64
Answer

64
NIELIT 2017 DEC Scientific Assistant A

Q. Which of the following statements about the parser is/are correct?
I. Canonical LR is more powerful than SLR.
II. SLR is more powerful than LALR.
III. SLR is more powerful than canonical LR.

  1. I only
  2. II only
  3. III only
  4. II and III only
Answer

I only
NIELIT 2022 April Scientist B

Q. If there is in NP-Complete language L whose complement is in NP, then complement of any language in NP is in

  1. P
  2. NP
  3. both (1) and (2)
  4. None of these
Answer

NP
NIELIT 2016 MAR Scientist B

Q. Which of the following problem is not NP complete but undecidable?

  1. Partition Problem
  2. Halting Problem
  3. Hamiltonian Circuit
  4. Bin Packing
Answer

Halting Problem
NIELIT Scientific Assistant A 2020 November

Q. The logic of pumping lemma is a good example of

  1. the pigeon-hole principle
  2. the divide and conquer technique
  3. recursion
  4. iteration
Answer

the pigeon-hole principle
NIELIT 2017 OCT Scientific Assistant A (CS)

Q. Cardinality of relationship advisor to each entity sets instructor and student will be:

  1. One to many
  2. One to one
  3. Many to many
  4. Many to one
Answer

One to one
NIELIT 2021 Dec Scientist B

Q. Which machine is equally powerful in both deterministic and non-deterministic form?

  1. Push Down Automata
  2. Turing machine
  3. Linear Bounded Automata
  4. None of the options
Answer

Turing machine
NIELIT 2017 DEC Scientist B

Q. Choose the correct statements.

  1. A total recursive function is also a partial recursive function
  2. A partial recursive function is also a total recursive function
  3. A partial recursive function is also a primitive recursive function
  4. None of the above
Answer

A total recursive function is also a partial recursive function
NIELIT 2017 OCT Scientific Assistant A (CS)

Q. Recursive enumerable languages are not closed under ___________ .

  1. Set difference
  2. Complement
  3. Both (A) and (B)
  4. None of the options
Answer

Both (A) and (B)
NIELIT 2017 DEC Scientist B

Q. If any string of a language L can be effectively enumerated by an enumerator in a lexicographic order then language L is _________ .

  1. Regular
  2. Context free but not necessarily regular
  3. Recursive but not necessarily context free
  4. Recursively enumerable but not necessarily recursive
Answer

Recursive but not necessarily context free
NIELIT 2017 DEC Scientist B

Q. The collection of Turing recognizable languages are closed under:
i. Union
ii. Intersection
iii. Complement
iv. Concatenation
v. Star Closure

  1. (i) Only
  2. Both (i),(iv)
  3. (i),(ii),(iv)and(v)
  4. All of the options
Answer

(i),(ii),(iv)and(v)
NIELIT 2017 DEC Scientist B

Q. Which of the following machine model can be used in a necessary and sufficient sense for lexical analysis in modern computer language?

  1. Deterministic Push down Automata
  2. Finite Automata
  3. Non-Deterministic Finite Automata
  4. Turing Machine
Answer

Finite Automata
NIELIT Scientist B 2020 November

Q. Let L be a language and L’ be its complement. Which one of the following is NOT a viable possibility?

  1. Neither L nor L’ is RE.
  2. One of the L and L’ is RE but not recursive;the other is not RE.
  3. Both L and L’ are RE but not recursive.
  4. Both L and L’ are recursive.
Answer

Both L and L’ are RE but not recursive.
NIELIT 2017 July Scientist B (CS)

Q. Let L1 be a recursive language, and let L2 be a recursively enumerable but not recursive language. Which one of the following is TRUE?

  1. L1‘ is recursive and L2‘ is recursively enumerable.
  2. L1‘ is recursive and L2‘ is not recursively enumerable.
  3. L1‘ and L2‘ is recursively enumerable.
  4. L1‘ is recursively enumerable and L2‘ is recursive.
Answer

L1‘ is recursive and L2‘ is not recursively enumerable.
NIELIT 2017 July Scientist B (CS)

Q. A language L for which there exists a TM ‘T’, that accepts every word in L and either rejects or loops for every word that is not in L, is said to be

  1. Recursive
  2. Recursively enumerable
  3. NP-HARD
  4. None of the above
Answer

Recursively enumerable
NIELIT 2017 OCT Scientific Assistant A (CS)

Q. Identify the true statement from the given statements:
1. A recursive formal language is a recursive subset in the set of all possible words over the alphabet of the language.
2. The complement of a recursive languages is recursive
3. The complement of a context-free language is context-free

  1. Only 1
  2. 1 and 2
  3. 1, 2 and 3
  4. 2 and 3
Answer

1 and 2
NIELIT 2018

Q. Consider the following types of languages:
L1 : Regular,
L2 : Context-free,
L3 : Recursive,
L4 : Recursively enumerable.
Which of the following is/are TRUE?
I. L3’ՍL4is recursively enumerable
II. L2ՍL3 is recursive
III. L1*ՍL2is context-free
IV. L1ՍL2’is context-free

  1. I only
  2. I and III only
  3. I and IV only
  4. I,II and III only
Answer

I,II and III only
NIELIT 2022 April Scientist B

Q. Which of the following regular expressions denotes a language comprising all possible strings over the alphabet {a,b}?

  1. a*b*
  2. (a|b)*
  3. (ab)+
  4. (a|b*)
Answer

(a|b)*
NIELIT 2016 MAR Scientist B

Q. Regular expression (a|b)(a|b) denotes the set

  1. {a,b,ab,aa}
  2. {a,b,ba,bb}
  3. {a,b}
  4. {aa,ab,ba,bb}
Answer

{aa,ab,ba,bb}
NIELIT 2016 MAR Scientist C

Q. Let P,Q,R be a regular expression over ∑. If does not contain null string, then R=Q+RP has a unique solution __________ .

  1. Q*P
  2. QP*
  3. Q*P*
  4. (P*Q*)*
Answer

QP*
NIELIT 2017 DEC Scientific Assistant A

Q. (0+ε)(1+ε) represents :

  1. {0,1,01,ε}
  2. {0,1,ε}
  3. {0,1,01,11,00,10,ε}
  4. {0,1}
Answer

{0,1,01,ε}
NIELIT 2017 DEC Scientific Assistant A

Q. Complement of (a+b)* will be :

  1. Phi(Φ)
  2. Null
  3. a
  4. b
Answer

Phi(Φ)
NIELIT 2017 DEC Scientific Assistant A

Q. A regular expression is (a+b*c) is equivalent to

  1. set of strings with either a or one or more occurrence of b followed by c.
  2. (b*c+a)
  3. set of strings with either a or zero or more occurrence of b followed by c.
  4. Both (B) and (C)
Answer

Both (B) and (C)
NIELIT 2017 DEC Scientist B

Q. According to the given language, which among the following expressions does it correspond to ?
Language L = {xЄ{0,1} | x is of length 4 or less}

  1. (0+1+0+1+0+1+0+1)4
  2. (0+1)4
  3. (01)4
  4. (0+1+ε)4
Answer

(0+1+ε)4
NIELIT 2017 DEC Scientist B

Q. What is the meaning of regular expression ∑*001∑*?

  1. Any string containing ‘1’ as substring
  2. Any string containing ‘01’ as substring
  3. Any string containing ‘011’ as substring
  4. All string containing ‘001’ as substring
Answer

All string containing ‘001’ as substring
NIELIT 2017 DEC Scientist B

Q. Which of the following regular expression is equal to (r1+r2)*?

  1. r1*r2*
  2. (r1r2)*
  3. r1*r2*+r1r2
  4. (r1*r2*)*
Answer

(r1*r2*)*
NIELIT 2017 DEC Scientist B

Q. Which of the following is equivalent regular expressions?
i. ((01)*(10)*)*
ii. (10+01)*
iii. (01)*+(11)*
iv. (0*+(11)*+0*)*)

  1. (i) and (ii)
  2. (ii) and (iii)
  3. (iii) and (iv)
  4. (iv) and (i)
Answer

(i) and (ii)
NIELIT 2017 DEC Scientist B

Q. The string 1101 does not belong to the set represented by

  1. (00+(11)*0)
  2. 1(0+1)*101
  3. (10)*(01)*(00+11)*
  4. 110*(0+1)
Answer

(10)*(01)*(00+11)*
NIELIT 2017 DEC Scientist B

Q. Which of the following languages over the alphabet [01] is described by the given regular expression: (0+1)*(0+1)*1?

  1. The set of all strings containing the substring 11
  2. The set of all strings containing at most two 1’s
  3. The set of all strings containing at least two 1’s
  4. The set of all strings that begins and ends with only 0
Answer

The set of all strings containing at least two 1’s
NIELIT 2018

Q. If L be a language recognizable by a finite automaton, then language from {L}={ω such that ω is a prefix of υ where υЄL}, is

  1. regular language.
  2. context-free language.
  3. context-sensitive language.
  4. recursive enumeration language
Answer

regular language.
NIELIT 2016 MAR Scientist B

Q. Which of the following statements is correct?

  1. A={anbn | n=0,1,2,3….} is regular language
  2. Set B of all strings of equal number of a’s and b’s defines a regular language
  3. L(A*B*)∩B gives the set A
  4. None of these.
Answer

L(A*B*)∩B gives the set A
NIELIT 2016 MAR Scientist B

Q. If L1 and L2 are regular sets then intersection of these two will be :

  1. Regular
  2. Non Regular
  3. Recursive
  4. Non Recursive
Answer

Regular
NIELIT 2017 DEC Scientific Assistant A

Q. In the Given language L={ab,aa,baaa}, __ number of strings are in L*
1. baaaba
2. aabaaaa
3. baaabaaaabaa
4. baaabaaa

  1. 1
  2. 2
  3. 3
  4. 4
Answer

2
NIELIT 2018

Q. Which of the following is wrong?

  1. Turing machine is a simple mathematical model of general purpose computer
  2. Turing machine is more powerful than finite automata
  3. Turing Machine can be simulated by a general purpose computer
  4. All of these
Answer

All of these
NIELIT 2016 DEC Scientist B (CS)

Q. Which of the following statement is true?
S1 : The power of a multi-tape Turing machine is greater than the power of a single tape Turing machine.
S2 : Every non-deterministic Turing machine has an equivalent deterministic Turing machine.

  1. S1
  2. S2
  3. Both S1 and S2
  4. None of the options
Answer

S2
NIELIT 2017 DEC Scientist B

Scroll to Top