Theory of Computation Gate
Theory of Computation Gate
(B) It produces more than one parse tree for some sentence.
(C) Some production has two non-terminals side by side on the right-hand side.
Q1 (xiii) FORTRAN is a:
PART B
Q10(c) Give the minimal DFA that performs as a mod-3 1's counter, i.e. outputs a 1 each time the number of 1's in the input sequence is a multiple of 3.
Q10 (d) Give regular expression over the alphabet {0,1} to denote the set of proper non-null substrings of the string 0110.
---------------------------------------------------------------------------------------------
THEORY OF COMPUTATION
The set of all strings over an alphabet S ={0,1} with the concatenation operator for strings
Q2. Consider the set of all strings S * over an alphabet S ={a,b} with the concatenation operator for strings, and
a) the set does forms semigroup
Q3. Consider the set of all strings S * over the alphabet S ={a,b,c,d,e} with the concatenation operator for strings.
a. the set has a right identity and forms a semigroup
c. the set does not form a commutative group but has an identity
Q4. Nobody knows yet if P = NP. Consider the language L defined as follows:
L=()+1)* if P = NP
And
L=j otherwise
a) L is recursive
And
L={ww|w in (a+b)+} otherwise
c) L is context sensitive
And
L=(0*1)*0* if P=NP
And
d) What L is will be known after the two open problems P = NP and the closure of CSLs under complement are resolved
And
b. L is recursive
L=(0+1)* if G is ambiguous
And
a. L is a context-free language
d. What L is is undecidable
L=(0*1)*0* if M halts on w
And
b. L is a context-sensitive language
c. L is recursively enumerable and not context-free
L=(0+1)* if P=NP
And
L=(a^nb^n|n>=1} otherwise
a. Whether L is a regular set that is not context-free will be known after we resolve the P=NP question.
b. Whether L is context-free but not regular will be known after we resolve the P=NP question
c. L is context-sensitive
d. L is not recursive
Q11. It is undecidable if two cfls L1 and L2 are equivalent. Consider two cfls L1 and L2 and a language defined as follows
L={a^nb^nc^n|n>=234} if L1=L2
And
L={a^nb^nc^nd^n|n>=678} otherwise
a. L is recursive
b. L is context-free
d. L is regular
And
L = {a^nb^nc^nd^ne^n|n>=34567} otherwise
a) L is recursive
d) We will be able to say something about L only after we resolve the NP complementation issue
L=(0+1)* if satisfiability is in P
L=(1*0)1* if 3-sat is in P
d) x can never be in L
Q15. An arbitrary turing machine M will be given to you and we define a language L as follows
---------
---------
a) We cannot say anything about L as the question of whether a turing machine accepts a string is undecidable
Q16. We are given two context-free languages L1 and L2 and L defined as below
a) L=(0+1)* if L1=L2
b) L=((0+00+000)*(1+11+111)*)* if L1 is contained in L2
c) L=((0(10)*)*(1(01)*)* if L2 is contained in L1
a) As all the conditions relating to L1 and L2 are undecidable we cannot say anything about L
b) L is recursively enumerable
Q17. It is undecidable if an arbitrary cfl is inherently ambiguous. We are given a cfg G and the language L is defined as below
a) L is regular
b) L iscontext-free
c) L is context-sensitive
d) The above choices can be resolved only if we know if L(G) is inherently ambiguous or not
Q18. We are given an arbitrary turing machine M and define the language L as below
b) x is not in L
c) we can never decide if x is in L as all the problems of the turing machine are undecidable
c) L if a finite set
Q20. The intersection of two cfls can simulate a turing machine computation. We are given two cfls L1 and L2 and define the language L as below
b) L=((0(00)*)(0(00)*))* if L1 is regular
a) L is a finite set
b) L is a regular set
c) L is undecidable
[GATE 2003]
a. the set of all strings with an even number of 0s and an even number 0’s and an even number of 1’s
c. the set of all strings with the 0’s and 1’s alternating
Q26. If the strings of a language L can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the following statements is true?
a) L is necessarily finite
[GATE 2003]
Q27. If the strings of a language L that is accepted by a turing machine can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the following statements is true?
a) L is necessarily finite
Q28. If the strings of a language L that are accepted by a multidimensional turing machine M can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the
following statements is true?
a) L is necessarily finite
Q29. If the strings of a language L that are accepted by a 3 pebble machine M can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the following statements is
true?
a) L is necessarily finite
Q30. If the strings of a language L that are accepted by a multitrack turing machine M can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the following
statements is true?
a) L is necessarily finite
Q31. If the strings of a language L that are accepted by a nondeterminisitic, 56 pushdown tape machine M, can be effectively enumerated in lexicographic (i.e. alphabetic) order, which
of the following statements is true?
a) L is necessarily finite
b) L is regular but not necessarily finite
Q32. If the strings of a language L that are accepted by a nondeterministic 987 counter machine M, can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the
following statements is true?
a) L is necessarily finite
Q33. If the strings of a language L that are accepted by a turing machine with 2-way infinite tape, can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the
following statements is true?
a) L is necessarily finite
Q34. If the strings of a language L that are accepted by a 4567 headed nondeterministic turing machine,can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of
the following statements is true?
a) L is necessarily finite
Q35. If the strings of a language L accepted by a turing machine, which has 1000 two way infinite tapes, 1000 symbols in the tape alphabet, 2000 input symbols, l345 dimensional tapes,
34567 heads, optional 345 pushdown tapes, can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the following statements is true?
a) L is necessarily finite
Q36. If the strings of a language L that are accepted by a machine which can keep 400 pebbles anywhere on its infinite input tape, but has no tape symbols, can be effectively
enumerated in lexicographic (i.e. alphabetic) order, which of the following statements is true?
a) L is necessarily finite
Q37. If the strings of a language L that are accepted by a turing machine, with a whose tape alphabet is a singleton set, can be effectively enumerated in lexicographic (i.e. alphabetic)
order, which of the following statements is true?
a) L is necessarily finite
Q38. If the strings of a language L={<M>|encoding of turing machine M}, can be effectively enumerated in lexicographic (i.e. alphabetic) order, which of the following statements is
true?
a) L is necessarily finite
a) L is necessarily finite
Q40. If the strings of a language L={<M>| M is an encoding of turing machines, pushdown automata, linear bounded automata, finite automata}, can be effectively enumerated in
lexicographic (i.e. alphabetic) order, which of the following statements is true?
a) L is necessarily finite
THEORY OF COMPUTATION
Q41. If the strings of a language L ={<M>| M is an encoding of turing machines that have more than 34567890 states}, can be effectively enumerated in lexicographic (i.e. alphabetic)
order, which of the following statements is true?
a) L is necessarily finite
Sà aSb|SS|e
a) G is not ambiguous
Sà aSa|bSb|c.
a) G is ambiguous
Sà aSb|SSSSSSSSSSS|e
a) G is not ambiguous
Sà aSb|aaSbb|SS|e
Which of the following statements is true?
a) G is not ambiguous
Sà aaSbb|SS|e
a) G is not ambiguous
Sà aaaSbbb|SS|e
a) G is not ambiguous
Sà abSba|SS|e
a) G is not ambiguous
Sà aaabaaaSbbbabbb|SS|e
a) G is not ambiguous
a) L is inherently ambiguous
b) L is deterministic context-free
c) L is regular
a) L is inherently ambiguous
b) L is deterministic context-free
c) L is regular
d) There exists a deterministic two way finite automata accepting L
a) L is inherently ambiguous
b) L is deterministic context-free
c) L is regular
Q53. Choose the correct statement for the language L={"("^n " )" ^n|n>=0}
a) L is inherently ambiguous
b) L is deterministic context-free
c) L is regular
a) L is inherently ambiguous
b) L is deterministic context-free
c) L is regular
Sà aSb|SS|e
a) G is not ambiguous
c) L(G) is the set of all strings of balanced parenthesis with a as the opening parenthesis and b as the closing parenthesis.
Q56. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
a) L1 e P and L2 finite
Q57. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
a) L1 e P and L2 finite
Q58. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
a) L1 e P and L2 regular
Q59. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
Q60. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
d) L1 is recursively enumerable and L2 is accepted by a turing machine that halts on all inputs
Q61. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
Q62. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
Q63. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
Q64. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
a) L1 e P and L2 finite
Q65. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
Which of the following CANNOT be true?
Q66. Consider two languages L1 and L2 each on the alphabet S . Let f: S ->S be a polynomial time computable bijection such that (Ñ x)[xe L2]. Further, let f^-1 be also polynomial time
computable.
a) L1 is finite but not necessarily regular and L2 is context-free but not necessarily context-sensitive
L0={<M,w,0>|M halts 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.
L0={<M,0>|M halts}
Here <M,I> is a pair whose first component, M is an encoding of a turing machine starting with blank tape, second component is a bit.
L0={<M,w,0>|M halts on w}
Here <M,w,I> is a triplet, whose first component, M is an encoding of a 1200 push down tape machine , second component w, is a string representing the input, and third component I is
a bit.
Here <M,I> is a pair, whose first component, M is an encoding of a turing machine , second component I is a bit.
L0={<M,w,0>|M halts on w}
Here <M,w,I> is a triplet, whose first component, M is an encoding of a three counter machine machine , second component w is a triplet giving the initial position of the pebbles, is a
string and third component I is a bit.
L0={<P,w,0>|P halts on w}
Here <P,w,I> is a triplet, whose first component, P is an encoding of a C++ program, second component w, is a string and third component I is a bit.
L0={<Q,w,0>|Q halts on w}
Here <Q,w,I> is a triplet, whose first component, Q is an encoding of a java program, second component w, is a string and third component I is a bit.
L0={<M,w,0>|M halts on w}
Here <M,w,I> is a triplet, whose first component, M is an encoding of a multidimentsional, multiheaded, multitape turing machine , second component w, is a string and third
component I is a bit.
L0={<M,w,0>|M halts on w}
Here <M,w,I> is a triplet, whose first component, M is an encoding of a nondeterministic 789 pushdown tape machine , second component w, is a string and third component I is a bit.
L0={<M,w,0>|M accepts 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.
Here <P,w,I> is a triplet, whose first component, P is an encoding of a C program, second component w, is a string and third component I is a bit.
Here <M,w,I> is a triplet, whose first component, M is an encoding of a turing machine , second component M1 is the encoding of a turing machine, and third component I is a bit.
Let L=L0 U L1. Which of the following is true?
Here <M,w,I> is a triplet, whose first component, M is an encoding of a turing machine , second component M1 is the encoding of a turing machine, and third component I is a bit.
Q81. Let L be a language accepted by some nondeterministic multitape turing machine and L1 its complement also accepted by a two pushdown tape machine then choose the correct
statement
Q82. Let L be a language accepted by some nondeterministic multitape turing machine and L1 its complement also accepted by a nondeterministic two pushdown tape machine then
choose the correct statement
a) there exists a universal turing machine which can simulate any turing machine M on its input w
b) there does not exist a universal turing machine which can simulate any turing machine on its input w
c) the set Ld={<Mi,wi>| the encoding Mi of the ith turing machine does not accept the input wi, in an enumeration of turing machines and input strings} is recursively enumerable
Q84. The printing problem of turing machines is whether a turing machine ever prints a 1 on its tape. Ram takes the set L={<M,w>| encoding of turing machine M that does not accept
w} which is known to be undecidable. He modifies M such that in an accepting state no moves are made. Shyam further modifes M to M1 so that in an accepting state it prints a 1 and
then halts. Choose the correct statement.
a) We can conclude that M1 prints a 1 and halts only if M accepts w, and thus the printing problem reduces to the problem of L being recursive
c) We can conclude that the printing problem is recursive but not necessarily recursively enumerable
Q85. The state problem of turing machines is whether a turing machine ever enters a state q. Ram takes the set L={<M,w>| encoding of turing machine M that does not accept w} which
is known to be undecidable. He modifies M such that in an accepting state no moves are made. Shyam further modifes M to M1 so that in an accepting state it moves to state q and then
halts. Choose the correct statement.
a) We can conclude that M1 halts only if M accepts w, and thus the state problem reduces to the problem of L being recursive
c) We can conclude that the printing problem is recursive but not necessarily recursively enumerable
Q86. The printing problem of turing machines is whether a turing machine ever prints a 111 on its tape. Ram takes the set L={<M,w>| encoding of turing machine M that does not
accept w} which is known to be undecidable. He modifies M such that in an accepting state no moves are made. Shyam further modifes M to M1 so that in an accepting state it prints a
111 and then halts. Choose the correct statement.
a) We can conclude that M1 prints a 111 and halts only if M accepts w, and thus the printing problem reduces to the problem of L being recursive
Q87. The blank tape halting of turing machines is whether a turing machine started on blank tape halts. Ram takes the set L={<M,w>| encoding of turing machine M that does not accept
w} which is known to be undecidable. He modifies M such that in an accepting state no moves are made. Shyam further modifes M to M1 so that it starts with a blank tape and first
prints w on the tape and behaves just like M. Choose the correct statement.
a) We can conclude that M1 halts only if M accepts w, and thus the printing problem reduces to the problem of L being recursive
c) We can conclude that the printing problem is recursive but not necessarily recursively enumerable
Q88. The aim of the following questionis to prove that the language {M| M is the code of a turing machine which, irrespective of the input, halts and outputs a 1, is undecidable. This is
to be done by reducing from the language {M’,x|M’ halts on x}, which is known to be undecidable.
Ram proceeds as follows. He takes the turing machine M and modifies it so that it makes no moves in its final state and then it prints a 1 in the final state and halts. Shyam further
modifies this M so that it initially takes an arbitrary turing machine M’ and its input x, and if M’ accepts and halts on x then M will start its operation otherwise not. This he achieves by
having M enumerate turing machines and strings till the encoding for M’ and x are obtained.
a) the modified M will accept all strings and print a 1 provided M halts on w, but we have a decision problem for M’ then we can resolve whether M halts on w
d) The above argument shows that M’ is recursive but not necessarily context sensitive
Q89. The emptiness problem for r.e. sets is whether for any r.e. set L we can decide if L=j . As L is a subset of {a} we conclude that
c) L is recursive always
d) L is recursively enumerable
Q90. The completeness problem for r.e. sets is whether for any r.e. set L we can decide if L=S *.
a) as no finite subset of L can be the same as L we conclude that the set L is not r.e.
b) L is r.e. as L is regular
c) L is recursively enumerable as we only require a turing machine that halts on all inputs
Q91. The regularity problem for r.e. sets is whether for any r.e. set L, is L regular?
b) as the regular sets are contained in the context-free languages if the regularity problem is decidable then by the containment property every cfl must be regular
c) every r.e. set is trivially seen to be regular as every turing machine has a finite control
d) as every regular set is contained in the set of all strings, the latter must be in L by the containment property and that is known to be undecidable.
Q92. The context-freeness problem for r.e. sets is whether for any r.e. set L, is L context-free?
b) as the regular sets are contained in the context-free languages if the regularity problem is decidable then by the containment property every cfl must be regular
c) every r.e. set is trivially seen to be context-free as every turing machine has a finite control
d) as every context-free language is contained in the set of all strings, the latter must be in L by the containment property and that is known to be undecidable.
Q93. The recusiveness problem for r.e. sets is whether for any r.e. set L, is L recursiver?
b) as the regular sets are contained in the recursisve if the regularity problem is decidable then by the containment property every recursive set must be r.e.
c) every recursive set is trivially seen to be regular as every turing machine has a finite control
d) as every recursive set is contained in the set of all strings, the latter must be in L by the containment property and that is known to be undecidable.
Q94. Let L0={<M,0>|M is the encoding of a turing machine that accepts the empty set}
And L1={<M,1>|M is the encoding of a turing machine that does not accept the empty set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q95. Let L0={<M,0>|M is the encoding of a turing machine that accepts an infinite ty set}
And L1={<M,1>|M is the encoding of a turing machine that does not accept an infinite set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q96. Let L0={<M,0>|M is the encoding of a turing machine that accepts a singleton set}
And L1={<M,1>|M is the encoding of a turing machine that does not accept a singleton set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q97. Let L0={<M,M’,0>|M,M’ are the encodings of turing machines that accept the empty set}
And L1={<M,M’,1>|M,M’ are the encodings of a turing machines that either one or both do not accept the empty set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct
statement
Q98. Let L0={<M,0>|M is the encoding of a turing machine that accepts a cfl}
And L1={<M,1>|M is the encoding of a turing machine that does not accept a cfl}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q99. Let L0={<G,G’,0>|G,G’ are the encodings of cfgs that generate the same set}
And L1={<G,G’,1>|G,G’ are the encodings of cfgs that either one or both do not generate the same set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q100. Let L0={<G,G’,0>|G,G’ are the encodings of regular grammars that generate the same set}
And L1={<G,G’,1>|G,G’ are the encodings of regular grammars that either one or both do not generate the same set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct
statement
Q101. Let L0={<G,G’,0>|G,G’ are the encodings of cfgs that generate infinte languages}
And L1={<G,G’,1>|G,G’ are the encodings of cfgs that either one or both do not generate infinite sets}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q102. Let L0={<G,G’,0>|G,G’ are the encodings of csgs that generate the same set}
And L1={<G,G’,1>|G,G’ are the encodings of csgs that either one or both do generate the same set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q103. Let L0={<G,G’,0>|G,G’ are the encodings of unrestricted grammars that generate the same set}
And L1={<G,G’,1>|G,G’ are the encodings of unrestricted grammars that either one or both do generate the same set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct
statement
Q104. Let L0={<G,G’,0>|G,G’ are the encodings of linear bounded automata that generate the same set}
And L1={<G,G’,1>|G,G’ are the encodings of linear bounded automata that either one or both do generate the same set}.Let L=L0UL1. Let L’ be the complement of L. Choose the
correct statement
Q105. Let L0={<G,G’,0>|G,G’ are the encodings of unrestricted grammars such that they generate L and LR respectively with L=LR}
And L1={<G,G’,1>|G,G’ are the encodings of unrestricted grammars that generate languages L and LR with L not the same as LR respectively}.Let L=L0UL1. Let L’ be the
complement of L. Choose the correct statement
Q106. Let L0={<G,G’,0>|G,G’ are the encodings of C programs that produce the same output for all inputs}
And L1={<G,G’,1>|G,G’ are the encodings of C programs that do not produce the same output for all inputs}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct
statement
Q107. Let L0={<G,G’,0>|G,G’ are the encodings of C programs that produce some output for all inputs}
And L1={<G,G’,1>|G,G’ are the encodings of C programs that do not produce some output for all inputs}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q108. Let L0={<G,G’,0>|G,G’ are the encodings of C programs that loop on some input}
And L1={<G,G’,1>|G,G’ are the encodings of C programs that do not loop on some input}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q109. Let L0={<G,G’,0>|G,G’ are the encodings of cfgs where the intersection of the langugaes generated is a cfl}
And L1={<G,G’,1>|G,G’ are the encodings of cfgs where the intersection of the languages generated is not a cfl}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct
statement
Q110. Let L0={<G,G’,0>|G,G’ are the encodings of cfgs that generate regular sets}
And L1={<G,G’,1>|G,G’ are the encodings of cfs that both or either does not generate a regular set}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q111. Let L0={<G,G’,0>|G,G’ are the encodings of cfgs such that L(G’) is contained in L(G)}
And L1={<G,G’,1>|G,G’ are the encodings of cfgs sucht that L(G’) is not contained in L(G)}. Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Q112. Let L0={<G,G’,0>|G,G’ are the encodings of cfgs which generate languages whose complement is also a cfl}
And L1={<G,G’,1>|G,G’ are the encodings of C programs that generate languages whose complement is not both a cfl}.Let L=L0UL1. Let L’ be the complement of L. Choose the
correct statement
And L1={<G,G’,1>|G,G’ are the encodings of unambiguous cfgs}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
And L1={<G,G’,1>|G,G’ are the encodings of cfls that are not inherently ambiguous}.Let L=L0UL1. Let L’ be the complement of L. Choose the correct statement
Here <M,w,I> is a triplet, whose first component, M is an encoding of a turing machine , second component M1 is the encoding of a nondeterministic linear bounded automaton, and
third component I is a bit.
Here <M,w,I> is a triplet, whose first component, M is an encoding of a turing machine , second component M1 is the encoding of a 100 tape nondeterministic turing machine that halts
on all inputs, and third component I is a bit.
Here <M,w,I> is a triplet, whose first component, M is an encoding of a nondeterministic 789 pushdown tape machine , second component w, is a state and third component I is a bit.
Here <M,w,I> is a triplet, whose first component, M is an encoding of a nondeterministic 789 pushdown tape machine , second component w, is a symbol and third component I is a bit.
-----------------------------------------------------------------------------