FACT Answers
FACT Answers
1. Define Finite Automata. Explain the basic components of a Finite Automaton with
an example.
Answer: A finite automaton is a mathematical model with a finite number of states
and transitions used to recognize patterns within input.
Components of FA:
Q: Set of states
Σ: Input alphabet
q₀: Initial state
F: Set of accepting states
δ: Transition function
For example, to accept the string "ab", the automaton moves from q0 to q1 on 'a',
and from q1 to q2 on 'b', where q2 is the accepting state.
8. Construct DFA with ∑ = {0, 1} accepts all strings starting with 1. (Note: The
diagram below this question is likely the FA for this question, not a separate item
for which to construct a transition table unless explicitly stated as such
elsewhere).
Answer:
9. Construct the transition table of [the given FA diagram with states q0, q1, q2].
Answer:
10. Describe the role of ε -transitions in finite automata. Construct a small NFA-ɛ and
demonstrate how to eliminate ɛ-transitions to convert it into a standard NFA.
Answer: ε-transition: Allows state change without consuming input.
Used to: Simplify automaton construction.
ε-closure: All states reachable from a state using only ε.
To eliminate ε:
• Compute ε-closure for each state.
• Adjust transitions to account for indirect ε paths.
11. Draw transition diagram for the transition table [given: q0, q1, *q2].
Answer:
12. Convert the given NFA to DFA [for the NFA diagram with states q0, q1, q2].
Answer:
13. Convert the given NFA to DFA.
Answer:
14. Construct a DFA that accepts all binary strings which contain an even number of
0s and an odd number of 1s.
Answer:
Here is the state diagram for the correct DFA. Note that q0 is the start state and q1
is the final state.
15. Design an NFA in which all the string contain a substring 1110.
Answer:
16. Design FA with ∑ = {0, 1} accepts the set of all strings with three consecutive 0's.
Answer:
20. Design a regular expression for the set of strings over the alphabet {a, b} such
that no two b's are adjacent.
Answer:
21. Convert the given DFA to RE [for the DFA diagram with states A, B, C].
Answer:
22. Construct a regular expression for the set of strings that start and end with the
same symbol over the alphabet {a, b}.
Answer:
23. A language L is defined over {a, b} such that no string in L contains "bab" as a
substring. Construct a DFA that accepts L.
Answer:
26. Provide the corresponding regular expression after the conversion, if any
simplification or changes occur during the DFA construction.
Answer:
27. Convert the NFA to a DFA for the language where strings contain exactly two a's
over the alphabet {a, b}.
Answer:
Proof Idea:
• DFA for L has p states.
• A string of length ≥ p must repeat some state.
• This forms a loop (pigeonhole principle).
• Part y can be "pumped" any number of times without leaving L.
• Used to prove certain languages are not regular by contradiction.
• Fundamental tool in language classification.
32. Define derivation tree and explain the types of derivation tree?
Answer: A derivation tree (or parse tree) shows how a string is generated using
grammar rules.
Types:
• Leftmost Derivation Tree: Always replace the leftmost variable first.
• Rightmost Derivation Tree: Always replace the rightmost variable first.
Example: Grammar: S → aSb | ε String: aabb
34. Explain how reduction is used to prove that a problem is undecidable. Give a
general overview.
Answer: Reduction: Convert one known problem to another.
If problem A is undecidable and A reduces to B, then B is also undecidable.
Steps:
• Start from a known undecidable problem (e.g., Halting Problem)
• Transform it into the target problem
• Show that solving the target implies solving the known one → contradiction
Thus, CFG and PDA accept the same class of languages — Context-Free
Languages (CFLs).
• Push the start symbol (S) of the grammar onto the stack.
• While processing input:
Significance:
• Simulates multi-tape machines using a single tape with tracks.
• Helps simplify complex algorithms or Turing machine designs.
• Useful in pattern matching, parsing, and parallel data handling.
• Makes it easier to store multiple types of data side by side.
• Improves clarity and efficiency in transitions and machine logic.
43. Discuss about PDA or Explain the Deterministic push down automata.
Answer: Deterministic Pushdown Automaton (DPDA):
• A DPDA is a type of Pushdown Automaton (PDA) that has only one possible
move for each input symbol and stack symbol.
• It uses a stack along with states to process the input string.
Key Features:
• Only one transition is allowed for a given input and stack symbol (no
ambiguity).
• Accepts Deterministic Context-Free Languages (DCFLs).
• Simpler to implement than Nondeterministic PDA (NPDA).
• Not all CFLs can be accepted by a DPDA.
• Commonly used in compiler design, especially in LR and LL parsers.
• Helps in syntax checking of programming languages
44. Explain PUSH DOWN AUTOMATA and CFL (Context Free Languages).
Answer: Pushdown Automata (PDA) and Context-Free Languages (CFL):
• A Pushdown Automaton (PDA) is a machine used to recognize Context-Free
Languages (CFLs).
• It has states, an input tape, and a stack to remember information about past
inputs.
• The stack helps PDA handle nested and recursive structures like balanced
parentheses.
Key Points:
• PDA and CFG are equivalent in power; both define CFLs.
• PDA is very important in syntax analysis and parsing in compilers.
• It helps in recognizing languages that finite automata cannot (because of the
stack).
• Used in real-world applications like XML parsing and expression evaluation.
Properties:
• In DFA, δ is deterministic (only one next state).
• In NFA and PDA, δ can have many possible moves (nondeterministic).
• For DFA, δ must be defined for every input in every state.
• PDA’s δ can do stack operations like push and pop.
• Transition function controls how the machine processes input and accepts
strings.
48. Convert the following CFG into Chomsky Normal Form (CNF): S→AB|a, A→BC|b
B->a, C->c
Answer:
64. Give the CFG for the language of palindromes over {a, b}.
Answer:
Example:
Let L = strings over {0,1} ending with 1
DFA accepts L
To get L′ (strings not ending with 1), flip accepting and non-accepting states of DFA.
Resulting DFA accepts the complement → also regular.
70. Define the extended transition function (delta) and explain its significance.
Answer: δ̂(q, w): Extended version of δ (normal transition) that works on strings.
Significance: It helps simulate how an automaton processes a full input string.
Defined as:
δ̂(q, ε) = q
δ̂(q, wa) = δ(δ̂(q, w), a)
71. Can two DFAs accept the same language but have different structures? Explain.
Answer:
• Yes, two DFAs can accept the same language but have different structures.
• They may differ in the number of states and transitions.
• One DFA might be minimized (smallest number of states), and the other not
minimized.
• Both will accept exactly the same set of strings (language).
• Example: A minimized DFA vs a larger DFA for the same language.
73. Describe the pumping lemma condition that proves a language is not regular.
Answer:
• Assume the language L is regular with pumping length p.
• Take a string s in L with length ≥ p.
• Split s into three parts: s = xyz, such that:
o |y| > 0 (y is not empty)
o |xy| ≤ p (y occurs within the first p characters
• For all i ≥ 0, the string x(y^i)z should be in L if L is regular.
• If there exists some i where x(y^i)z is not in L, this contradicts regularity, so L
is not regular.
75. Explain the concept of a Universal Turing Machine (UTM) with a suitable
diagram.
Answer:
• UTM: A Turing Machine that can simulate any other TM.
• Input: A pair (TM description + input string)
• Output: Same as original TM on that input.
• Significance: Foundation of general-purpose computers.
76. Describe the method of reducing a known undecidable problem to prove the
undecidability of another.
Answer:
• Reduction technique:
o Start with a known undecidable problem (e.g., Halting Problem)
o Show that solving your problem would also solve the known one
o Therefore, your problem must also be undecidable
• Used in: Theory of computation, complexity
78. Illustrate the working of a Linear Bounded Automaton (LBA) with a small
example.
Answer:
• LBA: A type of Turing Machine where the tape is limited to the size of the
input.
• Example:
o Input: aabb
o LBA checks if number of a’s = number of b’s
• Uses tape space only equal to the length of the input (no infinite space)
• Accepts Context-Sensitive Languages (CSLs)
79. Present the Chomsky hierarchy and explain the relationship between its levels.
Answer:
80. Compare context-free, context-sensitive, and regular languages based on
closure properties.
Answer:
81. Prove that PCP is undecidable using reduction from the Halting Problem or
another known undecidable problem.
Answer: PCP (Post Correspondence Problem):
o Given domino tiles with strings (top/bottom), can they match?
• To prove undecidable:
o Reduce from Halting Problem (known undecidable)
o If we solve PCP, we could solve the Halting Problem
o But Halting Problem is undecidable → so PCP must also be
82. Discuss the closure properties of recursively enumerable languages. Are they
closed under complement? Justify.
Answer:
85. Describe a Turing machine that accepts the language L = { a^n b^n c^n | n > 1 }.
Is it context-free? Why or why not?
Answer: Turing Machine for L = { aⁿbⁿcⁿ | n > 1 }:
• The TM scans the input left to right.
• It finds the first unmarked ‘a’, marks it (e.g., replace with X).
• Then moves right to find the first unmarked ‘b’, marks it.
• Moves further right to find the first unmarked ‘c’, marks it.
• Repeats this process until all symbols are matched and marked.
• If any step fails (missing symbol or wrong order), TM rejects.
• If all matched, TM accepts.
Is L context-free?
• No, L is not context-free because a PDA cannot keep track of equal numbers
of three different symbols in order. It requires more powerful computation like
a TM.
86. Discuss why every recursive language is RE but not all RE languages are
recursive. Provide an example.
Answer:
• Every recursive language is RE because a TM that always halts and decides
the language can also be used as a recognizer (it halts and accepts or
rejects).
• But not all RE languages are recursive because some TMs may accept inputs
but never halt for others.
• So, RE includes all recursive languages plus some undecidable ones.
• Example: The Halting Problem language is RE (TM accepts if halts) but not
recursive (no TM decides it for all inputs).
89. Discuss the concept of undecidability. How does it impact our understanding of
algorithmic limits?
Answer: Undecidability means there is no algorithm or Turing Machine that can
always give a correct yes/no answer for every input of certain problems.
Impact:
• It proves some problems cannot be solved by any computer program.
• Shows fundamental limits of what algorithms can do.
• Helps understand which problems are impossible to automate fully.
Examples:
• Halting Problem: Can't decide if any program stops or runs forever.
• Post Correspondence Problem (PCP): No general algorithm to solve all
instances.