Tribhuvan University
Institute of Science and Technology
2081
Bachelor Level / fourth-semester / Science
Computer Science and Information Technology( CSC262 )
Theory of Computation
Full Marks: 60 + 20 + 20
Pass Marks: 24 + 8 + 8
Time: 3 Hours
Candidates are required to give their answers in their own words as far as practicable.
The figures in the margin indicate full marks.
SECTION A
Attempt any TWO question.
Mention the transition function of PDA. List the two ways that PDA accepts the string. Convert the following CFG to PDA.
S → AS | ε
A → Ab | Bb | ab
List any two regular operators. Minimize the following finite state machine using Table Filling algorithm.

Define Turing machine as enumerators of strings of a language. Encode the Turing machine TM = ({q0, q1, q2} , {a, b}, {a, b, B}, δ, q2, B, F) with input w = ba and δ is defined as follows:
δ(q0, b) → (q1, b, R), δ(q1, a) → (q2, a, R), δ(q2, a) → (q1, a, R), δ(q2, b) → (q2, b, L)
SECTION B
Attempt any EIGHT question.
Does machine always refer to hardware? Justify. Define positive closure and Kleene closure.
What is undecidable problem? Discuss about Post Correspondence Problem.
Define the language of a grammar. For the grammar S → 0S0 | 1 | ε, show the leftmost derivation for the string 00100 with its parse tree.
Define ε-closure of a state. Differentiate between Moore and Mealy machine.
Represent the following regular grammar to finite automata.
S → aA | aB | ε
A → aA | aS
B → bB | ε
Design the DFA that accepts binary string ending with “00” and show its extended transition function for the string 111000.
Convert the following grammar to CNF.
S → AAB, A → aA | ε, B → ab | a
For the following Turing Machine, test whether the string “( ) ) )” is accepted or rejected and represent it in transition diagram.
| State | X | Action (Write, Move, New State) | Y | Action (Write, Move, New State) | B | Action (Write, Move, New State) |
| q0 | ( | X,R,q1 | , , q0 | , , q4 | ||
| q1 | ) | X,L,q2 | Y,L,q2 | |||
| q2 | X | X,R,q0 | Y | Y,R,q3 | , R,q4 | |
| q3 | , , q3 | , , q3 | , R,q4 |
Differentiate between Class P and Class NP problem. Mention the transition function of DFA, NFA, and ε-NFA.