quiz1-example-fall09

quiz1-example-fall09 - 2. (4 pts) Ruby features What is the...

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

View Full Document Right Arrow Icon
CMSC330 Fall 2009 Example Quiz #1 Name Discussion Time (circle one): 10am 11am 12pm 1pm 2pm 3pm Do not start this exam until you are told to do so! Instructions You have 15 minutes for this quiz. This is a closed book exam. No notes or other aids are allowed. Answer essay questions concisely using 2-3 sentences. Longer answers are not necessary and a penalty may be applied. 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) Programming languages Name a disadvantage of dynamic types in terms of program correctness. Provide a code example in Ruby showing the disadvantage.
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: 2. (4 pts) Ruby features What is the output (if any) of the following Ruby programs? Write FAIL if code does not execute. a. a = [ ] a[1] = b a[2] = 3 a.each{ |x| puts x } 3. (4 pts) Regular expressions and finite automata Give a regular expression equivalent to the following finite automaton. 1 1 1 4 2 3 4. (6 pts) Regular expression to NFA Create a NFA for the regular expression a|(bc)* using construction method from class. 5. (10 pts) NFA to DFA Apply the subset construction algorithm to convert the following NFA to a DFA. Be sure to list the NFA states represented by each DFA state. 1 2 3 a 4 5 6 b 7 8...
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-example-fall09 - 2. (4 pts) Ruby features What is the...

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