Test 1 - Theory of Computation | Computer Science(CS)

GATE Previous year Topic Wise Questions and Answers | Theory of Computation

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

The regular expression 0*(10*)* denotes the same set as

  1. (1*0)1
  2. 0+(0+10)*
  3. (0+1)10(0+1)
  4. None of these
Question 2 Multiple Choice (Single Answer)

If the strings of a language L can be effectively enumerated in lexicographic (i.e., alphabetic) order, which of the following statements is true?

  1. L is necessarily finite
  2. L is regular but not necessarily finite
  3. L is context free but not necessarily regular
  4. L is recursive but not necessarily context free
Question 3 Multiple Choice (Single Answer)

Nobody knows yet if P = NP. Consider the language L defined as follows.

$$L = \begin{cases} (0 +1)^* \text { if } (P = NP) \in E \\ \phi \text{ otherwise} \end{cases}$$

Which of the following statements is true?

  1. L is recursive
  2. L is recursively enumerable but not recursive
  3. L is not recursively enumerable
  4. Whether L is recursive or not will be known after we find out if P = NP
Question 4 Multiple Choice (Single Answer)

Consider the following deterministic finite state automaton M.

GATE 2003
Let S denote the set of seven bit binary strings in which the first, the fourth, and the last bits are 1. The number of strings in S that are accepted by M is

  1. 1
  2. 5
  3. 7
  4. 8
Question 5 Multiple Choice (Single Answer)

Ram and Shyam have been asked to show that a certain problem $\prod$is NP-complete. Ram shows a polynomial time reduction from the 3-SAT problem to$\prod$, and Shyam shows a polynomial time reduction from $\prod$to 3-SAT. Which of the following can be inferred from these reductions?

  1. $\prod$ is NP-hard but not NP-complete
  2. $\prod$ is in NP, but is not NP-complete
  3. $\prod$is NP-complete
  4. $\prod$is neither NP-hard, nor in NP
Question 6 Multiple Choice (Single Answer)

Let S be an NP-complete problem and Q and R be two other problems not known to be in NP. Q is polynomial time reducible to S and S is polynomial-time reducible to R. Which one of the following statements is true?

  1. R is NP-complete
  2. R is NP-hard
  3. Q is NP-complete
  4. Q is NP-hard
Question 7 Multiple Choice (Single Answer)

A single tape Turing Machine M has two states q0 and q1, of which q0 is the starting state. The tape alphabet of M is {0, 1, B} and its input alphabet is {0,1}. The symbol B is the blank symbol used to indicate end of an input string. The transition function of M is described in the following table.

0 1 B
q0 q1, 1, R q1, 1, R Halt
q1 q1, 1, R q0, 1, L q0, B, L
The table is interpreted as illustrated below.
The entry (q1, 1, R) in row q0 and column 1 signifies that if M is in state q0 and reads 1 on the current tape
square, then it writes 1 on the same tape square, moves its tape head one position to the right and
transitions to state q1.

Which of the following statements is true about M?

  1. M does not halt on any string in (0+1)+
  2. M does not halt on any string in (00+1)*
  3. M halts on all strings ending in a 0
  4. M halts on all strings ending in a 1
Question 8 Multiple Choice (Single Answer)

Let G = ({S},{a,b},R,S) be a context free grammar where the rule set R is S $\rightarrow$ a S b | S S | $\epsilon$
Which of the following statements is true?

  1. G is not ambiguous
  2. There exist x, y $\epsilon$ L(G) such that xy $\require{cancel} \cancel{\epsilon}$ L(G)
  3. There is a deterministic pushdown automaton that accepts L(G)
  4. We can find a deterministic finite state automaton that accepts L(G)
Question 9 Multiple Choice (Single Answer)

Consider the NFA M shown below.

Let the language accepted by M be L. Let L1 be the language accepted by the NFA M1 obtained by changing the accepting state of M to a non-accepting state and by changing the non-accepting states of M to accepting states. Which of the following statements is true?

  1. L1 = {0,1}* - L
  2. L1 = {0,1}*
  3. L1$\subseteq $ L
  4. L1 = L
Question 10 Multiple Choice (Single Answer)

Consider two languages $L_1$ and $L_2$, each over the alphabet $\Sigma$.

Let $f: \Sigma \to \Sigma$ be a polynomial time, computable bijection, such that:

$$\forall x: \Bigl(x \in L_1 \iff f(x) \in L_2\Bigr )$$

Further, let $f^{-1}$ also be polynomial time computable.

