quiz1-spr10

# quiz1-spr10 - a. a = 0 # OUTPUT = puts a++ = #{a+1} if a...

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

CMSC330 Spring 2010 Quiz #1 Name Discussion Time (circle one): 9am 10am 11am 12pm 1pm 2pm Do not start this exam until you are told to do so! Instructions You have 20 minutes for this quiz. This is a closed book exam. No notes or other aids are allowed. Answer essay questions concisely in 2-3 sentences. Longer answers are not needed. For partial credit, show all of your work and clearly indicate your answers. Write neatly. Credit cannot be given for illegible answers. 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.

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.

Unformatted text preview: a. a = 0 # OUTPUT = puts a++ = #{a+1} if a puts a b. b = [ 1, 2, 3 ] # OUTPUT = b.each { |c| puts c } c. if route66 =~ /([^a-z]+)/ puts \$1 # OUTPUT = puts \$2 else puts None end 2. (6 pts) Construct a NFA for the regular expression x|y*. You must use the algorithm described in class for full credit. 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...
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.

### Page1 / 2

quiz1-spr10 - a. a = 0 # OUTPUT = puts a++ = #{a+1} if a...

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

View Full Document
Ask a homework question - tutors are online