Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

ECS 120: Midterm Section 2 - Theory of Computation - Prof. Phillip W. Rogaway, Exams of Computer Science

A handout for a midterm exam in the theory of computation course at uc davis. It includes short answer questions on topics such as finite automata, regular expressions, context-free grammars, and pumping lemma. It also includes justification questions and a little algorithm problem.

Typology: Exams

Pre 2010

Uploaded on 07/30/2009

koofers-user-i6a
koofers-user-i6a 🇺🇸

10 documents

1 / 7

Toggle sidebar

Related documents


Partial preview of the text

Download ECS 120: Midterm Section 2 - Theory of Computation - Prof. Phillip W. Rogaway and more Exams Computer Science in PDF only on Docsity! ECS 120: Theory of Computation Handout M2 UC Davis — Phillip Rogaway February 21, 2002 Midterm — Section 2 Instructions: Please answer the questions succinctly and thoughtfully. Good luck. — Phil Rogaway Name: Signature: On problem you got out of 1 45 2 30 3 25 Σ 100 ECS 120 Handout M2: Midterm — Section 2 1 1 Short Answer [45 points] Let M1 be an n1-state NFA and let M2 be an n2-state NFA. Using the procedures given in class and in your text, how many states will be in the DFA M the language of which is L(M1) ∪ L(M2)? Explain your reasoning. (2) An n-operation regular expression is a regular expression that uses a total of n operations—union, concatenation, or star. For example, 001∗ ∪ 1 is 4-operation regular expression. Let f(n) be the maximum number of states that you get in your NFA when, using the procedure given in class, you convert an n-operation regular expression into an NFA. Give a formula for f(n) (3) Complete the following, mathematically precise, definition, according to the conventions of our text a CFG is a 4-tuple G = ( ) where: ECS 120 Handout M2: Midterm — Section 2 4 2 Justified True or False [30 points] Put an X through the correct box. Where it says “Explain” provide a brief (but convinc- ing) justification. No credit will be given to correct answers that lack a proper justification. Where appropriate, make your justification a counter-example. Throughout, we use L to denote a language (maybe regular, maybe not). 1. If L is regular then L is context free. True False Explain: 2. If M = (Q,Σ, δ, q0, F ) is an NFA and F = Q then L(M) = Σ ∗. Explain: True False 3. If M = (Q,Σ, δ, q0, F ) is an NFA and M ′ = (Q,Σ, δ, q0, F ′), where F ′ = Q−F , then L(M ′) = L(M). True False Explain: 4. If L is context free then L is context free. True False Explain: ECS 120 Handout M2: Midterm — Section 2 5 5. There is an algorithm to decide if a CFG G generates the string abbaa. Explain: True False 6. If L is accepted by an NPDA then L is accepted by a 3-state NPDA. (Assume the conventions on PDAs adopted in lecture.) True False Explain: ECS 120 Handout M2: Midterm — Section 2 6 3 A Little Algorithm [25 points] A black box for a language L is a device (a subroutine) B that, when called on a string x, answers Yes if x ∈ L and No if x 6∈ L. Suppose I give you a black box B for some language L ⊆ {0, 1}∗. I don’t tell you what is L, but I do tell you that L = L(M) for some DFA M having 50 or fewer states. Describe an algorithm A to determine if L(M) is finite or infinite. Explain why your algorithm works. You will be calling B as a subroutine. You may make any number of calls.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved