CSE355-FinalStudy
A generalized NFA, or GNFA, (a) can have transitions labelled with ∅ or ∅* (b) is not well-defined (c) can have more than one start state (d) can have more than one final state (e) (a), (c), or (d)
(a)
For an NFA M = (Q,Σ,δ,q0,F) and a subset S ⊆ Q, which of the following is not always true about the ε closure E(S)? (a) there is no ε transition from a state not in E(S) to a state in E(S) (b) there is no ε transition from a state in E(S) to a state not in E(S) (c) S ⊆ E(S) (d) E(S) = ∪q∈SE({q}) (e) Given M and S one can calculate E(S) in finite time.
(a)
In converting a regular grammar to Chomsky normal form, which step is never required? (a) Break up long right hand sides. (b) Make the start variable not appear on the right-hand-side of any rule. (c) Eliminate unit rules. (d) Ensure right hand sides are single terminals or just variables. (e) Eliminate ε rules except possibly for S → ε.
(a)
On input string w ∈ Σ*, the number of computations of a DFA (Q,Σ,δ,q0,F) is always (a) equal to 1 if the DFA accepts w (b) at least 1 if the DFA accepts w (c) a (finite) positive integer (d) a (finite) nonnegative integer (e) an integer between 0 and |Q|
(a)
The powerset method (a) constructs a DFA from an NFA (b) constructs an NFA from a DFA (c) constructs a regular expression from an NFA (d) constructs a DFA from a regular expression (e) constructs a DFA for the intersection of two regular languages
(a)
The pumping lemma for regular languages implies that (a) a regular language is infinite if and only if it contains a string that can be pumped (b) all strings in a regular language can be written as xyz so that xyiz is also in the language when i ≥ 0 (c) every regular language contains some string that can be written as xyz so that xyiz is also in the language when i ≥ 0 (d) regular languages are closed under the regular operations (e) every string can be pumped in at most one way
(a)
The set of languages accepted by DFAs is the same set of languages accepted by NFAs (a) true (b) false
(a)
The set of regular languages is a subset of the set of context-free languages (a) true (b) false
(a)
{a^nb^m : n > m ≥ 0} is (a) not regular because a^(p+1)b^p cannot be pumped (b) not regular because a^pb^p cannot be pumped (c) not regular because you cannot remember n (d) regular because it is a subset of a*b* (e) regular because it is described by a regular expression
(a)
A regular expression describes a language that (a) may not satisfy the conditions of the pumping lemma (b) is finite when the regular expression contains no *(star) (c) is infinite when the regular expression does contain a *(star) (d) contains at least one string with fewer characters than appear in the regular expression (e) is the closure of a regular language under *(star)
(b)
Context-free languages are closed under (a) union, star, and complementation but not intersection or concatenation. (b) union, star, and concatenation but not intersection or complementation. (c) union, star, intersection, and concatenation but not complementation. (d) union, star, intersection, concatenation, and complementation. (e) union and concatenation but not star, intersection, or complementation.
(b)
Context-free languages are closed under intersection and complementation (a) true (b) false
(b)
For a DFA (Q,Σ,δ,q0,F), what is the meaning of the statement c = δ(b,a)? (a) It has no meaning, it is just some symbols. (b) When reading an a in state b, the next state is c. (c) b and a are states of the machine. (d) c is a final state when reading an a. (e) When reading a b, and the next character is a, the next state is c.
(b)
Suppose that I have two DFAs and have 5 and 4 states respectively, and 2 and 3 final states respectively. The number of states in the product DFA for the intersection of their languages is (a) at least 20, but can be more. (b) 20. (c) 6. (d) 3. (e) 2.
(b)
Suppose that I have two DFAs and have 5 and 4 states respectively, and 2 and 3 final states respectively. The number of final states in the product DFA for the union of their languages is (a) 20. (b) 17. (c) 16. (d) 5. (e) fewer than 5.
(b)
The particular value of k provided by the pumping lemma for CFLs is the same value for all context-free languages (a) true (b) false
(b)
The set of languages accepted by deterministic PDAs is the same set of languages accepted by nondeterministic PDAs (a) true (b) false
(b)
Which of the following statements is always false about a DFA (Q,Σ,δ,q0,F)? (a) q0 ∈ F. (b) Q is a proper subset of F. (c) q0 loops on some symbol in Σ. (d) Q contains fewer than 355 states. (e) The size of the alphabet is strictly more than the number of states.
(b)
DeMorgan's Laws ensure that (a) Intersection and union are the same operation. (b) Closure under intersection and union imply closure under complementation. (c) Closure under intersection and complementation imply closure under union. (d) Closure under any two of union, intersection, and complementation implies closure under all three. (e) Closure under union and complementation imply closure under all of the regular operations.
(c)
Given a DFA D = (Q,Σ,δ,q0,F) that accepts every string, what can we infer about D? (a) Every state in D is a final state. (b) There is at least one state in D that is not final. (c) Every reachable state from q0 in D is a final state. (d) There is only one character in the alphabet. (e) There is at least one final state in D that is not q0.
(c)
L` is also in the class. Among the context-free, regular, and finite languages, the classes that are closed under subsets are: (a) all of context-free, regular, and finite. (b) only context-free. (c) only finite. (d) regular and context-free, but not finite. (e) none of context-free, regular, or finite.
(c)
The GNFA method is used to show that (a) Regular languages are closed under star. (b) A language is regular if and only if it is described by a regular expression (c) Every regular language is described by a regular expression. (d) Every regular expression describes a regular language. (e) NFAs are no more powerful than DFAs.
(c)
To rip a state qrip in the GNFA method, when there is a transition from q to qrip labeled A, a transition from qrip to qrip labeled B, a transition from qrip to q0 labeled C, and a transition from q to q` labeled D, we make a transition from q to q` labeled (a) D∪(ABC) (b) (ABC)* ∪D (c) (A(B)*C)∪D (d) A∪B∪C ∪D (e) We cannot tell from the information provided
(c)
Whenever each transition of a PDA M pushes a stack symbol, the language of M (a) may not be context-free. (b) must be context-free but need not be regular. (c) must be regular but need not be finite. (d) must be finite but need not be empty. (e) must be empty.
(c)
Which of the following is false? (a) Every language has a finite alphabet (b) Every string has finite length (c) Every language has a finite number of strings. (d) NFAs can have any positive integer number of states. (e) Regular languages can be described by regular expressions.
(c)
Which of these does not imply that L is regular? (a) L is recognized by an NFA (b) L is described by a regular expression (c) L is closed under the regular operations: i.e, L = LL = L∪L = L*. (d) the complement of L is recognized by a DFA (e) L contains no strings
(c)
{(012)^n : n ≥ 0} is (a) regular because each string can be pumped (b) regular because it is 0*1*2* (c) regular because it is (012)* (d) not regular because you cannot remember n (e) not regular because 0^p 1^p^2^p cannot be pumped
(c)
A context-free grammar G is ambiguous if (a) G is not in Chomsky normal form. (b) every string w ∈ L(G) has at least two different derivations. (c) some string w ∈ L(G) has at least two different derivations. (d) some string w ∈ L(G) has at least two different parse trees. (e) every string w ∈ L(G) has at least two different parse trees.
(d)
If DFA M = (Q,Σ,δ,q0,F) accepts input string w ∈ Σ? with |w| = n, a computation of M on w (a) may be a sequence of any positive integer number of states (b) may be a sequence of any integer number of states that is at least n (c) is a sequence of exactly n states (d) is a sequence of exactly n + 1 states (e) may be a sequence of any integer number of states that is at least |Q|
(d)
If NFA M = (Q,Σ,δ,q0,F) accepts input string w ∈ Σ? with |w| = n, a computation of M on w (a) is a sequence of exactly n states (b) is a sequence of exactly n + 1 states (c) may be a sequence of any positive integer number of states (d) may be a sequence of any integer number of states that is at least n (e) may be a sequence of any integer number of states that is at least |Q|
(d)
Let M = (Q,Σ,δ,q0,F) be a DFA. Let M` = (Q,Σ,δ,q0,Q\F). Then (a) L(M`) ⊇ L(M) but sometimes L(M`) != L(M). (b) L(M`) ⊆ L(M) but sometimes L(M=`) != L(M). (c) L(M`) ⊂ L(M), L(M`) ⊃ L(M), or L(M`) = L(M) might be true. (d) L(M`) = L(M) always. (e) L(M`) != L(M) always.
(d)
The pumping lemma for regular languages was proved in class by (a) showing that the regular languages are closed under the regular operations. (b) showing that regular languages are all finite (c) showing that an NFA computation must repeat a state. (d) showing that a DFA computation must repeat a state. (e) showing that an NFA can be converted to an equivalent DFA.
(d)
The regular operations are (a) union, intersection, and complementation. (b) union, concatenation, and complementation. (c) star, union, and complementation. (d) star, union, and concatenation. (e) snap, crackle, and pop.
(d)
To show that a language is context-free, one could give a PDA for it. One could also (a) give a context-free grammar for it. (b) use the pumping lemma for context-free languages. (c) use closure properties. (d) (a) or (c) (e) (a), (b), or (c)
(d)
To show that a language is regular, one could give a DFA for it. One could also (a) give a regular expression. (b) use the pumping lemma for regular languages. (c) use closure properties. (d) (a) or (c) (e) (a) or (b)
(d)
When converting a PDA with n states to a CFG, the number of rules created (without doing any simplifications) is: (a) O(n). (b) O(n2) but not O(n). (c) O(n3) but not O(n2). (d) Not O(n3). (e) Impossible to classify without more information.
(d)
Whenever each transition of a PDA M pops a symbol, the language of M (a) may not be context-free. (b) must be context-free but need not be regular. (c) must be regular but need not be finite. (d) must be finite but need not be empty. (e) must be empty.
(d)
Which of the following is always true about a given DFA D = (Q,Σ,δ,q0,F)? (a) If q0 !∈ F, D's language contains the empty string ε. (b) If D does not accept some string w, and the resulting state after the computation is qs != q0, then if we modify the machine so that qs is the start state and feed w as input, this modified machine accepts w. (c) If there is a transition from a final state to a non-final state, D's language is infinite. (d) If δ(q0,0) = q1, δ(q1,0) = q0, and q0 ∈ F, D accepts every string consisting of 0's with even length. (e) If D has only one final state, D only accepts a finite number of strings.
(d)
Let L be a regular language. How many DFAs have language L? (a) Exactly 0. (b) Exactly 1. (c) At most 2. (d) Finitely many. (e) Infinitely many.
(e)
Let L be the regular language (11)*0*1* and L` = {(11)^n10^m1^m : n,m ≥ 0}. Then L∪L` is (a) not regular because L` is not regular, since 0^p1^p cannot be pumped in L` (b) not regular because {0^m^1^m : m ≥ 0}⊆ L∪L` (c) regular because you can always pump by setting y to be the leading 11 (d) regular because L ⊇ L` (e) regular by closure under union
(e)
On input string w ∈ Σ?, the number of computations of an NFA (Q,Σ,δ,q0,F) is always (a) a (finite) nonnegative integer (b) a (finite) positive integer (c) equal to 1 if the NFA accepts w (d) an integer between 0 and |Q| (e) at least 1 if the NFA accepts w
(e)
To show that a language is not context-free, one could (a) give a regular grammar for it. (b) use the pumping lemma for context-free languages. (c) use closure properties. (d) (a) or (c) (e) (b) or (c)
(e)
To show that a language is not regular, one could (a) show that it has no regular expression. (b) use the pumping lemma for regular languages. (c) use closure properties. (d) (a) or (c) (e) (b) or (c)
(e)
transition labelled a in the transition diagram of the DFA by a transition a,ε → ε between the same pair of states. (a) It is not correct because this introduces empty transitions, which were not allowed in the DFA. (b) It is not correct because there is a regular language that is not recognized by a PDA. (c) It is not correct because PDAs do not have transition diagrams. (d) It is correct because DFAs and PDAs recognize the same class of languages. (e) It is correct because DFAs are a type of PDAs that ignore the stack.
(e)