CEAT Questions - ToC1
CEAT Questions - ToC1
4. The lexical analysis for a modern language such as Java needs the power of which one of the
following machine models in a necessary and sufficient sense?
(A) Finite state automata
(B) Deterministic pushdown automata
(C) Non-deterministic pushdown automata
(D) Turing machine
5. Let P be a regular language and Q be context-free language such that Q ⊆ P. (For example, let P
be the language represented by the regular expression p*q* and Q be {p nqn|n ∈ N}). Then which
of the following is ALWAYS regular?
(A) P ∩ Q (B) P – Q (C) ∑* – P (D) ∑* – Q
7. Let L={w ∈ (0 + 1)*|w has even number of 1s}, i.e. L is the set of all bit strings with even
number of 1s. Which one of the regular expression below represents L?
(A) (0*10*1)* (B) 0*(10*10*)* (C) 0*(10*1*)*0* (D) 0*1(10*1)*10*
8. S –> aSa| bSb| a| b ;The language generated by the above grammar over the alphabet {a,b} is the
set of
(A) All palindromes.
(B) All odd length palindromes.
(C) Strings that begin and end with the same symbol
(D) All even length palindromes.
9. 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
(A) Not recursive
(B) Regular
(C) Context free but not regular
(D) Recursively enumerable but not context free.
10. Which one of the following regular expression describes the language over {a, b} which consists
of no pair of consecutive b’s?
(A) (a*baa*)(b + epsilon)
(B) (a + ba)*(b + epsilon)
(C) (a*baa*)*(b + epsilon) + a*
(D) (a*ba*)*(b + epsilon) + a*(b + epsilon)
11. Which of the following pairs have DIFFERENT expressive power?
(A) Deterministic finite automata (DFA) and Non-Deterministic finite automata(NFA)
(B) Deterministic push down automata (DPDA) and Non-deterministic pushdown automata
(C) Deterministic single-tape Turing machine and Non-deterministic single-tape Turing Machine
(D) Single-tape Turing machine and multi-tape Turing machine
12. Let w be any string of length n is {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?
(A) n-1 (B) n (C) n+1 (D) 2n-1
13. Consider L= {(ap)* | P is a prime number} over the alphabet {a}, then what is the minimum
number of states in NFA that accepts the language L?
(A) three (B) five (C) two (D) four
14. Consider the Context free grammars over the alphabet {a, b} given below, where ‘S’ is non-
terminal
X:S= aSa |aSb |epsilon
Y:S= aaS |bbS |epsilon
What is the length of the shortest string which does not belongs to L(X) but belongs to L(Y)?
22. 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)*?
A. The set of all strings containing the substring 00
B. The set of all strings containing at most two ’s
C. The set of all string containing at least two ’s
D. The set of all strings that begin and end with either 0 or 1
24. Let Σ be a finite non-empty alphabet and let 2Σ* be the power set of Σ* . Which one of the
following is TRUE?
A. Both 2Σ* and Σ * are countable
B. 2Σ* is countable Σ * is uncountable
C. 2Σ* is uncountable and Σ * is countable
D. Both 2Σ* and Σ * are uncountable
Here wr is the reverse of the string w. Which of these languages are deterministic Contextfree
languages?
A. None of the languages
B. Only L1
C. Only L1 and L2
D. All the three languages
28. Which one of the following regular expressions represents the set of all binary strings with an odd
number of 1’s?
A.10*(0*10*10*)*
B. (0*10*10*)*10*
C. ((0 + 1)*1(0 + 1)*1)*10*
D. (0*10*10*)*0*1
29. 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? ]
A. k ≥ 2n B. k ≥ n C. k ≤ n2 D. k ≤ 2n
B. {wwR │w ∈ L}
C. Prefix (L) = {x ∈ Σ*│∃y ∈ Σ* such that xy ∈ L}
D. L ∙ LR = {xy │ x ∈ L, yR ∈ L}
A. {wwR |w ∈ {a,b}*}
31. Which one of the following languages over Σ = {a,b} is NOT context-free?
B. {wanwRbn |w ∈ {a,b}*, n ≥ 0}
C. {anbi | i ∈ {n, 3n, 5n}, n ≥ 0}
D. {wanbnwR |w ∈ {a,b}*, n ≥ 0}
32. Consider the context-free grammars 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
A. Finite
B. Not finite but regular
C. Context-Free but not regular
D. Recursive but not context-free
33. Let L1, L2 be any two context-free languages and R be any regular language. Then which of the
following is/are CORRECT?
34. What is the complement of the language accepted by the NFA shown below
A. ∅ B. {ε} C. a* D. {a ,ε}
35. 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)*?
A. The set of all strings containing the substring 00.
B. The set of all strings containing at most two 0’s.
C. The set of all strings containing at least two 0’s.
D. The set of all strings that begin and end with either 0 or 1.
36. The above DFA accepts the set of all strings over {0,1} that :
37. Which of the following is true for the language {ap|p is a prime} ?
A. It is not accepted by a Turing Machine
B. It is regular but not context-free
C. It is context-free but not regular
D. It is neither regular nor context-free, but accepted by a Turing machine
38. If the final states and non-final states in the DFA below are interchanged, then which of the
following languages over the alphabet {a,b} will be accepted by the new DFA?
A. Set of all strings that do not end with ab
B. Set of all strings that begin with either an a or a b
C. Set of all strings that do not contain the substring ab
D. The set described by the regular expression b*aa*(ba)*b*
39. Let G = ({S}, {a, b} R, S) be a context free grammar where the rule set R is
S → a S b | SS | ε
Which of the following statements is true?
40. Let A ≤m B denotes that language A is mapping reducible (also known as many-to-one reducible)
to language B. Which one of the following is FALSE?
(A) If A ≤m B and B is recursive then A is recursive.
(B) If A ≤m B and A is undecidable then B is undecidable.
(C) If A ≤m B and B is recursively enumerable then A is recursively enumerable.
(D) If A ≤m B and B is not recursively enumerable then A is not recursively enumerable.
44. In which parsing , the parser constructs the parse tree from the start symbol and transforms it in to
the input symbol.
A. Bottonm-up-Parsing
B. Top-Down parsing
C. None of the above
D. Both A and B
47. Which one of the following regular expressions represents the language: the set of all binary
strings having two consecutive 0s0s and two consecutive 1s?
A. (0+1)*0011(0+1)*+(0+1)*1100()+1)*
B. (0+1)*())(0+1)*11+11()+1)*00)(0+1)*
C. (0+1)*00()+1)*+(0+1)*11(0+1)*
D. 00(0+1)*11+11(0+1)*00
48. The Lexical analysis for a modern computer language such as the java needs the power of Which
one of the following machine model in a necessary and sufficient sense?
A. Finite state automata
B. Deterministic push down automata
C. Non deterministic push down automata
D. Turing Machine
49. S→aSa|bSb|a|b
The language generated by the above grammar over the alphabet {a,b}{a,b} is the set of
A. All Palindromes
B. All odd Length Palindromes
C. Strings that begin and with same symbol
D. All even length palindromes
50. The language accepted by a pushdown Automation in which the stack is limited to 1010 items is best
described as
A. Context free
B. Regular
C. Deterministic Context free
D. Recursive
54. State whether the following statement is TRUE / FALSE. The problem is to whether a Turing Machine
M accepts input ww is un-decidable.
A. True B. False
55. State whether the following statement is TRUE / FALSE.
The intersection of two CFL′s is also CFL.
A. True B. False
57. Let ∑ be a finite non - empty alphabet and let 2∑∗ be the power set of ∑∗. Which one of the
following is TRUE?
A. Both 2∑∗ and ∑∗ are countable
B. 2∑∗ is countable and ∑∗ is uncountable
C. 2∑∗ is uncountable and ∑∗ is countable
D. Both 2∑∗ and ∑∗ are uncountable
Let S denote the set of seven bit binary strings the first, the fourth and the last bits are 1. Find the
number of strings in S that are accepted by M.
(A) 1 (B) 5 (C) 7 (D) 8
2. Consider the following finite automata PP and QQ over the alphabet {a,b,c}{a,b,c}. The start states
are indicated by a double arrow and final states are indicated by a double circle. Let the languages
recognized by them be denoted by L(P)L(P) and L(Q)L(Q) respectively.
A. B.
C D.
3. 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
4. Consider the set of strings on {0,1} in which, every substring of 3 symbols has at most two zeros.
For example, 001110 and 011001 are in the language, but 100010 is 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
Answer (D)
Which of the following finite state machines is a valid minimal DFA which accepts the same
language as D?
Answer (A)
A. L1 and L3 only
B. L1 only
C. L2 and L3only
D. L3 only
7. What is the minimum number of states in deterministic finite automata (DFA) for string starting
with ba2 and ending with ‘a’ over alphabet {a, b}?
A. Ten B. Nine C. Eight D. Six
8. What is the number of states in minimal NFA (non deterministic finite automata), which accepts set
of all strings in which the third last symbol is ‘a’ over alphabet {a, b}?
A. three B. four C. six D. five
10. Which of the following languages is generated by the given grammar? S → aS|bS|ε
12. For s∈(0+1)∗,s∈(0+1)∗, let d(s)d(s) denote the decimal value of s(e.g.d(101)=5)s(e.g.d(101)=5)
Let L={s∈(0+1)∗|d(s)L={s∈(0+1)∗|d(s) mod 5=25=2 and d(s)d(s) mod 7≠4}7≠4}Which of the
following statement is true?
A. L is recursively enumerable, but not recursive
B. B. L is recursive, but not context free
C. L is context free, but not regular
D. L is regular
13. 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.
15. Identify the language generated by the following grammar, where S is the start variable.
S → XY
X → aX|a
Y → aYb|ϵ
A. {am bn │ m ≥ n, n > 0} B. {am bn │ m > n, n > 0}
C. {am bn │ m > n, n ≥ 0} D. {am bn │ m ≥ n, n ≥ 0}
16. Consider the NPDA 〈Q = {q0, q1, q2}, Σ = {0, 1}, Γ = {0, 1, ⊥}, δ, q0, ⊥, F = {q2}〉, where (as per
transition function, q0 is the initial state, ⊥ is the initial stack symbol, and F is the set of accepting
usual convention) Q is the set of states, Σ is the input alphabet, Γ is stack alphabet, δ is the state
Which one of the following sequences must follow the string 101100 so that the overall string is
accepted by the automaton?
A. 10110 B. 10010 C. 01010 D. 01001
17. A CFG G is given with the following productions where S is the start symbol, A is a non-terminal and
a and b are terminals. S→aS∣A A→aAb∣bAa∣ϵ Which of the following strings is generated by the
grammar above?
A. aabbaba B. aabaaba C. abababb D. aabbaab
18. 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?
A. M does not halt on any string (0+1)+ B. M does not halt on any string in (00+1) +
C. M halts on all string ending in a 0 D. M halts on all string ending in a
19. 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 an 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?
A. Only I and II are undecidable B. Only III is undecidable
C. Only II and IV are undecidable D. Only I, II and III are Undecidable
20. Consider the following problem X.X. Given a Turing machine MM over the input alphabet ∑,∑, any
state qq of MM And a word wε∑∗,wε∑∗, does the computation of MM on ww visit the state q′′q″
Which of the following statements about XX is correct?
A. X is decidable
B. X is undecidable but partially decidable
C. X is undecidable and not even partially decidable
D. X is not a decision problem
21. Which of the following languages are undecidable? Note that ⟨M⟩ indicates encoding of the Turing
machine M.
L1 = {⟨M⟩|L(M)=ϕ}{⟨M⟩|L(M)=ϕ}
L1 = {wxyx | w, x, y ∈ (0 + 1)+}
22. Consider the following languages.
24. Let N be an NFA with nn states. Let k be the number of states of a minimal DFAwhich is equivalent
to N. Which one of the following is necessarily true?
A. K<2^n B. k<n^2 C. K>2^n D. K>2^n
27. A student wrote two context-free grammars G1 and G2 for generating a single C-like array
declaration. The dimension of the array is at least one. For example, int a[10][3];
The grammars use DD as the start symbol, and use six terminal symbols int ; id [ ] num.
Grammar G1 Grammar G2
D→intL D→int L;
L→ id[E L→id E
E→num E→E[num]
E→num||E E→[num]
Which of the grammars correctly generate the declaration mentioned above?
A. Both G1 and G2 B. Only G1 C. Only G2 D. Neither G1 nor G2
28. 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?
A. L2-L1 is recursively enumerable B. L2∩L3 is recursively enumerable
C. L1 –L3 is Recursively enumerable D. L2∪L3is recursively enumerable
29. S → aSa|bSb|a|b
The language generated by the above grammar over the alphabet {a,b} is the set of
A. All Palindromes B. All odd length Palindromes
C. strings that begin and end with the same symbol. D. all even length palindromes.
30. 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
A. P-4. Q-1, R-2, S-3 B. P-3, Q-1, R-4, S-2 C. P-3, Q-4, R-1, S-2 D. P-2, Q-1, R-4, S-3
33. 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?
A. Only L2 is context free B. Only L2 and L3 are context free
C. Only L1 and L2 are context free D. All are context free
35. Consider the languages L1=ΦL1=Φ and L2={a}L2={a}. Which one of the following
represents L1L∗2∪L∗1L1L2∗∪L1∗?
A. { ϵ } B. { Ø } C. {a*} D. { ϵ ,a}
What is the set of reachable states for the input string 0011?
37. Let T 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)?
A. 4 B. 5 C. 6 D. 8
38. Let δ denote the transition function and α denoted the extended transition function of the ε-NFA
whose transition table is given below:
Then, α (q2,aba) is
A. Ø B. {q1, q2, q3} C. {q0, q1, q2} D. {q0, q2, q3}
39. One of the following Regular Expressions is not the same as others. Which one?
A. (a* + b*a*)* B. (a*b* + b*a*)* (a*b*)*
C. ((ab)* + a*)* D. (a + b)* a*b*a*b*
4. Context free languages and regular languages are both closed under the operation(s) of :
A. Union
B. Intersection
C. Concatenation
D. Complementation
6. It is decidable whether:
A. An arbitrary Turing machine halts after 10 steps
B. A turing machine prints a specific letter
C. A Turing machine computes the product of two numbers
D. None of the above
9. Which one of the following regular expressions over {0,1} denotes the set of all strings not
containing 100 as substring?
A. 0*(1+0)*
B. 0*101
C. 0*(10+1)*
D. (1+01)*
11. Consider the languages L1 = {0i1j | i != j}. L2 = {0i1j | i = j}. L3 = {0i1j | i = 2j+1}. L4 = {0i1j | i != 2j}.
A. Only L2 is context free
B. Only L2 and L3 are context free
C. Only L1 and L2 are context free
D. Only L2 is not context free
12. 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 grammar G1 and G2, whether L(G1) = L(G2)
(IV) Given an NFA N, whether there is a deterministic PDA P such that N and P accept the
same language
A. I and II are undecidable
B. II and III are undecidable
C. III and Iv are undecidable
D. I and iv are undecidable
Let f : ∑ → ∑ be a polynomial time computable bijection such that (∀ x) [x ∈ L1 iff f(x) ∈ L2]. Further, let f-
15. Consider two languages L1 and L2 each on the alphabet ∑.
19. Given the language L = {ab, aa, baa}, which of the following strings are in L*?
A. abaabaaabaa
B. aaaabaaaa
C. baaaaabaaaab
D. baaaaabaa
1. Find the regular expression for the language recognized by the finite state automaton ______
Answer: 0*1*
L = {x ∈∈ {a, b}* | number of a’s in x is divisible by 2 but not divisible by 3}.The minimum
2. Consider the following language.
5. Let L be the set of all binary strings whose last two symbols are the
same. The number of states in the minimum state deterministic finite-
state automation accepting L is____
Answer: 5
8. S –> aSa| bSb| a| b ;The language generated by the above grammar over the alphabet {a,b} is the
set of ___________________
Answer : All odd length palindromes
9. How many minimum states are required in a DFA to find whether a given binary string has odd
number of 0's or not, there can be any number of 1's. ___________
Answer :2
10. 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 deteninistic finite-state automaton (DFA) accepting L is
__________
Answer: 4
language L={w1aw2|w1,w2∈{a,b}∗,|w1|=2,|w2|≥3}L={w1aw2|w1,w2∈{a,b}∗,|w1|=2,|
11. The minimum possible number of states of a deterministic finite automaton that accepts the regular
w2|≥3} is _________.
Answer: 8
12. Consider a language over ∑ ={a,b} such that all strings begin or end with “ab”. The number of states in minimal
DFA for this language will be ___________
Answer: 6
14. __________ grammar gives multiple parse trees for the same string.
Answer: Ambiguous
19. Consider the languages L1 = ϕ and L2 = {a}. _______ represents L1 L2* U L1*
Answer: { ε}
20. A minimum state deterministic finite automaton accepting the language
L={w | w ε {0,1} *, number of 0s and 1s in w are divisible by 3 and 5,
respectively} has_____
Answer: 15