Here, We will see Compiler Design GATE Questions from previous year’s papers and the syllabus of Compiler Design for GATE Exam.
Table of Contents
1. Compiler Design in Gate CSE Exam
Compiler Design is a pivotal topic in the GATE Computer Science and Information Technology (CS/IT) exam, focusing on the principles and techniques behind translating high-level programming languages into efficient machine code. This subject tests candidates’ understanding of compiler phases, optimization strategies, and runtime environments, with questions often blending theoretical concepts and practical applications.
2. Compiler Design Syllabus
The syllabus for Compiler Design in GATE CSE includes:
- Lexical Analysis: Tokenization, finite automata, and regular expressions.
- Parsing: Context-free grammars, LL(1), LR(1), and LALR parsers.
- Syntax-Directed Translation: Attribute grammars, intermediate representations (e.g., three-address code).
- Runtime Environments: Activation records, parameter passing, stack allocation.
- Intermediate Code Generation & Optimization: Control flow graphs, data-flow analysis (e.g., constant propagation, dead code elimination).
- Code Generation: Instruction selection, register allocation.
Compiler Design Gate Questions
1. Match the following NFAs with the regular expressions they correspond to
1. ∈ + 0(01*1 + 00)*01*
2. ∈ + 0(10*1 + 00)*0
3. ∈ + 0(10*1 + 10)*1
4. ∈ + 0(10*1 + 10)*10*
- P-2, Q-1, R-3, S- 4
- P-1, Q-3, R-2, S- 4
- P-1, Q-2, R-3, S- 4
- P-3, Q-2, R-1, S- 4
Answer
P-1, Q-2, R-3, S- 4
[2008]
2. Which of the following are regular sets?
I. {anb2m | n ≥ 0, m ≥ 0}
II. {anbm | n = 2m}
III. {anbm | n ≠ m}
IV. {xcy | x, y ∈ {a, b}*}
- I and IV only
- I and III only
- I only
- IV only
Answer
I and IV only
[2008]
3. Which one of the following languages over the alphabet {0, 1} is described by the regular expression:(0 + 1)*0(0 + 1)*0(0 + 1)*
- The set of all strings containing the substring 00.
- The set of all strings containing atmost two 0’s.
- The set of all strings containing at least two 0’s.
- The set of all strings that begin and end with either 0 or 1.
Answer
The set of all strings containing at least two 0’s.
[2009]
4. Which one of the following is FALSE?
- There is a unique minimal DFA for every regular language.
- Every NFA can be converted to an equivalent PDA.
- Complement of every context-free language isrecursive.
- Every non-deterministic PDA can be converted to an equivalent deterministic PDA.
Answer
Every non-deterministic PDA can be converted to an equivalent deterministic PDA.
[2009]
5. Match all items in Group 1 with correct options from those given in Group 2
Group 1 | Group 2 |
P. Regular expression | 1. Syntax analysis |
Q. Pushdown automata | 2. Code generation |
R. Dataflow analysis | 3. Lexical analysis |
S. Register allocation | 4. Code optimization |
- P–4, Q–1, R–2, S–3
- P–3, Q–1, R–4, S–2
- P–3, Q–4, R–1, S–2
- P–2, Q–1, R–4, S–3
Answer
P–3, Q–1, R–4, S–2
6. The above DFA accepts the set of all strings over {0, 1} that
- Begin either with 0 or 1
- End with 0
- End with 00
- Contain the substring 00.
Answer
End with 00
[2009]
7. Let L = {w ∈ (0 + 1)* | w has even number of 1’s}, i.e., L is the set of all bit strings with even number of 1’s. Which one of the regular expressions below represents L?
- (0*10*1)*
- 0*(10*10*)*
- 0*(10*1*)*0*
- 0*1(10*1)*10*
Answer
0*(10*10*)*
[2010]
8. Consider the languages L1 = {0i1j | i ≠ j}. L2 = {0i1j | i = j}, L3 = {0i1j |i = 2j + 1}. L4 = {0i1j | i ≠ 2j}. Which one of the following statements is true?
- Only L2 is context free
- Only L2 and L3 are context free
- Only L1 and L2 are context free
- All are context free
Answer
All are context free
[2010]
9. Let w be any string of length n in {0, 1}*. Let L be the set of all substrings of w. What is the minimum number of states in a non-deterministic finite automaton that accepts L?
- n-1
- n
- n+1
- 2n-1
Answer
n+1
[2010]
10. Let P be a regular language and Q be a context-free language such that Q ⊆ P (For example let P be the language represented by the regular expression p*q* and Q be {pnqn} n ∈ N}, Then which of the following is ALWAYS regular?
- P ∩ Q
- P – Q
- Σ* – P
- Σ* – Q
Answer
Σ* – P
[2011]
11. A deterministic finite automaton (DFA) D with alphabet Σ = {a, b} is given below.

