quiz1-soln-spr10 - You must use the algorithm described in...

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

View Full Document Right Arrow Icon
CMSC330 Spring 2010 Quiz #1 Solution 1. (6 pts) What is the output (if any) of the following Ruby program? Write FAIL if code does not compile or if executing the code throws a runtime exception. a. a = 0 # OUTPUT = a++ = 1 puts “a++ = #{a+1}” if a 0 puts a b. b = [ 1, 2, 3 ] # OUTPUT = 1 b.each { |c| puts c } 2 3 c. if “route66” =~ /([^a-z]+) / puts $1 # OUTPUT = 66 puts $2 nil else puts “None” end 2. (6 pts) Construct a NFA for the regular expression x|y*.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: You must use the algorithm described in class for full credit. x ε ε ε ε ε ε y ε 3. (8 pts) Convert the following NFA into a DFA by applying the subset construction algorithm discussed in class. Be sure to list the NFA states represented by each DFA state. a 1 a ε ε 3 2 a ε 4 1,3,4 2,3,4 3,4 a a a...
View Full Document

This note was uploaded on 01/13/2012 for the course CMSC 330 taught by Professor Staff during the Fall '08 term at Maryland.

Ask a homework question - tutors are online