0% found this document useful (0 votes)
17 views36 pages

FACT Answers

The document provides an extensive overview of finite automata, including definitions, types (DFA and NFA), and applications in various fields such as compiler design and pattern matching. It also covers concepts related to context-free grammars, the pumping lemma, and the equivalence between PDAs and CFGs. Additionally, it discusses the significance of deterministic pushdown automata and multiple track Turing machines.

Uploaded by

rajeshnarayan2k3
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)
17 views36 pages

FACT Answers

The document provides an extensive overview of finite automata, including definitions, types (DFA and NFA), and applications in various fields such as compiler design and pattern matching. It also covers concepts related to context-free grammars, the pumping lemma, and the equivalence between PDAs and CFGs. Additionally, it discusses the significance of deterministic pushdown automata and multiple track Turing machines.

Uploaded by

rajeshnarayan2k3
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/ 36

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.

2. Classify the different types of Finite automata.


Answer:
• Deterministic Finite Automaton (DFA) – For each state and input, there is
exactly one possible transition.
• Nondeterministic Finite Automaton (NFA) – For a state and input, there can
be multiple possible transitions or none at all.
Additionally, there are extended forms like:
• ε-NFA – NFA with ε (epsilon) transitions, where transitions occur without
consuming input.
• Moore and Mealy Machines – Finite automata with output generation.
These types help in representing and solving different classes of regular languages.

3. What is a Deterministic Finite Automaton (DFA)? Explain its formal definition.


Answer: DFA: A type of FA where each state has exactly one transition for each
input.
Formal Definition: M = (Q, Σ, δ, q₀, F)
Q – Finite set of states
Σ – Input alphabet
δ – Transition function: Q × Σ → Q
q₀ – Initial state
F – Final (accepting) states
DFAs are used in lexical analyzers and pattern matching because of their
predictable behavior.

4. Discuss the applications of Finite automata.


Answer:
• Used in compiler design (Lexical analyzer).
• Text editors for search/replace using regular expressions.
• Pattern matching in strings.
• Digital circuits and control systems.
• Network protocol design.
• Spell checking tools

5. What is a Nondeterministic Finite Automaton (NFA)? Explain its formal definition.


Answer: NFA: An automaton where multiple transitions for the same input are
allowed.
Formal Definition: M = (Q, Σ, δ, q₀, F)
• Q is a finite set of states
• Σ is the input alphabet
• δ is the transition function (δ: Q × Σ → 2^Q)
• q₀ is the initial state
• F is the set of accepting states
Can include ε-transitions (move without input)
NFAs are easier to construct and understand, and every NFA has an equivalent
DFA.

6. Differentiate between the DFA and NFA.


Answer:

7. Design a FA with ∑ = {0, 1} accepts the only input 101.


Answer:

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:

17. Explain the applications of Regular expression.


Answer:
• Text searching and replacing in editors (e.g., Notepad++, VS Code)
• Lexical analysis in compilers
• Input validation in forms (e.g., email format)
• Network intrusion detection using pattern rules
• Command-line tools like grep, sed, awk use regular expressions

18. Design a FA from given regular expression 10+ (0 + 11)0* 1.


Answer:
19. Construct a regular expression over the alphabet {0, 1} for the language
consisting of all strings that start with 1 and end with 0.
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:

24. Define Regular grammar and explain the terminology notations.


Answer: Regular grammar is a type of formal grammar used to generate regular
languages. It is used in finite automata to describe how strings in a language can be
formed using a set of rules. Regular grammars are the simplest types of grammars
in the Chomsky hierarchy.
There are two types:
• Right-linear grammar – all productions are of the form A → aB or A → a
• Left-linear grammar – all productions are of the form A → Ba or A → a
(where A and B are variables, and a is a terminal symbol)
Terminology Notations:
V: A finite set of non-terminal symbols.
Σ: A finite set of terminal symbols.
P: A finite set of production rules.
S: A start symbol.
---------------------------------------------------------------------------------------------------------------------
Steps for converting regular grammar to finite automata:
• Each non-terminal becomes a state in the FA.
• The start symbol becomes the start state.
• For production A → aB, draw a transition from A to B on input a.
• For A → a, draw a transition from A to a final state on input a.
• For A → ε, make A a final state.
• Use ∅ or ε where needed to denote null transitions.
• This transformation helps to design the FA which accepts the same language
as the grammar.
---------------------------------------------------------------------------------------------------------------------
25. Convert regular grammar to finite automata S -> 0A/1S, A -> 1B/0S, B -> 1.
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:

28. Convert regular grammar to finite automata S → aA/bB, A → aA/bB/∈, B →


bB/aB/∈.
Answer:
29. State and prove Pumping lemma for regular languages.
Answer: If a language L is regular, then there exists a constant p (pumping length)
such that any string s in L, with |s| ≥ p, can be split into 3 parts:
s = xyz, satisfying:
• |y| > 0
• |xy| ≤ p
• For all i ≥ 0, xyⁱz ∈ L

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.

30. Describe the applications of pumping lemma.


Answer:
• To prove a language is not regular.
• Used in compiler design to test grammar regularity.
• Helps identify limitations of finite automata.
• Separates regular languages from non-regular ones.
• A theoretical tool for language classification.

31. Explain Context Free Grammar (CFG)?


Answer: A Context-Free Grammar (CFG) is a set of recursive rewriting rules used to
generate patterns of strings.
A CFG is defined as G = (V, Σ, P, S):
• V: Non-terminal symbols
• Σ: Terminal symbols
• P: Productions of the form A → α (A is a non-terminal, α is any string of
terminals and non-terminals)
• S: Start symbol
• CFGs are accepted by Pushdown Automata (PDA).
• Widely used in programming languages and syntax parsers.
• Able to represent nested structures, like parentheses.

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

• It shows the syntactic structure of the string.


• Useful in parsing and syntax checking.

33. Explain parse tree and properties of parse tree.


Answer: A parse tree is a tree structure that shows how a string belongs to a
language defined by a CFG.
Properties:
• Root node is the start symbol.
• Leaves are terminals or ε.
• Internal nodes are non-terminals.
• Each subtree represents a derivation.

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

35. Explain Ambiguous Grammar with example?


Answer: A grammar is ambiguous if a string can have more than one parse tree.
Example:
Grammar:
E → E + E | E * E | (E) | id
String: id + id * id
Can be parsed as:
(id + id) * id or id + (id * id)
→ 2 different trees → ambiguous.
• It causes problems in compilers and programming languages.
• Ambiguous grammar should be avoided or fixed.
• It makes parsing (understanding code) more difficult.
• This can lead to wrong understanding and unexpected results in programs.
• So, clear and unambiguous grammar is better when designing a language.
• Ambiguity affects both the meaning (semantics) and structure (syntax) of
expressions.

36. Differentiate between NFA and PDA.


Answer:
37. What is the transition function w.r.t CFG? Explain.
Answer: In Context-Free Grammar (CFG), there is no transition function like in DFA
or PDA.
Instead, CFG uses production rules to generate strings. These rules tell how a non-
terminal can be replaced by a group of terminals and/or non-terminals.
Key Points:
• CFG is not based on states like DFA or PDA.
• It is based on rewriting rules (called production rules).
• A production rule looks like: A → aB, where A is a non-terminal.
• These rules are used to generate strings from the start symbol.
• So, in CFG, the role of the transition function is played by production rules.

38. Illustrate the equivalence of PDA and CFG?


Answer: Every Context-Free Grammar (CFG) has an equivalent Pushdown
Automaton (PDA).
CFG → PDA:
• PDA uses stack to simulate derivation of CFG.
• It pushes and pops variables like S, A, etc.
PDA → CFG:
• CFG simulates PDA’s moves using production rules.

Thus, CFG and PDA accept the same class of languages — Context-Free
Languages (CFLs).