Which of the following finite state machines is a valid minimal DFA which accepts the same language as D?
- A

- B

- C

- D

Answer
A
[2011]
12. Given the language L = {ab, aa, baa}, which of the following strings are in L*?
(i) abaabaaabaa
(ii) aaaabaaaa
(iii) baaaaabaaaab
(iv) baaaaabaa
- 1, 2 and 3
- 2, 3 and 4
- 1, 2 and 4
- 1, 3 and 4
Answer
1, 2 and 4
[2012]
13. What is the complement of the language accepted by the NFA shown below?
Assume Σ = {a} and ε is the empty string.
- ∅
- {ε}
- a*
- {a, ε}
Answer
{ε}
[2012]
14. Consider the set of strings on {0, 1} in which, every substring of 3 symbols has atmost two zeros. For example, 001110 and 011001 are in the language, but 100010 are not. All strings of length less than 3 are also in the language. A partially completed DFA that accepts this language is shown below.
The missing arcs in the DFA are
00 | 01 | 10 | 11 | q | |
00 | 1 | 0 | |||
01 | 1 | ||||
10 | 0 | ||||
11 | 0 |
00 | 01 | 10 | 11 | q | |
00 | 0 | 1 | |||
01 | 1 | ||||
10 | 0 | ||||
11 | 0 |
00 | 01 | 10 | 11 | q | |
00 | 1 | 0 | |||
01 | 1 | ||||
10 | 0 | ||||
11 | 0 |
00 | 01 | 10 | 11 | q | |
00 | 1 | 0 | |||
01 | 1 | ||||
10 | 0 | ||||
11 | 0 |
Answer
D.
[2012]
15. Consider the languages L1 = Φ and L2 = {a}. Which one of the following represents L1L2* U L1*?
- {∈}
- Φ
- a*
- {∈, a}
Answer
{∈}
[2013]
16. Consider the DFA A given below
Which of the following are FALSE?
i. Complement of L(A) is context-free.
ii. L(A) = L ((11*0 + 0) (0 + 1)*0*1*)
iii. For the language accepted by A, A is the minimal DFA.
iv. A accepts all strings over {0, 1} of length at least 2.
- 1 and 3 only
- 2 and 4 only
- 2 and 3 only
- 3 and 4 only
Answer
3 and 4 only
[2013]
17. Consider the finite automaton in the following figure.
What is the set of reachable states for the input string 0011?

- {q0, q1, q2}
- {q0, q1}
- {q0, q1, q2,q3}
- {q3}
Answer
{q0, q1, q2}
[2014]
18. If L1 = {an|n ≥ 0} and L2 = {bn|n ≥ 0}, consider the statements
(i) L1 . L2 is a regular language
(ii) L1 . L2 = {an bn|n ≥ 0}
Which one of the following is CORRECT?
- Only (I)
- Only (II)
- Both (I) and (II)
- Neither (I) nor (II)
Answer
Only (I)
[2014]
19. Let L1 = {w ∈ {0, 1}*| w has at least as many occurrences of (110)’s as (011)’s}. Let L2 = {w ∈{0, 1}*|w has at least as many occurrences of (000)’s as (111)’s}. Which one of the following is TRUE?
- L1 is regular but not L2
- L2 is regular but not L1
- Both L1 and L2 are regular
- Neither L1 nor L2 are regular
Answer
L1 is regular but not L2
[2014]
20. The length of the shortest string NOT in the language (over Σ = {a, b}) of the following regular expression is _.
a*b*(ba)*a*
- 2
- 3
- 4
- 5
Answer
3
[2014]
21. Let Σ be finite non-empty alphabet and let 2Σ* be the power set of ΣΣ*. Which one of the following is TRUE?
1. Both 2Σ* and Σ* are countable
2. 2Σ* is countable and Σ* is uncountable
3. 2Σ* is uncountable and Σ* is countable
4. Both 2Σ* and Σ* are uncountable
- P − 2, Q − 1, R − 3, S − 4
- P − 1, Q − 3, R − 2, S − 4
- P − 1, Q − 2, R − 3, S − 4
- P − 3, Q − 2, R − 1, S − 4
Answer
P − 1, Q − 2, R − 3, S − 4
[2014]
22. Consider the DFAs M and N given above. The number of states in a minimal DFA that accepts the language L(M) ∩ L(N) is _
- 0
- 1
- 2
- 3
Answer
1
[2015]
23. The number of states in the minimal deterministic finite automaton corresponding to the regular expression (0 + 1)*(10) is __
- 0
- 1
- 2
- 3
Answer
3
[2015]
24. Which of the following languages is/are regular?
L1: {wxwR|w1 x ∈ {a, b}* and |w|, |x| > 0}, wR is the reverse of string w
L2: {anbm|m ≠ n and m, n ≥ 0}
L3: {apbqcr| p, q, r ≥ 0}
- L1 and L3 only
- L2 only
- L2 and L3 only
- L3 only
Answer
L1 and L3 only
[2015]
25. Consider the alphabet Σ = {0, 1}, the null/empty string λ and the sets of strings X0, X1 and X2 generated by the corresponding non-terminals of a regular grammar. X0, X1 and X2 are related as follows
X0 = 1X1
X1 = 0X1 + 1X2
X2 = 0X1 + {λ}
Which one of the following choices precisely represents the strings in X0?
- 10(0* + (10)*)1
- 10(0* + (10)*)*1
- 1(0 + 10)*1
- 10(0 + 10)*1 + 110(0 + 10)*1
Answer
1(0 + 10)*1
[2015]
26. Let L be the language represented by the regular expression Σ* 0011 Σ* where Σ = {0, 1}. What is the minimum number of states in a DFA that recognizes L’ (complement of L)?
- 4
- 5
- 6
- 8
Answer
5
[2015]
27. Which of the following languages is generated by the given grammar?
S →aS | bS | ε
- {an bm | n, m ≥ 0}
- {w ∈ {a, b} * | w has equal number of a’s and b’s}
- {an | n ≥ 0 } U {bn |n ≥ 0 } U {anbn | n ≥ 0}
- {a, b}*
Answer
{a, b}*
[2016]
28. Which of the following decision problems are undecidable?
I. Given NFAs N1 and N2, is L (N1) ∩ L (N2)= Φ
II. Given a CFG G = (N, ∑, P,S) and a string x ∈ ∑*, does x ∈ L(G)
III. Given CFGs G1 and G2, is L(G1) = L(G2)
IV Given a TM M, is L(M) = Φ
- I and IV only
- II and III only
- III and IV only
- II and IV only
Answer
III and IV only
[2016]
29. Which one of the following regular expressions represents the language: the set of all binary strings having two consecutive 0’s and two consecutive 1’s?
- (0+1)* 0011 (0+1)* + (0+1)* 1100 (0+1)*
- (0+1)* (00(0+1)*11 + 11 (0+1)*00) (0+1)*
- (0+1)* 00 (0+1)* + (0+1)* 11 (0+1)*
- 00 (0+1)* 11 + 11 (0+1)* 00
Answer
(0+1)* (00(0+1)*11 + 11 (0+1)*00) (0+1)*
[2016]
30. The number of states in the minimum sized DFA that accepts the language defined by the regular expression (0+1)* (0+1) (0+1)* is __ .
- 0
- 1
- 2
- 3
Answer
2
[2016]
31. Language L1 is defined by the grammar: S1→aS1b | ∈
Language L2 is defined by the grammar: S2→abS2 | ∈
Consider the following statements:
P : L1 is regular
Q: L2 is regular
Which one of the following is TRUE?
- Both P and Q are true
- P is true and Q is false
- P is false and Q is true
- Both P and Q are false
Answer
P is false and Q is true
[2016]
32. Consider the following two statements:
I. If all states of an NFA are accepting states then the language accepted by the NFA is ∑*.
II. There exists a regular language A such that for all languages B, A ∩ B is regular.
Which one of the following is CORRECT?
- Only I is true
- Only II is true
- Both I and II are true
- Both I and II are false
Answer
Only II is true
[2016]
33. Consider the language L given by the regular expression (a + b)*b (a + b) over the alphabet {a, b}. The smallest number of states needed in a deterministic finite-state automaton (DFA) accepting L is __.
- 0
- 2
- 4
- 6
Answer
4
[2017]
34. The minimum possible number of states of a deterministic finite automaton that accepts the regular language L = {w1aw2| w1, w2 ∈ {a, b}*, |w1| = 2, |w2| ≥ 3} is __.
- 2
- 3
- 8
- 11
Answer
8
[2017]
35. Let δ denote the transition function and ˆδ denote the extended transition function of the ∈-NFA whose transition table is given below:
Then ^δ (q2, aba) is
δ | ∈ | a | b |
→q0 | {q2} | {q1} | {q0} |
q1 | {q2} | {q2} | {q3} |
q2 | {q0} | Ø | Ø |
q3 | Ø | Ø | {q2} |
- Ø
- {q0, q1, q3}
- {q0, q1, q2}
- {q0, q2, q3}
Answer
{q0, q1, q2}
[2017]
36. Let N be an NFA with n states. Let k be the number of states of a minimal DFA which is equivalent to N. Which one of the following is necessarily true?
- k ≥ 2n
- k ≥ n
- k ≤ n2
- k ≤ 2n
Answer
k ≤ 2n
[2018]
37. Given a language L, define Li as follows:
L0 = {ε}
Li = Li-1. L for all i > 0
The order of a language L is defined as the smallest k such that Lk = Lk+1. Consider the language L1 (over alphabet 0) accepted by the following automaton.The order of L1 is __.
- 0
- 1
- 2
- 3
Answer
2
[2018]
38. Match the following:
E. Checking that identifiers are declared before their use | P. L = {anbmdm|n≥1, m≥1} |
F. Number of formal parameters in the declaration of a function agrees with the number of actual parameters in use of that function | Q. X → XbX|XcX|dXf|g |
G. Arithmetic expressions with matched pairs of parentheses | R. L = {wcw|w∈(a|b)*} |
H. Palindromes | S. X → bXb|cXc|ε |
- E − P, F − R, G − Q, H − S
- E − R, F − P, G − S, H − Q
- E − R, F − P, G − Q, H − S
- E − P, F − R, G − S, H − Q
Answer
E − R, F − P, G − Q, H − S
[2008]
39. Consider the languages L1, L2 and L3 as given below.
L1 = {0p 1q|p, q ∈ N},
L2 = { 0p 1q|p, q ∈ N and p = q} and
L3 = {0p 1q 0r|p, q, r ∈ N and p = q = r}.
Which of the following statements is NOT TRUE?
- Push Down Automata (PDA) can be used to recognize L1 and L2.
- L1 is a regular language.
- All the three languages are context free
- Turing machines can be used to recognize all the languages.
Answer
All the three languages are context free
[2011]
40. Which of the following problems are decidable?
(1) Does a given program ever produce an output?
(2) If L is a context-free language, then, is L’ also context-free?
(3) If L is a regular language, then, is L’ also regular?
(4) If L is recursive language, then, is L’ also recursive?
- 1, 2, 3, 4
- 1, 2
- 2, 3, 4
- 3, 4
Answer
3, 4
[2012]
41. Consider the following languages.
L1 = {0p 1q 0r |p, q, r ≥ 0}
L2 = {0p 1q 0r|p, q, r ≥ 0, p ≠ r}
Which one of the following statements is FALSE?
- L2 is context-free
- L1 ∩ L2 is context-free
- Complement of L2 is recursive
- Complement of L1 is context-free but not regular
Answer
Complement of L1 is context-free but not regular
[2013]
42. Which one of the following is TRUE?
- The language L = {an bn|n ≥ 0} is regular
- The language L = {an|n is prime} is regular
- The language L = {w|w has 3k + 1b’s for some k ∈N with Σ = {a, b}} is regular
- The language L = {ww|w∈Σ* with Σ = {0, 1}} is regular.
Answer
The language L = {w|w has 3k + 1b’s for some k ∈N with Σ = {a, b}} is regular
[2014]
43. Consider the following languages over the alphabet
Σ = {0, 1, c}.
L1 = {0n 1n|n ≥ 0}
L2 = {wcwr|w ∈ {0, 1}*}
L3 = {wwr|w ∈{0, 1}*}
Here wr is the reverse of the string w. Which of these languages are deterministic context-free languages?
- None of the languages
- Only L1
- Only L1 and L2
- All the three languages
Answer
Only L1 and L2
[2014]
44. Consider the NPDA < Q = {q0,q1,q2}, Σ
= {0,1}, Γ
= {0,1,⊥
}, δ
, q0, ⊥
, F = {q2} >, where (as per usual convention) Q is the set of states, Σ is the input alphabet, Γ is the stack alphabet, δ is the state transition function, q0 is the initial state, ⊥ is the initial stack symbol, and F is the set of accepting states. The state transition is as follows:
Which one of the following sequences must follow the string 1011 00 so that the overall string is accepted by the automation?
- 10110
- 10010
- 01010
- 01001
Answer
10010[2015]
45. Which of the following languages are context-free?
L1 = {ambnanbm | m, n ≥ 1}
L2 = {ambnambn | m, n ≥ 1}
L3 = {ambn | m = 2n + 1}
- L1 and L2 only
- L1 and L3 only
- L2 and L3 only
- L3 only
Answer
L1 and L3 only[2015]
46. Consider the following context-free grammars:
G1 : S → aS|B, B → b|bB
G2: S → aA|bB, A → aA|B| ε, B |bBε
Which one of the following pairs of languages is generated by G1 and G2, respectively?
- {ambn | m > 0 or n > 0} and {ambn | m > 0 and n > 0}
- {ambn | m > 0and n > 0} and {ambn | m > 0 or n ≥0}
- {ambn | m ≥ 0 or n > 0} and {ambn | m > 0 and n > 0}
- {ambn | m ≥ 0 and n > 0} and {ambn | m > 0 or n > 0}
Answer
{ambn | m ≥ 0 and n > 0} and {ambn | m > 0 or n > 0}
[2016]
47. Consider the transition diagram of a PDA given below with input alphabet ∑ = {a, b} and stack alphabet = {X,Z}. Z is the initial stack symbol. Let L denote the language accepted by the PDA. Which one of the following is TRUE?
- L = {an bn| n ≥ 0} and is not accepted by any finite automata.
- L = {an | n ≥ 0) ∪ { an bn | n ≥ 0} and is not accepted by any deterministic PDA.
- L is not accepted by any Turing machine that halts on every input.
- L = {an |n ≥ 0} ∪ {an bn|n ≥ 0} and is deterministic context-free.
Answer
L = {an |n ≥ 0} ∪ {an bn|n ≥ 0} and is deterministic context-free.
[2016]
48. Consider the following languages:
L1 = {anbmcn+m : m, n ≥1}
L2 = {anbnc2n : n ≥ 1}
Which one of the following is TRUE?
- Both L1 and L2 are context-free.
- L1 is context-free while L2 is not context-free
- L2 is context-free while L1 is not context-free.
- Neither L1 nor L2 is context-free.
Answer
L1 is context-free while L2 is not context-free
[2016]
49. Consider the following context-free grammar over the alphabet Σ = {a, b, c} with S as the start symbol:
S → abScT | abcT
T → bT | b
Which one of the following represents the language generated by the above grammar?
- {(ab)n(cb)n | n ≥ 1}
- {(ab)ncbm1 cbm2 ….. cbmn | n, m1, m2, …… , mn ≥ 1}
- {(ab)n(cbm)n | m, n ≥ 1}
- {(ab)n(cbn)m | m, n ≥ 1}
Answer
{(ab)ncbm1 cbm2 ….. cbmn | n, m1, m2, …… , mn ≥ 1}
[2017]
50. If G is a grammar with productions
S → SaS | aSb | bSa | SS |∈
Where S is the start variable, then which one of the following strings is not generated by G?
- abab
- aaab
- abbaa
- babba
Answer
babba
[2017]
51. Consider the context-free rammers over the alphabet {a, b, c} given below. S and T are non-terminals.
G1 : S → aSb|T, T → cT|∈
G2 : S → bSa|T, T → cT|∈
The language L(G1) ∩ L(G2) is
- Finite
- Not finite but regular
- Context-Free but not regular
- Recursive but not context-free.
Answer
Not finite but regular
[2017]
52. Consider the following languages over the alphabet Σ= {a, b, c}.Let L1 = {anbncm| m, n ≥ 0} and L2 = {ambncn| m, n ≥ 0}. Which of the following are context-free languages?
I. L1 ∪ L2
II. L1 ∩ L2
- I only
- II only
- I and II
- Neither I nor II
Answer
I only
[2017]
53. Let L1 L2 be any two context-free languages and R be any regular language. Then which of the following is/are CORRECT?
I. L1 ∪ L2 is context-free.
II. L1 is context-free.
III. L1 − R is context-free.
IV. L1 ∩ L2 is context-free.
- I, II and IV only
- I and III only
- II and IV only
- I only
Answer
I and III only
[2017]
54. Identify the language generated by the following grammar, where S is the start variable.
S → XY
X → aX|a
Y → aYb|∈
- {ambn| m ≥ n, n > 0}
- {ambn| m ≥ n, n ≥ 0}
- {ambn| m >n, n ≥ 0}
- {ambn| m > n, n > 0}
Answer
{ambn| m >n, n ≥ 0}
[2017]
55. Consider the following languages.
L1 = {ap | p is a prime number}
L2 = {anbmc2m| n ≥ 0, m ≥ 0}
L3 = {anbnc2n|n ≥ 0}
L4 = {anbn | n ≥ 1}
Which of the following are CORRECT?
I. L1 is context-free but not regular.
II. L2 is not context-free.
III. L3 is not context-free but recursive.
IV. L4 is deterministic and context-free.
- I, II and IV only
- II and III only
- I and IV only
- III and IV only
Answer
III and IV only
[2017]
56. Consider the following languages:
I. {ambncpdq | m + p = n + q, where m, n, p, q ≥ 0}
II. {ambncpdq | m = n and p = q, where m, n, p, q ≥ 0}
III. {ambncpdq | m = n = p and p ≠ q, where m, n, p, q ≥ 0}
IV. {ambncpdq | mn = p + q, where m, n, p, q ≥ 0}
Which of the languages above are context-free?
- I and IV only
- I and II only
- II and III only
- II and IV only
Answer
I and II only
[2018]
57. For s ∈ (0 + 1)*, let d(s) denote the decimal value of s (e.g., d (101) = 5).
Let L = {s ∈ (0 + 1)*|d(s) mod 5 = 2 and d(s) mod 7 ≠ 4}
Which one of the following statements is true?
- L is recursively enumerable, but not recursive
- L is recursive, but not context-free
- L is context-free, but not regular
- L is regular
Answer
L is regular
[2006]
58. Which of the following is true for the language {ap | p is a prime}?
- It is not accepted by a Turing Machine
- It is regular but not context-free
- It is context-free but not regular
- It is neither regular nor context-free, but accepted by a Turing machine
Answer
It is neither regular nor context-free, but accepted by a Turing machine
[2008]
59. If L and L’ are recursively enumerable then L is
- regular
- context-free
- context-sensitive
- recursive
Answer
recursive
[2008]
60. Let L = L1 ∩ L2, where L1 and L2 are languages as defined below:
L1 = {ambmcanbn | m,n ≥ 0}
L2 = {aibjck | i,j,k ≥ 0}
Then L is
- Not recursive
- Regular
- Context-free but not regular
- Recursively enumerable but not context-free.
Answer
Context-free but not regular
[2009]
61. Let L1 be a recursive language. Let L2 and L3 be languages that are recursively enumerable but not recursive. Which of the following statements is not necessarily true?
- L2 – L1 is recursively enumerable
- L1 – L3 is recursively enumerable
- L2 ∩ L1 is recursively enumerable
- L2 ∪ L1 is recursively enumerable
Answer
L1 – L3 is recursively enumerable
[2010]
62. Which of the following statements is/are FALSE?
1. For every non-deterministic Turing machine, there exists an equivalent deterministic Turing machine.
2. Turing recognizable languages are closed under union and complementation.
3. Turing decidable languages are closed under intersection and complementation.
4. Turing recognizable languages are closed under union and intersection.
- 1 and 4 only
- 1 and 3 only
- 2 only
- 3 only
Answer
2 only
[2013]
63. Let L be a language and L’ be its complement. Which one of the following is NOT a viable possibility?
- Neither L nor L’ is recursively enumerable (r. e)
- One of L and L’ is r.e. but not recursive, the other is not r. e.
- Both L and L’ are r.e. but not recursive
- Both L and L’ are recursive
Answer
Both L and L’ are r.e. but not recursive
[2014]
64. Let A ≤m B denote that language A is mapping reducible (also known as many-to-one reducible) to language B. Which one of the following is FALSE?
- If A ≤m B and B is recursive then A is recursive.
- If A ≤m B and A is undecidable then B is undecidable.
- If A ≤m B and B is recursively enumerable then A is recursively enumerable.
- If A ≤m B and B is not recursively enumerable then A is not recursively enumerable.
Answer
If A ≤m B and B is not recursively enumerable then A is not recursively enumerable.
[2014]
65. Let <M> be the encoding of a Turing machine as a string over ∑ = {0, 1}. Let L = { <M> |M is a Turing machine that accepts a string of length 2014}. Then, L is
- Decidable and recursively enumerable
- Undesirable but recursively enumerable
- Undesirable and not recursively enumerable
- Decidable but not recursively enumerable
Answer
Undesirable but recursively enumerable
66. For any two languages L1 and L2 such that L1 is context-free and L2 is recursively enumerable but not recursive, which of the following is/are necessarily true?
I. L1‘ (complement of L1) is recursive
II. L2‘ (complement of L2) is recursive
III. L1‘ is context-free
IV. L1‘ ∪ L2 is recursively enumerable
- I only
- III only
- III and IV only
- I and IV only
Answer
I and IV only
[2015]
67. Consider the following statements.
I. The complement of every Turning decidable language is Turing decidable.
II. There exists some language that is in NP but is not Turing decidable.
III. If L is a language in NP, L is Turing decidable.
Which of the above statements is/are true?
- Only II
- Only III
- Only I and II
- Only I and III
Answer
Only I and III
[2015]
68. Let X be a recursive language and Y be a recursively enumerable but not recursive language. Let W and Z be two languages such that y’ reduces to W, and Z reduces to x’ (reduction means the standard many one reduction). Which one of the following statements is TRUE?
- W can be recursively enumerable and Z is recursive.
- W can be recursive and Z is recursively enumerable.
- W is not recursively enumerable and Z is recursive.
- W is not recursively enumerable and Z is not recursive.
Answer
W is not recursively enumerable and Z is recursive.
[2016]
69. 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‘ ∪ L4 is recursively enumerable
II. L2 ∪ L3 is recursive
III. L*1 ∩ L2 is context – free
IV. L1 ∪ L2‘ is context – free
- I only
- I and III only
- I and IV only
- I, II and III only
Answer
I, II and III only
[2016]
70. Consider the following languages.
L1 = {<M> | M takes at least 2016 steps on some input},
L2 = {<M> | M takes at least 2016 steps on all inputs} and
L3 = {<M> | M accepts ε}
where for each Turing machine M, <M> denotes a specific encoding of M. Which one of the following is TRUE?
- L1 is recursive and L2, L3 are not recursive
- L2 is recursive and L1, L3 are not recursive
- L1, L2 are recursive L3 is not recursive
- L1, L2, L3 are recursive
Answer
L1, L2 are recursive L3 is not recursive
[2016]
71. Let A and B be finite alphabets and let # be a symbol outside both A and B. Let f be a total function from A* to B*. We say f is computable if there exists a turning machine M which given an input x in A*, always halts with f(x) on its tape. Let Lf denote the language {x # f(x)| x ∈ A*}. Which of the following statements is true:
- f is computable if and only if Lf is recursive.
- f is computable if and only if Lf is recursively enumerable.
- If f is computable then Lf is recursive, but not conversely.
- If f is computable then Lf is recursively enumerable, but not conversely.
Answer
f is computable if and only if Lf is recursive.
[2017]
72. Let L(R) be the language represented by regular expression R. Let L(G) be the language generated by a context-free grammar G. Let L(M) be the language accepted by a Turing machine M. Which of the following decision problems are undecidable?
I. Given a regular expression R and a string w, is w ∈ L(R)
II. Given a context-free grammar G, is L(G) = Ø
III. Given a context-free grammar G, is L(G) = ∑* for some alphabet ∑
IV. Given a Turing machine M and a string w, is w ∈ L(M)
- I and IV only
- II and III only
- II, III and IV only
- III and IV only
Answer
III and IV only
[2017]
73. The set of all recursively enumerable languages is:
- Closed under complementation.
- Closed under intersection.
- A subset of the set of all recursive languages.
- An uncountable set.
Answer
Closed under intersection.
[2018]
74. Consider the following problems. L(G) denotes the language generated by a grammar G. L(M) denotes the language accepted by a machine M.
(I) For an unrestricted grammar G and a string w, whether w ∈ L(G)
(II) Given a Turing machine M, whether L(M) is regular
(III)Given two grammars G1 and G2, whether L(G1) = L(G2)
(IV)Given and NFA N, whether there is a deterministic PDA P such that N and P accept the same language.
Which one of the following statements is correct?
- Only I and II are undecidable
- Only III is undecidable
- Only II and IV are undecidable
- Only I, II and III are undecidable
Answer
Only I, II and III are undecidable
[2018]