Midterm1Solution Finite automata

# Midterm1Solution Finite automata - CS 154 Exam 1 Solutions...

This preview shows pages 1–2. Sign up to view the full content.

Solutions The test will be open book, open notes, 75 minute time limit. Please write your answers on the exam sheet. Ten problems, 10 points per problem. Unless otherwise specified, the alphabet is {a,b}. 1. Construct a three-state DFA that recognizes the language L whose members contain no aa; that is, every a is either at the end or the beginning or has a b on both sides of it. Exhibit your answer as a transition graph. (For example, L contains the empty string, and the strings ababa, a, abbba, ab, ba, abababa, ababab, but does not contain aa, abaab, or abaa. ) In state q0, we are either at the beginning of the input or have just received a b. In state q1, we have received exactly one a since the last b or the beginning of the input. In state q2, we have received a double a and hence the string will be rejected no matter what we get now or later. 2. Give a regular expression describing the language in problem 1. That is, a regular expression that is matched exactly by strings containing no aa . Answer: b*(abb*)* + b*(abb*)*a. The first term corresponds to strings that are accepted in state q0, the second to strings accepted in state q1. 3.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 03/19/2008 for the course CS 154 taught by Professor - during the Spring '08 term at San Jose State.

### Page1 / 6

Midterm1Solution Finite automata - CS 154 Exam 1 Solutions...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online