0% found this document useful (0 votes)
28 views3 pages

CE401 Practice Questions For Semend Exam (2024-25)

Uploaded by

Khushbu Pandya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views3 pages

CE401 Practice Questions For Semend Exam (2024-25)

Uploaded by

Khushbu Pandya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Practice Questions for Sem-end Exam

CE401 (Theory of Computation)


2024-25

1 Mark MCQs

1. In an NFA, the number of possible transitions from a given state


(a) Always equals to the number of symbols in 
(b) Always less than the number of symbols in 
(c) May exceed the number of symbols in 
(d) None of the above
Answer: (c)

2. Minimum number of states (qi ↋ Q) needed for an FA to recognize the language


(0+1)(0+1)(0+1)* is
(a) 2
(b) 3
(c) 4
(d) 1
Answer: (b)

3. Which of the following strings could be generated by concatenation of (0+1) and


1*01?
(a) 0101
(b) 0001
(c) 0110
(d) 1010
Answer: (a)

4. Which of the following context-free grammars generates an equal number of 0s


and 1s?
(a) S   | 0S1 | 1S1
(b) S  S1 | 0S | SS
(c) S   | 0S1 | 0S
(d) S   | 0S1 | 1S0 | SS
Answer: (d)

5. Which of the following machines recognizes the language


L = { ww | w ↋ {0,1}* }?
(a) Turing machine
(b) Push-down automata (PDA)
(c) Finite Automata (NFA/DFA)
(d) All of the above
Answer: (a)
Each of the following questions carries 5 Marks

1. Define L* and L+. (𝐿∗ = ⋃∞ 𝑖 + ∞ 𝑖


𝑖=0 𝐿 and 𝐿 = ⋃𝑖=1 𝐿 )
* + +
Prove the following relation L L = L .
Answer: L*L+ = {, L, L2 …..}{L, L2, L3 …..} = {L, L2, L3 …..} = L+

2. Suppose you define 0𝑚+ = ⋃∞ 𝑖=0 0


𝑚+𝑖
. Find a string of length 4 in the
3+
language given by 0 1. Can this language have strings of odd length?
Answer: 03+ = 03 + 04 + 05 + …….
03+1 has the following string of length 4 → 0001
03+1 can have strings of odd length such as 00001

3. (a) In an NFA, different sets of states (i.e. different paths in an NFA


diagram) could be traversed for the same string. Briefly discuss and provide
an example.
Answer: In an NFA, transition : Q x ∑ → 2Q
Thus, there could be more than one transition for a given state and an input
symbol leading to a non-deterministic behavior. As a result, different sets of
states could be traversed for the same string.

Consider the NFA below for the language whose strings end with 01

0,1
0 1
q0 q1 q2

For this NFA, different sets of states could be traversed for the same string

01 → q0, q0 and q1, q2


101 → q0, q0, q0 and q0, q1, q2

(b) Provide an NFA diagram for the regular expression Provide an NFA-
diagram for the regular expression 11*0*.
Answer: Concatenate 11* and 0*. In your NFA diagram, use a  transition
between 1* and 0*.
4. (a) Given a string x = y u y (y , u and y are strings), the string u is modified
1 2 1 2

to v in a manner that depends on the strings y and y . Is this an example of


1 2

context-free or context-sensitive grammar? Briefly discuss.


Answer: Production rule u → v depends on the context of u, i.e. strings y1 and
y2. Hence it is an example of context-sensitive grammar.

(b) Show that the strings ab and ababab can be generated from the context-free
grammar
S → Λ | aSb | bSa.
Answer: S → aSb → ab → ab
S → aSb → abSab → abaSbab → ababab → ababab

You might also like