39. Explain the steps to convert CFL TO PDA?


Answer:
• Start with a CFG : Use a grammar in CNF or GNF form.

• Create a PDA with a stack.

• Push the start symbol (S) of the grammar onto the stack.
• While processing input:

o If stack top is a variable, replace it using a grammar rule (push new


symbols).
o If stack top is a terminal and matches input, pop it and move to the
next input symbol.
• Repeat the steps until the input is finished.

• Accept the string if:

o The stack becomes empty, or


o The PDA reaches a final state.

40. Define the sentential form and explain its types.


Answer: Sentential Form: A string derived from the start symbol using grammar
rules, containing terminals and/or non-terminals.
Types:
• Leftmost Sentential Form: Always apply production to the leftmost non-
terminal.
• Rightmost Sentential Form: Apply production to rightmost non-terminal.

41. Explain any two applications of pumping lemma.


Answer: To Prove a Language is Not Regular
• The pumping lemma is used to show that a given language does not follow
the properties of regular languages.
• Example: Language L = {aⁿbⁿ | n ≥ 0} is not regular.
Using the pumping lemma, we assume L is regular, apply the lemma, and
reach a contradiction.

Used in Theoretical Language Classification


• It helps in classifying languages as regular or not, and understanding the
limits of regular expressions and finite automata.
• Important in automata theory and compiler design, to know what kind of
grammar or machine is needed to recognize a language

Used to Prove a Language is Not Context-Free


• There’s also a pumping lemma for context-free languages (CFLs).
• It helps to show that certain complex languages cannot be generated by
context-free grammars or pushdown automata.
42. Explain multiple tracks Turing machine, Or Give the significance of multiple
tracks.
Answer: A Multiple Track Turing Machine is a type of Turing Machine with one tape
but divided into multiple horizontal tracks (like rows in each tape cell).
Key Features:
• Each cell holds a group of symbols — one from each track (like a tuple).
• The head reads and writes all tracks of a cell at the same time.

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.

Context-Free Languages (CFL):


• CFLs are languages generated by Context-Free Grammars (CFGs).
• Examples include languages with balanced parentheses, palindromes, and
many programming language constructs.
• CFLs are more powerful than regular languages but less powerful than the
languages recognized by Turing Machines.

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.

45. Explain Top down Parsing and Bottom up Parsing.


Answer:

46. Write short notes on Decision algorithm.


Answer:
• A decision algorithm is a procedure that answers Yes or No for a problem.
• It helps to check important properties like:
o Is a string accepted by a DFA?
o Is a language empty?
o Are two automata equivalent?
• Decision algorithms are used in automata theory, compiler design, and
verification.
• They help determine if problems are decidable (can be solved) or not.
• These algorithms form the basis for many automated tools in computer
science.

47. Discuss Transition Function and give their properties?


Answer: Transition Function (δ):
• It shows how an automaton moves from one state to another when reading
an input symbol.
• For DFA, δ takes a state and input and gives exactly one next state.
• For NFA, δ gives a set of possible next states for a state and input.
• For PDA, δ depends on the state, input, and top stack symbol, and tells the
next state and stack action.

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:

49. Illustrate the applications of automata theory?


Answer:
• Compiler Design: Finds words like keywords in programming code.
• Text Searching: Helps tools find patterns in large texts fast.
• Digital Circuits: Designs circuits that work step by step.
• Protocol Checking: Makes sure network communication is correct.
• Robots and AI: Controls how machines behave in steps.
• Pattern Recognition: Finds and sorts patterns easily.
• Language Processing: Helps understand sentence structure.
• Network Security: Filters data packets based on rules.
• Software Checking: Helps prove programs work correctly.

50. Explain the Operations on strings or Formal Languages or Finite Automata or


Automata Theory?
Answer:
• String operations: length, join two strings, get part of a string, reverse a string,
repeat a string.
• Language operations:
o Union: all strings from two languages combined.
o Concatenation: join strings from two languages one after another.
o Kleene star: repeat strings from a language any number of times
(including zero).
o Also intersection and complement to combine or change languages.
• Automata operations: make machines smaller by merging states
(minimization).
• These help build and understand complex languages and are used in things
like compilers.

