CSE355 Final MC

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

(1 point) Let r = a(a + b)*, s = aa*b and t = a*b be three regular expressions. Consider the following: (i) L(s) ⊆ L(r) and L(s) ⊆ L(t) (ii) L(r) ⊆ L(s) and L(s) ⊆ L(t) Choose the correct answer from given below: (1) Only (i) is correct. (2) Only (ii) is correct. (3) Both (i) and (ii) are correct. (4) Neither (i) nor (ii) is correct.

1

Decide whether or not the following language is context-free: L = {0^i 1^j 2^k | i > j and k = i − j} (1) This is context-free because one can draw a PDA for it (2) This is context-free because you can create a DFA for it and DFAs are a subset of context-free languages. (3) This is not context-free and s = 0^(2+1) 1^p 2^1 is a good choice for an adversarial string (4) This is not context-free and s = 0^(2p) 1^p 2^p is a good choice for an adversarial string Select all that apply.

1

We have been assigned the task of selecting an interface language for a device controller. Two proposals have been made. Method C uses C++ while Method R uses regular expressions. Based on your knowledge of CSE 355, a primary benefit of Method R over Method C is (1) There is an algorithm to detect dead code in Method R, but need not be an algorithm for Method C. (2) Method R can compute everything that Method C can, and more. (3) Method R is computationally equivalent to a Turing machine while Method C is not. (4) Method R can model a Finite Automaton while Method C cannot.

1

Which of the following statements is correct? (1) All regular languages are context-free but not vice versa (2) All context-free languages are regular languages but not vice versa (3) Regular languages and context-free languages are the same entity (4) None of the above

1

The minimum number of states in a formal Turing Machine description is equal to (1) two because it needs an accept and a reject state. (2) one because it needs a start start state. (3) one because it could have same start and accept state, and the reject state can be implicit. (4) two because it needs a start and an accept state, and the reject state can be implicit. (5) three because it needs a start, an accept, and a reject state. Select all that apply.

1 (note that the start state can be the accept or reject state) (note part 2: NOT 1 STATE; 1 as in the 1st choice lol)

A language that generates palindrome strings over Σ = {0, 1} can be decided by (1) NFA, PDA and Turing Machines (2) NFA (3) PDA (4) Turing Machine (5) Both PDA and Turing Machine Select all that apply.

3, 4, 5

How many elements are in the tuple that defines a finite state machine?

5 - Q, ∑, δ, q₀, F

To show that a language is decidable, one could show the language can be enumerated by a Turing machine. True or False?

False, enumerable implies recognizable, but recognizable does not imply decidable

If a language is decidable, both it and its complement are recognizable. True or False?

True

Suppose that M = (Q, Σ, Γ, δ, q₀, F) is a PDA. Which of the following must be false? (1) Q is empty (2) Σ is empty (3) Γ is empty (4) F is empty (5) Γ ∩ Σ = ∅ Select all that apply.

1

For which of the following must there be q₀? Select all that apply. (1) Regular (2) Context-free (3) Turing recognizable (4) Turing decidable

All of them

Can a DFA recognize a palindrome number?

No, palindromes are context-free, and a DFA cannot recognize CFGs

The halting problem is undecidable, this implies that there is no algorithm to decide whether a given program P terminates on input w when P and w are both provided as input <P,w>.True or False?

True

Is the following correct? To convert a DFA into an equivalent PDA, replace every transition in the transition diagram of the DFA by a transition between the same pair of states in the PDA while not pushing or popping characters from the stack. (1) It is correct because DFAs are a type of PDAs that ignore the stack. (2) It is correct because DFAs and PDAs recognize the same class of languages. (3) It is not correct because PDAs do not have transition diagrams. ⃝ It is not correct because there is a regular language that is not recognized by a PDA. (4) It is not correct because this introduces empty transitions, which were not allowed in the DFA. Select all that apply.

1

