CS402 – Theory of Automata: Midterm Important Subjective (63 Solved Q&As)
Computer Science • Read every solved subjective question with its model answer directly on this page. Free, no login required.
All 664 Midterm Packs · CS402 Course Page · CS402 MCQ Pack (246 MCQs)
-
What is the difference between the strings and the words of a language?
Topic: Alphabets, Strings & Languages
A string is formed by the concatenation of a finite number of letters from the alphabet. Words are the strings that belong to some language. So every word is a string, but a string is called a word (of a language) only when it belongs to that language.
-
Is there any difference between Kleene's star and Kleene's closure?
Topic: Alphabets, Strings & Languages
There is no difference between the two; both names are used for the same operation (the set of all strings, including the null string Λ, formed by concatenating letters of the alphabet any number of times).
-
Is there any difference between a PALINDROME and the reverse of a palindrome? Explain.
Topic: Alphabets, Strings & Languages
A palindrome is a string that reads the same when written forward or backward, e.g. abba and 1221 are palindromes. The reverse of a palindrome is the palindrome itself: reversing a palindrome gives back exactly the same string. Hence there is no difference — every palindrome is its own reverse, and the language PALINDROME remains unchanged when all its words are reversed.
-
Check whether the following statements are correct or not; if a statement is not correct, correct it. 1. A string in a regular language cannot be infinite. 2. Concatenation of finite letters from an alphabet is called sigma. 3. There cannot be more than one FA for the same language.
Topic: Alphabets, Strings & Languages
1. True — every string is a finite concatenation of letters (it is a language, not a string, that may be infinite). 2. False — the concatenation of a finite number of letters from an alphabet is called a string; sigma (Σ) is the alphabet itself. 3. False — many different FAs can be built for one and the same language.
-
What are the points (parts) of Kleene's theorem?
Topic: Kleene's Theorem, TG & GTG Conversions
Kleene's theorem consists of the following three parts: 1. If a language can be accepted by an FA, then it can be accepted by a TG as well. 2. If a language can be accepted by a TG, then it can be expressed by an RE as well. 3. If a language can be expressed by an RE, then it can be accepted by an FA as well. Together these parts show that FA, TG and RE all define exactly the same class of languages (the regular languages).
-
Write the first step to convert a GTG to an FA (first step of the conversion process in Kleene's theorem).
Topic: Kleene's Theorem, TG & GTG Conversions
Step 1: If a TG has more than one start state, introduce a new start state, connect the new state to the old start states by transitions labeled Λ, and make the old start states non-start states.
-
Explain with an example how, in GTGs, we directly join the initial state with the final state.
Topic: Kleene's Theorem, TG & GTG Conversions
Eliminate the middle state and connect the first state with the last one by a single transition labeled by the RE which is the concatenation of the corresponding two REs in the existing sequence, also including the possibility of a circuit (loop) at the middle state. Example: if x —a→ y, y has a loop labeled c, and y —b→ z, then after eliminating y there is a single transition x —ac*b→ z.
-
What is the difference, and what is common, between an NFA and an FA (DFA)?
Topic: NFA & Finite Automata
Differences: 1. Both have a finite number of states, with one initial state and some (maybe none) final states; the real difference lies in the transitions. 2. In an FA, for each state and for each input letter there is exactly one transition showing how to move from one state to another, while in an NFA there may be more than one transition for certain letters, and there may not be any transition for certain letters. 3. An FA is deterministic — the next state is always uniquely determined — while an NFA is non-deterministic, so a string is accepted if any one of its possible paths ends in a final state. Common features: both have a finite set of input letters (the alphabet), a finite set of states with one start state, and both accept exactly the regular languages — every NFA has an equivalent FA.
-
How can we build the transition table of the FA corresponding to a given NFA?
Topic: NFA & Finite Automata
In an NFA there may be more than one transition for a certain letter, and there may not be any transition for a certain letter. So, starting from the initial state — corresponding to the initial state of the given NFA — the transition table of the corresponding FA, along with the new labels of states, can be built by introducing an empty state for a letter having no transition at a certain state, and a state corresponding to the combination of states for a letter having more than one transition.
-
Explain the Moore machine.
Topic: Moore & Mealy Machines
A Moore machine consists of the following: • A finite set of states q0, q1, q2, … where q0 is the initial state. • An alphabet Σ of input letters. • An alphabet {x, y, z, …} of output characters from which output strings are generated. • A transition table that shows, for each state and each input letter, what state is entered next. • An output table that shows what character is printed by each state as it is entered. A Moore machine has no final states; it is a finite automaton with output, where the output depends only on the state entered.
-
What is the function of a Mealy machine?
Topic: Moore & Mealy Machines
The 1's complementing machine and the incrementing machine, which are basically Mealy machines, are very helpful in computing. The incrementing machine helps in building a machine that can perform the addition of binary numbers.
-
Define alphabet, string and language, giving an example of each.
Topic: Alphabets, Strings & Languages • 3 marks marks
An alphabet Σ is a finite, non-empty set of symbols (letters), e.g. Σ = {a, b} or Σ = {0, 1}. A string is a finite concatenation of letters from Σ, e.g. abba is a string over {a, b}; the string with no letters is the null string Λ, whose length is 0. A language is a set of strings chosen from Σ*, e.g. the language of all strings over {a, b} that start with a. The strings belonging to a language are called its words.
-
What is the null string Λ? If Σ = {a, b}, write all the strings of Σ* having length at most 2, and state how many strings of length m exist over an alphabet of n letters.
Topic: Alphabets, Strings & Languages • 3 marks marks
Λ is the string containing no letter; its length is 0, and joining Λ with any string leaves that string unchanged. Σ* (Kleene star closure of Σ) is the set of all strings over Σ, including Λ. The strings of length at most 2 are: Λ, a, b, aa, ab, ba, bb — 7 strings in total. In general, over an alphabet of n letters, the number of strings of length m is n^m.
-
Define the reverse of a string, a palindrome, and the reverse of a language, with examples.
Topic: Alphabets, Strings & Languages • 2 marks marks
The reverse of a string is obtained by writing its letters in reverse order, e.g. reverse(aab) = baa. A palindrome is a string that is the same as its own reverse, e.g. abba and 1221. The reverse of a language L is the set of the reverses of all its words: L^R = { reverse(w) : w ∈ L }.
-
Define a regular expression (RE) recursively over an alphabet Σ.
Topic: Regular Expressions • 3 marks marks
Regular expressions over Σ are defined as follows: (1) Λ is an RE, denoting the language {Λ}; (2) every letter a of Σ is an RE, denoting {a}; (3) if r and s are REs denoting languages L1 and L2, then r + s is an RE denoting L1 ∪ L2, rs is an RE denoting the concatenation L1L2, and r* is an RE denoting the closure L1* (r+ denotes one or more repetitions); (4) nothing else is an RE.
-
Write regular expressions for the following languages over Σ = {a, b}: (a) all strings that start with a and end with b; (b) all strings that begin and end with the same letter.
Topic: Regular Expressions • 5 marks marks
(a) a(a + b)*b — the string must start with a, end with b, and anything (or nothing) may come in between. (b) a(a + b)*a + b(a + b)*b + a + b — the first two parts cover strings of length at least 2 beginning and ending with a, or beginning and ending with b; the parts a and b cover the single-letter strings, which trivially begin and end with the same letter.
-
Show, with the help of a counterexample string, that (a + b)* and a* + b* do not denote the same language.
Topic: Regular Expressions • 2 marks marks
(a + b)* denotes the set of ALL strings over {a, b}, because a and b may be mixed in any order, e.g. it contains the string ab. But a* + b* denotes only those strings that consist entirely of a's or entirely of b's, so ab is not in the language denoted by a* + b*. Since ab belongs to one language and not the other, the two REs are not equivalent.
-
Define a finite automaton (FA) formally, and explain how an FA decides whether a string is accepted or rejected.
Topic: Finite Automata • 5 marks marks
An FA is a collection of: a finite set of states; an input alphabet Σ; a start (initial) state; a set of final (accepting) states, which may be empty; and a transition table (or diagram) that gives, for every state and every letter of Σ, exactly one next state — an FA is therefore deterministic. To decide a string, start in the start state and follow the transitions, consuming one letter at a time. If, after the whole string has been consumed, the machine is in a final state, the string is accepted; otherwise it is rejected. The set of all strings accepted by an FA is called the language accepted by it.
-
Build an FA that accepts exactly those strings over Σ = {a, b} which start with a. Describe the states and transitions of your diagram in words.
Topic: Finite Automata • 5 marks marks
Use three states: q0 (start, non-final), q1 (final), and q2 (a dead state, non-final). Transitions: q0 —a→ q1 and q0 —b→ q2; from q1, both a and b loop back to q1; from q2, both a and b loop back to q2. A string starting with a moves to q1 and remains there whatever follows, so it is accepted; a string starting with b falls into the dead state q2, and the empty string Λ stays in q0, so both are rejected.
-
Build an FA for the EVEN-EVEN language — the set of strings over Σ = {a, b} having an even number of a's and an even number of b's. Describe the states and transitions in words.
Topic: Finite Automata • 5 marks marks
Four states keep track of the parity (even/odd) of the a's and b's read so far: q0 = (even a, even b) — the start state and the only final state; q1 = (odd a, even b); q2 = (even a, odd b); q3 = (odd a, odd b). Reading an a flips the a-parity and reading a b flips the b-parity: q0 —a→ q1, q0 —b→ q2; q1 —a→ q0, q1 —b→ q3; q2 —a→ q3, q2 —b→ q0; q3 —a→ q2, q3 —b→ q1. A string is accepted exactly when it ends in q0, i.e. when both counts are even (the empty string Λ is also accepted).
-
Build an FA accepting all strings over Σ = {a, b} that contain the substring aba. Describe the states and transitions in words.
Topic: Finite Automata • 5 marks marks
Use four states q0, q1, q2, q3, where qi records that the longest suffix of the input read so far which is also a prefix of 'aba' has length i. q0 is the start state and q3 is the only final state. Transitions: q0 —a→ q1, q0 —b→ q0; q1 —a→ q1, q1 —b→ q2; q2 —a→ q3, q2 —b→ q0; q3 —a→ q3, q3 —b→ q3. As soon as the substring aba has occurred, the machine reaches q3 and stays there, so every string containing aba is accepted, and no other string is.
-
Define a transition graph (TG) and state how a TG differs from an FA.
Topic: Transition Graphs & Generalized TG • 3 marks marks
A TG is a collection of states connected by transitions labeled with strings (possibly Λ) over the alphabet; it may have more than one start state, and some states are final. A string is accepted if there is at least one path from a start state to a final state whose labels concatenate to that string. Differences from an FA: in a TG the transition labels are strings, not single letters; there may be several start states; for a given state and letter there may be several paths or no path at all, whereas an FA has exactly one transition for every state–letter pair. Every FA is a TG, but every TG is not an FA.
-
What is a generalized transition graph (GTG)? How does it differ from a TG, and what is it used for?
Topic: Transition Graphs & Generalized TG • 3 marks marks
A GTG is a transition graph in which the transitions are labeled with regular expressions instead of letters or strings. It differs from a TG only in its labels: a single GTG transition labeled r stands for all the strings denoted by the RE r. GTGs are used in the proof of Kleene's theorem (Part II): a TG is first converted into a GTG, and then states are eliminated one by one, combining RE labels, until a single transition remains whose label is the RE for the whole language.
-
Describe the method of building a regular expression for the language accepted by a TG (Kleene's theorem, Part II): state the steps used to reduce a TG to a single RE.
Topic: Kleene's Theorem & Conversions • 5 marks marks
Step 1: If the TG has more than one start state, introduce a new start state joined to the old start states by Λ-transitions, and make the old start states non-start; similarly, if needed, introduce a new single final state joined from the old final states by Λ-transitions. Step 2: Combine parallel transitions between the same pair of states into one transition labeled with the sum (+) of their labels — the TG has now become a GTG. Step 3: Eliminate the intermediate states one by one: whenever a state z is removed, for every pair of states x, y joined through z by x —r1→ z —r2→ y with a loop r3 at z, add (or merge by +) the transition x —r1(r3)*r2→ y. Step 4: When only the start and the final state remain, the label of the single transition between them is the required RE (with Λ added if the empty string is accepted).
-
In proving Kleene's theorem, Part III, describe how an FA is built for r = r1 + r2, for r = r1r2, and for r = r*, when FAs for r1 and r2 are already known.
Topic: Kleene's Theorem & Conversions • 5 marks marks
Union (r1 + r2): introduce a new start state and connect it to the states that were originally connected to the old start states, using the same transitions as the old start states; the final states of both given FAs remain final. Concatenation (r1r2): begin with the FA for r1; from each of its final states, add the transitions that leave the start state of the FA for r2, so that after completing an r1-word the machine continues like the second FA; the final states are those of the second FA (the final states of the first FA also stay final if Λ belongs to L(r2)). Closure (r*): introduce a new start state which is also final (so that Λ is accepted) and give it the same outgoing transitions as the old start state; also, from every old final state, add the outgoing transitions of the old start state, so that after finishing one repetition the machine can start the next one.
-
Define an NFA and an NFA-Λ, and explain how an NFA-Λ is converted into an equivalent NFA having no Λ-transitions.
Topic: NFA & NFA-Λ • 5 marks marks
An NFA is like a TG whose transitions are labeled with single letters: it has one start state, and for a given state and letter there may be more than one transition or no transition at all; a string is accepted if some path for it ends in a final state. An NFA-Λ is an NFA that also allows transitions labeled Λ, which can be followed without consuming any letter. Conversion: for each state and each letter, collect every state that can be reached by first following any Λ-transitions, then the transition for that letter, and then any Λ-transitions again (the Λ-closures before and after the letter); make exactly these the transitions of the new NFA, and declare a state final if its Λ-closure contains a final state of the NFA-Λ. Removing all Λ-transitions in this way gives an NFA that accepts the same language.
-
Give an example, described in words, of an NFA that accepts the language of strings over Σ = {a, b} ending in ab, and explain why the machine is non-deterministic.
Topic: NFA & NFA-Λ • 3 marks marks
Take states q0 (start), q1, and q2 (final). Transitions: from q0, reading a leads to q0 as well as to q1; from q0, reading b leads to q0; from q1, reading b leads to q2. The machine keeps looping in q0 and, at some point, guesses that the final 'ab' has begun by moving to q1 and then q2. It is non-deterministic because from q0 the letter a has two possible transitions (to q0 and to q1); the string is accepted if at least one of the possible paths ends in the final state q2.
-
Differentiate between a Moore machine and a Mealy machine.
Topic: Moore & Mealy Machines • 3 marks marks
In a Moore machine the output depends only on the state that is entered, so the output is attached to the states (shown in an output table), and the output string is one symbol longer than the input string because the start state also prints a symbol. In a Mealy machine the output depends on the current state together with the input letter, so the output is attached to the transitions, and the output string has the same length as the input string. Neither machine has final states, so neither accepts or rejects strings — both are finite automata with output.
-
Construct a Mealy machine that outputs the 1's complement of a binary input string. Describe its states, transitions and outputs in words.
Topic: Moore & Mealy Machines • 5 marks marks
A single state q0 is enough (it is the start state; a Mealy machine has no final states). Transitions: in q0, on input 0 the machine stays in q0 and outputs 1; on input 1 it stays in q0 and outputs 0. Thus every input bit is flipped as it is read: for example, the input 1010 produces the output 0101, which is the 1's complement of the input.
-
Construct a Moore machine over Σ = {a, b} which prints 1 whenever the portion of the input read so far ends with ab, and prints 0 otherwise. Describe the states, transitions and outputs in words.
Topic: Moore & Mealy Machines • 5 marks marks
Use three states: q0 — the input so far does not end with a (output 0); q1 — the input so far ends with a (output 0); q2 — the input so far ends with ab (output 1). q0 is the start state. Transitions: q0 —a→ q1, q0 —b→ q0; q1 —a→ q1, q1 —b→ q2; q2 —a→ q1, q2 —b→ q0. Because a Moore machine prints the output of each state as it is entered (starting with q0), the output symbol is 1 exactly at those positions where the input read so far ends in ab.
-
Why is there 'no question of accepting a language' in Moore and Mealy machines?
Topic: Moore & Mealy Machines • 2 marks marks
Moore and Mealy machines have no final (accepting) states: every input string simply produces an output string, and no string is accepted or rejected. They are finite automata with output — computing (transducing) machines — not language-accepting machines like an FA.
-
Define a regular language, and state the closure properties of the class of regular languages.
Topic: Regular Languages & Closure Properties • 5 marks marks
A language is called regular if it can be expressed by a regular expression — equivalently (by Kleene's theorem), if it can be accepted by an FA or by a TG. The regular languages are closed under the following operations, i.e. applying any of them to regular languages always gives a regular language: union, concatenation, Kleene closure (star), complement, and intersection.
-
If L1 and L2 are regular languages, show that L1 ∩ L2 is also a regular language.
Topic: Regular Languages & Closure Properties • 3 marks marks
By De Morgan's law for sets, L1 ∩ L2 = (L1' ∪ L2')', where L' denotes the complement of L. Since L1 and L2 are regular, their complements L1' and L2' are regular (closure under complement); the union L1' ∪ L2' is regular (closure under union); and the complement of that union is again regular (closure under complement). Hence L1 ∩ L2 is regular, which shows closure under intersection.
-
Why can the language PALINDROME over Σ = {a, b} not be accepted by any FA, i.e. why is PALINDROME not a regular language?
Topic: Regular Languages & Closure Properties • 3 marks marks
An FA has only a finite number of states, so while reading a string it can remember only a limited, fixed amount of information about the part already read. To test whether an arbitrarily long string is a palindrome, the machine would have to remember the entire first half of the string in order to compare it, letter by letter, with the reversed second half — and the first half can be arbitrarily long, requiring infinitely many different states. Therefore no FA (and hence no TG or RE) can accept PALINDROME; it is a non-regular language.
-
What does an automaton mean?
Topic: Alphabets, Strings & Languages
An automaton means "something that works automatically".
-
What is the difference between an alphabet and an element of a set?
Topic: Alphabets, Strings & Languages
An alphabet is itself a set; the elements of an alphabet are called letters. For example, the binary alphabet Σ = {0, 1} is a set, and 0 and 1 are its letters.
-
What is meant by a valid and an invalid alphabet?
Topic: Alphabets, Strings & Languages
While defining an alphabet whose letters may consist of more than one symbol, no letter should start with another letter of the same alphabet, i.e. one letter must not be a prefix of another letter (a letter may, however, be a suffix of another). For example, Σ = {a, b} and Σ = {a, b, cd} are valid alphabets, while Σ = {a, b, ac} is invalid, because the letter 'a' is a prefix of the letter 'ac'.
-
What is meant by the Kleene star closure of a language?
Topic: Alphabets, Strings & Languages
Given Σ, the Kleene star closure of the alphabet Σ, denoted by Σ*, is the collection of all strings defined over Σ, including Λ. It is to be noted that Kleene star closure can be defined over any set of strings.
-
Differentiate between the Kleene star closure (S*) and the PLUS operation (S+).
Topic: Alphabets, Strings & Languages
Both operations collect the strings formed by concatenating the elements of the set any number of times. The only difference is that S* also includes the null string Λ (zero repetitions), while S+ does not generate Λ automatically — it contains strings formed by one or more repetitions.
-
What is meant by a "language" in automata theory?
Topic: Alphabets, Strings & Languages
The set of all the words accepted by an automaton is called the language recognized (accepted) by that automaton.
-
What is meant by tokenizing a string?
Topic: Alphabets, Strings & Languages
Tokenization (tokenizing) is the process of breaking a string into the letters belonging to Σ — decomposing the string into its valid units, called tokens.
-
Consider S*, where S = {ab, ba}. Can any word in this language contain the substrings 'aaa' or 'bbb'? Why or why not?
Topic: Alphabets, Strings & Languages
No. Every word of S* is a concatenation of the blocks 'ab' and 'ba', so every 'a' is preceded and followed by a 'b', and every 'b' is preceded and followed by an 'a'. One letter can therefore never be surrounded on both sides by the same letter, so the substrings 'aaa' and 'bbb' can never occur in any word of S*.
-
Give an example of a set S such that S* contains all possible strings of a's and b's whose length is divisible by 3.
Topic: Alphabets, Strings & Languages
Let S contain all possible strings of a's and b's of length 3. By the product rule there are 2 × 2 × 2 = 8 such strings: S = {aaa, aab, aba, baa, abb, bba, bab, bbb}. Every word of S* is a concatenation of length-3 blocks, so its length is divisible by 3, and every string of a's and b's whose length is divisible by 3 can be formed in this way.
-
A student was asked to give a recursive definition of the language PALINDROME over Σ = {a, b} and wrote: Rule 1: a and b are in PALINDROME. Rule 2: If x is in PALINDROME, then so are axa and bxb. All the words of the language defined above have odd length, so it is not all of PALINDROME. Fix this problem. Also give a recursive definition of EVENPALINDROM, the language of all palindromes of even length.
Topic: Alphabets, Strings & Languages
The problem is that the base words a and b have odd length, and Rule 2 adds two letters at a time, so only odd-length palindromes are generated. The fix is to include the null string in the base: Rule 1: Λ, a and b are in PALINDROME. Rule 2: If x is in PALINDROME, then so are axa and bxb. Rule 3: Nothing else is in PALINDROME. Now Λ (length 0) generates all even-length palindromes and a, b generate all odd-length ones. For EVENPALINDROM: Rule 1: Λ is in EVENPALINDROM. Rule 2: If x is in EVENPALINDROM, then so are axa and bxb. Rule 3: Nothing else is in EVENPALINDROM.
-
What is meant by equivalent regular expressions? Give an example. When are two FAs said to be equivalent?
Topic: Regular Expressions
Two regular expressions are said to be equivalent if they generate the same language. For example, r1 = (a + b)*(aa + bb) and r2 = (a + b)*aa + (a + b)*bb are equivalent, because both generate the strings over {a, b} that end in 'aa' or 'bb'. Similarly, two FAs are said to be equivalent if they accept the same language.
-
How can we know what language a certain regular expression represents?
Topic: Regular Expressions
The language of a regular expression is determined by the three ways in which it is built up: r1 + r2 represents the union of the languages of r1 and r2 (a string from either one), r1r2 represents their concatenation (a string of the first followed by a string of the second), and r* represents the closure (any number of repetitions of strings of r, including zero, i.e. Λ as well). Reading the expression part by part in this way shows exactly which strings it generates; for example, (a + b)*ab represents all strings over {a, b} that end in 'ab'.
-
Give the regular expression for the EVEN-EVEN language.
Topic: Regular Expressions
(aa + bb + (ab + ba)(aa + bb)*(ab + ba))*
-
Write the regular expression for the language of strings, defined over Σ = {a, b}, containing the substring 'aa'.
Topic: Regular Expressions
(a + b)*aa(a + b)* — any string (possibly Λ) may come before and after an occurrence of 'aa'.
-
Write a regular expression for the language, over Σ = {a, b}, that does not have 'bbb' at any place.
Topic: Regular Expressions
(a + ba + bba)*(Λ + b + bb). Scanning a string from left to right, between any two a's there can be at most two b's, and the string may also end with zero, one or two b's; this expression generates exactly the strings in which 'bbb' never occurs.
-
An FA does not accept any string in three conditions. Write all of them.
Topic: Finite Automata
1. If there is no path starting from the initial state and ending in a final state. 2. If there is no final state. 3. If it is disconnected with the final state (the final state cannot be reached from the initial state).
-
By looking at a transition diagram, how can we identify whether it is an FA or a TG?
Topic: Finite Automata
We can identify it by checking the transitions. If there is a transition for every letter at every state, then it is an FA; otherwise we will consider it a TG.
-
In a transition diagram, how can the initial and final states be represented?
Topic: Finite Automata
The initial state is represented by a minus sign (−) placed before that state, and the final state by a plus sign (+). Alternatively, an arrow head can also be placed before the initial state, and the final state can be shown with a double circle.
-
What is a transition?
Topic: Finite Automata
For each state and for each input letter, a transition shows how to move from one state to another.
-
Name the four types of automata.
Topic: Finite Automata
1. Finite state machine (deterministic / nondeterministic FSM) 2. Deterministic pushdown automaton (DPDA) 3. Pushdown automaton (PDA) 4. Linear bounded automaton (LBA)
-
If a language can be expressed by an FA, then why do we need an NFA? Justify your answer.
Topic: NFA & NFA-Λ
NFAs are interesting because we can express languages more easily with them than with FAs. An FA (DFA) can be understood as one machine, while an NFA can be understood as multiple little machines computing at the same time. Moreover, it is often easier to build an NFA for a given language and then convert it into an FA than to build the FA directly.
-
Describe the method of building an NFA corresponding to the concatenation of two FAs.
Topic: NFA & NFA-Λ
Introduce additional transitions, for each letter, connecting each final state of the first FA with the states of the second FA that are connected with the initial state of the second FA, corresponding to each letter of the alphabet. Remove the + sign of each of the final states of the first FA and the − sign of the initial state of the second FA. This creates nondeterminism at the final states of the first FA, and the NFA obtained in this way is the required NFA.
-
Differentiate between FA, TG and GTG.
Topic: Transition Graphs & Generalized TG
In an FA, the transitions are marked with single letters of the alphabet, and every state must show a transition for every letter, so an FA is deterministic (an FA is also called a DFA). TGs and GTGs provide certain relaxations: there may exist more than one path for a certain string, or there may not be any path for a certain string — this property creates nondeterminism. In a TG, the edges are labeled with strings (possibly Λ) and there may be more than one start state; in a GTG, the directed edges connecting some pair of states are labeled with regular expressions. Every FA is a TG, but not every TG is an FA.
-
What is meant by nondeterminism?
Topic: Transition Graphs & Generalized TG
A machine is nondeterministic when its current state and current input do not uniquely determine the next state — for a certain state and letter there may be more than one possible transition, or no transition at all. TGs and GTGs provide this relaxation: there may exist more than one path for a certain string, or there may not be any path for a certain string. A deterministic machine, in contrast, knows exactly what to do for every possible input.
-
Define a Mealy machine.
Topic: Moore & Mealy Machines
A Mealy machine is a finite automaton with output. It consists of a finite set of states, with one initial state; an input alphabet Σ; an output alphabet; and a transition table that shows, for each state and each input letter, the next state together with the output character printed on that transition. The output therefore depends on the present state and the present input letter, and the length of the output string is the same as the length of the input string. A Mealy machine has no final states.
-
What are finite automata with output?
Topic: Moore & Mealy Machines
An FA which generates an output string corresponding to each input string is called a machine with output (a finite automaton with output). There are two types of machines with output: the Moore machine and the Mealy machine.
-
What is the difference between regular languages and non-regular languages?
Topic: Regular Languages & Closure Properties
The language generated by any regular expression is called a regular language, while the language that cannot be expressed by any regular expression is called a non-regular language.
-
What does it mean that a language is closed under an operation?
Topic: Regular Languages & Closure Properties
A language is closed under an operation if applying that operation to the words of the language always results in a word of the same language. For example, the set of integers is closed under addition, because the sum of any two integers is again an integer.
-
What is the concept of the union of two FAs?
Topic: Regular Languages & Closure Properties
When we take the union of two FAs, the resultant FA must accept all the words that were accepted by the two FAs individually — just as the union of two sets contains the members of both sets.