quiz2-fall11

quiz2-fall11 - # Output = puts $1 puts $2 end 2. (8 pts)...

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

View Full Document Right Arrow Icon
CMSC330 Fall 2011 Quiz #2 Name Discussion Time (circle one): 9am 10am 11am 12pm 1pm 2pm Instructions Do not start this test until you are told to do so! You have 15 minutes for this quiz. There are 30 points for this quiz (30 sec/point). This is a closed book exam. No notes or other aids are allowed. 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 = puts $1 end b. (2 pts) if “Drill the Diamondback” =~ /([^aeiou]+)/
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # Output = puts $1 puts $2 end 2. (8 pts) Create a NFA for a*a, using the algorithm discussed in class. 3. (18 pts) Consider the following NFA. b a 1 2 3 4 a a. (3 pts) Does it accept the string aa? List a possible sequence of state transitions (e.g., 1,2,3) leading to acceptance / rejection of aa. 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....
View Full Document

Page1 / 2

quiz2-fall11 - # Output = puts $1 puts $2 end 2. (8 pts)...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online