We have been assigned the task of selecting an interface language for a disk controller that must count disk reads. In particular, the controller must count how many reads have occurred since the last write to the disk and confirm that the count of reads does not exceed 1,000,000. Two proposals have been made. Method C uses C++ while Method R uses regular expressions. Then (1) I would use Method C because Method R would translate into a finite automaton with at least 1,000,000 states. (2) I cannot use Method C because it is not able to keep track of the count of reads. (3) I would use Method C because Method R cannot keep track of the count of reads. (4) I cannot use Method R because regular expressions cannot represent integers.

1

To show that a language is regular, one can (1) give a DFA that recognizes the language. (2) give an NFA that recognizes the language. (3) give a regular expression that describes the language. (4) use the pumping lemma for regular languages. (5) use closure properties Select all that apply.

1, 2, 3, 5

Which of the following are valid productions rules under Chomsky Normal Form (CNF)? (1) S → AS (2) S → b (3) A → a (4) A → aa (5) S → ε (6) A → ε (7) A → AB (8) S → AAS

1, 2, 3, 5, 7

Which of the following statements is correct? (1) If a language is context free it can always be accepted by a deterministic push-down automata. (2) The union of two context free languages is context free. (3) The intersection of two context free languages is context free. (4) The complement of two context free languages is context free.

2

To show that a language L is NOT context-free, one can (1) show that the language is regular. (2) use the pumping lemma for CFLs. (3) show that L* is not a CFL. (4) show that the language is the intersection of two CFLs. (5) show that the union of L with some regular language is not a CFL. Select all that apply.

2, 3, 5

To show that a language L is NOT regular, one can (1) show that the language is context-free. (2) use closure properties. (3) use the pumping lemma for regular languages. (4) show that the language is finite. (5) show that L ⋆ is not regular. Select all that apply.

2, 3, 5

To show that a language is context-free, one can (1) show that the language is not regular. (2) give a PDA that recognizes the language. (3) give a CFG that generates the language. (4) use the pumping lemma for CFLs. (5) use closure properties. Select all that apply.

2, 3, 5

For which of the following can you accept/reject a string without consuming all characters in the string? Select all that apply. (1) DFA (2) NFA (3) PDA (4) Turing Machine

4

Which of the following is a regular language? (1) String whose length is a sequence of prime numbers (2) String with substring ww^r in between (3) Palindrome string (4) String with even number of Zero's

4

Suppose that M = (Q, Σ, Γ, δ, q₀, qa, qr) is a Turing machine. Which of the following is true? (1) Γ ∩ Σ = ∅ (2) |Q| > 2 (3) qa = qr (4) Σ ⊂ Γ Select all that apply.

4 (remember that Γ always has the blank symbol and Σ always does not)

Regular languages are closed under which of the following operations? Select all that apply. (1) Union (2) intersection (3) complement (4) concatenation (5) Kleene star (6) reversal

All of them

Turing decidable languages are closed under which of the following operations? Select all that apply. (1) Union (2) intersection (3) complement (4) concatenation (5) Kleene star (6) reversal

All of them

To show that a language is decidable, one could show the language is well defined. True or False?

False, "we didn't talk about well-defined" (apparently the TAs said this)

The halting problem is undecidable, this implies that there is AN algorithm to decide whether a given program P that implements a finite automaton terminates on input w when P and w are both provided as input <P,w>. True or False?

False, being undecidable means there is NOT an algorithm to decide

To show that a language is NOT recognizable, one could reduce an undecidable language to it. True or False?

False, doing this would show that the language is undecidable, which implies nothing about whether it is recognizable

To show that a language is NOT recognizable, one could reduce it to an unrecognizable language. True or False?

False, first of all reducibility is used for decidability, not recognizability, and even if it was, it's backwards; you would reduce the known one to the thing you are trying to check

Pumping lemma for regular languages can be used to prove that a language is regular. True or False?

False, it is used to prove that a language is NOT regular

To show that a language is NOT decidable, one could reduce it to an undecidable language. True or False?

False, it's the other way around; you reduce the undecidable language to the one you are trying to check

To show that a language is NOT recognizable, one could reduce it to an undecidable language. True or False?

