{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


quiz2-soln-fall11 - (e.g 1,2,3 leading to acceptance...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CMSC330 Fall 2011 Quiz #2 Solutions 1. (4 pts) What is the output (if any) of the following Ruby program? Write FAIL if code does not execute. a. (2 pts) if “Teach the Terrapin” =~ /([a-z]+)/ # Output = each puts $1 end b. (2 pts) if “Drill the Diamondback” =~ /([^aeiou]+)/ # Output = Dr puts $1 nil puts $2 end 2. (8 pts) Create a NFA for a*a, using the algorithm discussed in class. a a 3. (18 pts) Consider the following NFA. a. (3 pts) Does it accept the string “aa”? List a possible sequence of state transitions
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (e.g., 1,2,3) leading to acceptance / rejection of “aa”. Yes: 1,3,4,2 b. (15 pts) Convert the NFA to a DFA using the subset construction algorithm discussed in class. Be sure to label each state in the DFA with the corresponding state(s) in the NFA. NFA DFA resulting from subset construction b a ± 1 2 3 4 ± a 1,3 2,3 4 b a a a...
View Full Document

{[ snackBarMessage ]}