Which of the following canNOT be true?

  1. L1 $\epsilon$ P and L2 is finite
  2. L1 $\epsilon$ NP and L2 $\epsilon$ P
  3. L1 is un decidable and L2 is decidable
  4. L1 is recursively enumerable and L2 is recursive
Question 11 Multiple Choice (Single Answer)

Let SHAM, be the problem of finding a Hamiltonian cycle in a graph G = (V, E) with V divisible by 3 and DHAM' be the problem of determining if a Hamiltonian cycle exists in such graphs. Which one of the following is true?

  1. Both DHAM, and SHAM, are NP-hard
  2. SHAM, is NP-hard, but DHAM, is not
  3. DHAM, is NP-hard, but SHAM, is not
  4. Neither DHAM, nor SHAM, is NP-hard
Question 12 Multiple Choice (Single Answer)

Which of the following problems is undecidable?

  1. Membership problem for CFGs.
  2. Ambiguity problem for CFGs.
  3. Finiteness problem for FSAs.
  4. Equivalence problem for FSAs.
Question 13 Multiple Choice (Single Answer)

Define languages L0 and L1 as follows:
L0 = {<M, w, 0> | M halts on w}
L1 = {<M, w, 1> | M does not halt on w}
Here <M, w, i> is a triplet, whose first component, M, is an encoding of a Turing
Machine, second component, w, is a string, and third component, i, is a bit.
Let L = L0$\cup$L1. Which of the following is true?

  1. L is recursively enumerable, but $\bar L$ is not
  2. $\bar L$ is recursively enumerable, but L is not
  3. Both L and $\bar L$ are recursive
  4. Neither L nor $\bar L$ is recursively enumerable
Question 14 Multiple Choice (Single Answer)

Let L1 = {0n+m1n0m|n, m$\ge$0}. L2 = {0n+m1n+m0m|n, m$\ge$0} and L3 = {0n+m1n+m0n+m|n, m$\ge$0} Which of these languages are NOT context free?

  1. L1 only
  2. L2 only
  3. L1 and L2
  4. L2 and L3
Question 15 Multiple Choice (Single Answer)

Which of the following is TRUE?

  1. Every subset of a regular set is regular.
  2. Every finite subset of a non-regular set is regular.
  3. The union of two non-regular sets is not regular.
  4. Infinite union of finite sets is regular.
Question 16 Multiple Choice (Single Answer)

For S $\in$ (0 + 1) * let d (s) denote the decimal value of s (e.g. d (101) = 5).
Let L = {s $\in$ (0 + 1)* d (s)mod 5 = 2 and d (s) mod 7 $\ne$ 4}
Which one of the following statements is true?

  1. L is recursively enumerable, but not recursive
  2. L is recursive, but not context-free
  3. L is context-free, but not regular
  4. L is regular
Question 17 Multiple Choice (Single Answer)

Consider the regular language L = (111 + 11111) *. The minimum number of states in any DFA accepting these languages is:

  1. 3
  2. 5
  3. 8
  4. 9
Question 18 Multiple Choice (Single Answer)

If s is a string over (0 + 1)* then let n0 (s) denote the number of 0's in s and n1 (s) the number of 1's in s. Which one of the following languages is not regular?

  1. L = {s $\in$(0 + 1)*| n0 (s) is a 3-digit prime}
  2. L = {s $\in$(0 + 1)*| for every prefix s' of s1 |n0 (s') - n1 (s')| $\le$2 |
  3. L = {s $\in$(0 + 1)*| n0 (s') - n1 (s')| $\le$4 |
  4. L = {s $\in$(0 + 1)*| n0 (s) mod 7 = n1 (s) mod 5 = 0}
Question 19 Multiple Choice (Single Answer)

Let L1 be a regular language, L2 be a deterministic context-free language and L3 a recursively enumerable, but not recursive, language. Which one of the following statements is false?

  1. L1 $\cap$ L is a deterministic CFL
  2. L3 $\cap$ L1 is recursive
  3. L1 U L2 is context free
  4. L1 $\cap$ L2 $\cap$ L3 is recursively enumerable
Question 20 Multiple Choice (Single Answer)

Consider the following statements about the context free grammar
G = {S $\rightarrow$ SS, S $\rightarrow$ ab, S $\rightarrow$ ba, S $\rightarrow$$\in$}
I. G is ambiguous
II. G produces all strings with equal number of a's and b's
III. G can be accepted by a deterministic PDA.
Which combination below expresses all the true statements about G?

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