False, it's the other way around; you reduce the undecidable language to the one you are trying to check; even if the order was correct, doing this would show that the language is undecidable, which implies nothing about whether it is recognizable

To show that a language is NOT decidable, one could ask 1000 people to write a program for it and find out that none of them can. True or False?

False, please review the notes and lectures on 1000 people writing a program, I will not repeat myself here

To show that a language is NOT decidable, one could use the Church-Turing thesis. True or False?

False, the Church-Turing thesis can be used to show that a language is decidable or undecidable, but you may not always be able to apply it

The halting problem is undecidable, this implies that Turing machines are not as powerful as programs in Java. True or False?

False, the Church-Turing thesis says that they are equivalent

The halting problem is undecidable, this implies that there is NO algorithm to decide whether a given program P that implements a finite automaton terminates on input w when P and w are both provided as input <P,w>. True or False?

False, the halting problem does not apply to finite automata, and even if it did, the statement that there is NO algorithm to decide on P and w is false for finite automata (note that decidability for finite automata is actually called acceptance)

TreeOfCrabs took away my speaking permissions and should be bonked. True or False?

False, the second part is true but the first is not

The halting problem is undecidable, this implies that for every program P and every input w, there is no algorithm to decide whether P terminates on input w. True or False?

False, there exists a P for which an algorithm could decide whether P terminates on w, e.g. if P were a DFA

A language is Turing decidable iff a Turing machine can be created for it that will accept all strings in the language and either reject OR loop for all strings not in the language. True or False?

False, this describes Turing recognizability

To show that a language is NOT recognizable, one could show that its complement is decidable. True or False?

False, this would prove the opposite; if the complement is decidable, then the language is also decidable, which would actually imply that it is recognizable

Which of the following can be converted to a deterministic equivalent? Select all that apply. (1) NFA (2) PDA (3) NTM

NFA (to DFA) and NTM (to TM)

A language is co-Turing recognizable when it is the complement of a Turing recognizable language. True or False?

True

To show that a language is NOT decidable, one could reduce an undecidable language to it. True or False?

True

To show that a language is NOT decidable, one could show that it is not recognizable. True or False?

True

To show that a language is decidable, one could describe a Turing machine for it and show it always halts. True or False?

True

To show that a language is decidable, one could use closure properties. True or False?

True

To show that a language is decidable, one could write a program in C++ for it, show that the program always halts, and use the Church-Turing thesis. True or False?

True

Union, concatenation, Kleene star, and reversal are operations that are closed for regular, context-free, Turing recognizable, and Turing decidable languages. True or False?

True

To show that a language is NOT recognizable, one could show that its complement is recognizable but not decidable. True or False?

True, recall that if a language is not decidable, either it or its complement must not be recognizable; therefore, if the complement is recognizable, then the language in question must not be

Context-free languages are closed under which of the following operations? Select all that apply. (1) Union (2) intersection (3) complement (4) concatenation (5) Kleene star (6) reversal

Union, concatenation, Kleene star, reversal (not intersection or complement)

Turing recognizable languages are closed under which of the following operations? Select all that apply. (1) Union (2) intersection (3) complement (4) concatenation (5) Kleene star (6) reversal

Union, intersection, concatenation, Kleene star, reversal (not complement)

L = {w ∈ {0, 1}* | w = 0^n 1^m and (n+m) is even}. Is L regular?

Yes

What are the conditions for the pumping lemma for a context-free language L, given a string w in the form uvxyz?

∀i ≥ 0, uvⁱxyⁱz ∈ L |vy| > 0 |vxy| ≤ p

What are the conditions for the pumping lemma for a regular language L, given a string w in the form xyz?

∀i ≥ 0, xyⁱz ∈ L |y| > 0 |xy| ≤ p


Ensembles d'études connexes

Into to chem Learn smart 250 concepts

View Set

4.3 Physiology of the Skeletal System: Bone Development & Cells

View Set

Revenue Process-Substantive Procedures

View Set

Chapter II & III of Metamorphosis

View Set