51. Explain Pumping Lemma for CFG.


Answer:
• If a language L is context-free, there is a number p (called pumping length).
• Any string s in L with length ≥ p can be split into uvwxy such that:
o The middle part vwx has length ≤ p
o The parts v and x are not both empty (at least one is not empty)
o For all i ≥ 0, the string uvⁱw xⁱy is in L (you can “pump” v and x)
• This lemma helps prove that some languages are not context-free by showing
they don’t follow these rules.
• Example: The language {aⁿbⁿcⁿ} is not context-free.

52. Draw the diagram of the model of turning machine.


Answer:

53. Explain the function of the turning machine.


Answer: Function of a Turing Machine
• Reads and writes symbols on a tape during computation.
• Moves the tape head left or right to read/write different cells.
• Changes its state based on the current state and the symbol under the tape
head.
• Starts with input on the tape and modifies it as needed.
• Decides if an input string is accepted or rejected by reaching special states.
• Can simulate any algorithm and models general computation.
• Halts when it reaches a stopping state or runs forever otherwise.

54. Explain general form of the turning machine.


Answer:
55. Illustrate the techniques of tuning machine construction?
Answer: Techniques for Turing Machine Construction
• State splitting: Break complex tasks into smaller states.
• Subroutines: Use repeated sequences as separate modules.
• Encoding symbols: Represent complex data with tape symbols.
• Multi-track tapes: Use several tracks on one tape for parallel info.
• Multi-tape machines: Use multiple tapes to simplify design.
• State minimization: Reduce states to make the machine efficient.
• Simulating other machines: Design TM to copy behavior of simpler machines.
• Direction control: Carefully move tape head left or right as needed.
• Loop detection: Plan loops so machine halts or runs forever correctly.
• Stepwise refinement: Design TM step by step.

56. Construct the TM to compute the concatenation function?


Answer:

57. Design a PDA to accept palindromes over {a, b}.


Answer:

58. What is Primitive recursive function?


Answer:
• Primitive recursive functions are built from simple basic functions like zero,
successor, and projection.
• They are formed using operations called composition and primitive recursion.
• These functions always stop (halt) and give an output for every input (total
functions).
• Examples include addition, multiplication, factorial, and exponentiation.
• They are important because they model functions that are easy to compute
and always finish.

59. List the properties of recursive and recursively enumerable languages?


Answer:

60. Explain in detail about Turing Machine.


Answer:
• Turing Machine is a model of computation with:
o Infinite tape (memory)
o Read/write head
o Finite control (states)
• Can simulate any algorithm.
• Accepts recursively enumerable languages.
• Used to study decidability and computability.

61. Explain Turing machine as a computer of integer functions.


Answer:
• A Turing Machine can compute mathematical functions, e.g.:
o Add two numbers, multiply, factorial
• The tape stores input in unary or binary form.
• The machine reads, processes, and writes results step-by-step.
Or

• A TM computes integer functions by encoding numbers as strings on its tape


(like unary or binary).
• It reads the input, processes it using states and tape changes, and writes the
output on the tape.
• The TM follows step-by-step rules (transitions) to perform calculations like
addition, multiplication, or factorial.
• The machine halts when the computation is done, and the result can be read
from the tape.
• This shows how TMs can model any computable function on integers.

62. Define Chomsky Normal Form (CNF)? Convert a CFG to CNF.


Answer: Chomsky Normal Form (CNF):
• A CFG is in CNF if every production is either:
o A → BC (where B and C are non-terminals)
o A → a (where a is a single terminal)
Steps to Convert CFG to CNF:
• Remove ε-productions (rules producing empty string).
• Remove unit productions (rules like A → B).
• Replace terminals in longer productions with new variables.
• Break long right-hand sides into pairs of non-terminals.

63. Construct a CFG for balanced parentheses.


