1. Define alphabets and strings in the context of formal languages.
Answer: ○ An alphabet is a finite set of symbols (often denoted by Σ). ○ A string is a finite sequence of symbols chosen from a given alphabet. 2. What is a deterministic finite automaton (DFA)? Answer: A DFA is a finite-state machine where, for each state and input symbol, there is exactly one transition to another state. It accepts or rejects strings based on whether it reaches an accepting state. 3. Explain the language of a DFA. Answer: The language of a DFA is the set of all strings that the DFA accepts. A string is accepted if the DFA transitions from its start state to an accepting state by reading the string. 4. What is the difference between DFA and NFA? Answer: In a DFA, each state has exactly one transition for each input symbol. In an NFA, multiple transitions are allowed for a single symbol (or even none, with epsilon transitions). 5. Define epsilon transition in NFA. Answer: An epsilon (ε) transition is a special type of transition in an NFA that allows the machine to move from one state to another without consuming any input symbol. 6. What is the role of the transition table in DFA? Answer: A transition table is used to represent a DFA’s state transitions. It shows for each state and input symbol which state the DFA will transition to next.
Section B: Medium Answer Questions (5 Marks Each)
1. Explain the state transition graph of a DFA with an example.
Answer: A state transition graph is a visual representation of a DFA where: ○ Each state is represented as a node. ○ Directed edges represent transitions based on input symbols. ○ The start state is marked with an arrow, and accepting states are double-circled. Example: A DFA with states {q0, q1} where q0 is the start state and accepts the string “01” will have transitions such as: ○ From q0, on input ‘0’, go to q1. ○ From q1, on input ‘1’, go to accepting state q2. 2. Discuss the equivalence of NFA and DFA. Answer: An NFA and DFA are equivalent in terms of the languages they accept. For every NFA, there is a corresponding DFA that accepts the same language. The process of converting an NFA to a DFA involves constructing a DFA whose states represent subsets of NFA states (the powerset construction). 3. How can finite automata be minimized? Explain with steps. Answer: Minimization of a finite automaton is the process of reducing the number of states. The steps include: ○ Remove unreachable states. ○ Merge equivalent states (states that have the same transitions for every input symbol). ○ Redraw the automaton with the minimized states. 4. Distinguish between Moore and Mealy machines with a simple example. Answer: A Moore machine produces output based solely on its current state, while a Mealy machine produces output based on both its current state and input. Example: ○ In a Moore machine, the output associated with state q0 is fixed regardless of the input. ○ In a Mealy machine, the output depends on the transition (state and input), e.g., state q0 outputs ‘0’ on input ‘1’ but outputs ‘1’ on input ‘0’. 5. What are the limitations of finite automata? Answer: ○ Finite automata cannot recognize context-free languages or languages that require memory beyond a finite number of states. ○ They cannot handle tasks requiring unbounded memory, such as recognizing palindromes or balanced parentheses.
Section C: Long Answer Questions (10 Marks Each)
1. Discuss in detail the formal definition of a DFA. Provide an example to illustrate
your explanation. Answer: A DFA is a 5-tuple (Q, Σ, δ, q0, F) where: ○ Q: Finite set of states. ○ Σ: Finite set of input symbols (alphabet). ○ δ: Transition function (Q × Σ → Q) mapping each state and input symbol to a next state. ○ q0: Initial state. ○ F: Set of accepting states. Example: Let Q = {q0, q1}, Σ = {0, 1}, q0 as the start state, and F = {q1}. The transition table is: | State | Input 0 | Input 1 | |-------|---------|---------| | q0 | q1 | q0 | | q1 | q1 | q0 | This DFA accepts strings ending with ‘0’. 2. Explain the concept of NFA with epsilon transitions. How can you convert an NFA with epsilon transitions to a DFA? Provide an example. Answer: An NFA with epsilon transitions allows transitions between states without consuming an input symbol. To convert an NFA with ε transitions to a DFA: ○ Step 1: Compute ε-closures for all states (set of states reachable from a given state using only ε transitions). ○ Step 2: Build a DFA where each state represents a set of NFA states (including their ε-closures). Example: Consider an NFA with ε-transitions from q0 to q1 and q1 to q2. In the DFA, these states would merge, and transitions would occur based on the input. 3. Compare and contrast Moore and Mealy machines. Discuss their equivalence and applications in real-world systems. Answer: Moore Machine: ○ Output depends only on the state. ○ Generally simpler but might require more states. 4. Mealy Machine: ○ Output depends on both state and input. ○ Can have fewer states since transitions determine the output. Equivalence: Both Moore and Mealy machines are equivalent in terms of the languages they can recognize. Any Moore machine can be converted to an equivalent Mealy machine and vice versa. Applications: ○ Moore machines are used in sequential circuits where outputs are determined by the state, such as traffic lights. ○ Mealy machines are used in systems like elevators where inputs influence immediate state changes.