Answer:

64. Give the CFG for the language of palindromes over {a, b}.
Answer:

65. Define Greibach Normal Form and explain its significance.


Answer: A context free grammar is said to be in Greibach Normal Form (GNF) if all
productions are in the following
form:
• A -> αX
• A -> a
where
• A is a non-terminal symbols
• α is a terminal symbol
• X is a sequence of non-terminal symbols.
Significance:
• Useful in top-down parsing methods like recursive descent.
• Guarantees that every derivation step starts with a terminal symbol, which
helps in constructing parsers.
• Helps in proving theoretical properties of context-free languages

66. Define ɛ-closure in the context of NFA-ε.


Answer:
• ε-closure(q) is the set of states that can be reached from state q by traveling
only through ε (epsilon) transitions, including q itself.
• It helps in converting an NFA with ε-transitions (NFA-ε) into an NFA or DFA
by finding all states reachable without reading input symbols.
• Computed by starting at q, then recursively following all ε-transitions to add
reachable states.

67. Design a DFA that accepts all binary strings divisible by 3.


Answer:

68. Differentiate between language and automaton?


Answer:
69. Show with an example that regular languages are closed under complement.
Answer: Closure under complement means:
If L is regular, then L′ (complement) is also regular.

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.

72. Explain the significance of unreachable states in a DFA.


Answer:
• Unreachable states are states that cannot be reached from the start state by
any input string.
• They do not affect the language accepted by the DFA.
• Removing unreachable states simplifies the DFA.
• Helps in minimizing the DFA and improving efficiency.
• Ensures the DFA is clean and optimized for computation.

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.

74. Differentiate between recursive, recursively enumerable, and non-recursively


enumerable languages.
Answer:

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

77. Explain the concept of Turing-recognizable languages. How do they relate to RE


languages?
Answer:
• A language is Turing-recognizable if there is a Turing Machine that accepts all
strings in it.
• For strings not in the language, the TM may reject or run forever (not always
halt).
• These languages are also called Recursively Enumerable (RE) languages.
• All RE languages are Turing-recognizable.
• But not all RE languages are decidable (some never halt on certain inputs).

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:

83. Define decidability. Provide examples of decidable and undecidable problems.


Answer: A problem is decidable if there is a Turing Machine that always stops and
correctly answers yes or no for every input.
Examples of decidable problems:
• Checking if a string is accepted by a DFA
• Checking if a Context-Free Grammar (CFG) is empty
Examples of undecidable problems:
• Halting Problem
• Post Correspondence Problem (PCP)

84. Explain the role of diagonalization in proving undecidability.


Answer: Diagonalization is a technique used to prove that certain problems cannot
be solved by any algorithm. It shows that if we assume all possible Turing Machines
can be listed, we can construct a new machine that contradicts this assumption. This
method is used to prove the Halting Problem is undecidable, meaning no machine
can decide it for all inputs. It helps demonstrate the limits of computation.

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).

87. Explain the concept of mapping reducibility. How is it used in undecidability


proofs?
Answer: Mapping Reducibility (≤ₘ):
• It means we can transform any instance of problem A into an instance of
problem B using a computable function f. If we can do this, solving B helps
solve A.
How it’s used:
• If problem B is decidable (can be solved), and A reduces to B, then A is also
decidable.
• If we know B is undecidable, and A reduces to B, then A must also be
undecidable.

88. Explain the difference between a Turing-Decidable language and a Turing-


Recognizable language.
Answer:

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.

90. Compare and contrast Context-Free Languages (CFLs) and Context-Sensitive


Languages (CSLs).
Answer:

91. Describe the importance of Linear Bounded Automata (LBA) in recognizing


Context-Sensitive Languages.
Answer:
• LBA is a type of Turing Machine with limited tape size.
• It recognizes Context-Sensitive Languages (CSLs).
• More powerful than machines for Context-Free Languages.
• Used in checking program syntax in compilers.
• Helps understand and process complex languages.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy