final-spr10

final-spr10 - CMSC330 Spring 2010 Final Exam Name Do not...

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

View Full Document Right Arrow Icon
CMSC330 Spring 2010 Final Exam Name Do not start this exam until you are told to do so! Instructions You have 120 minutes for to take this exam. This exam has a total of 130 points. An average of 1 minute per point. This is a closed book exam. No notes or other aids are allowed. If you have a question, please raise your hand and wait for the instructor. Answer essay questions concisely using 1-2 sentences. Longer answers are not necessary and a penalty may be applied. In order to be eligible for partial credit, show all of your work and clearly indicate your answers. Write neatly. Credit cannot be given for illegible answers. Problem Score Max Score 1 Programming languages 8 2 Ruby 6 3 Regular expressions & finite automata 18 4 OCaml types & type inference 6 5 OCaml programming 6 6 OCaml polymorphic types & higher order functions 15 7 Context free grammars & parsing 16 8 Operational semantics 8 9 Lambda calculus 6 10 Lambda calculus encodings 9 11 Garbage collection 8 12 Polymorphism 8 13 Java multithreading 16 Total 130
Background image of page 1

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

View Full DocumentRight Arrow Icon
1. (8 pts) Programming languages a. (4 pts) Briefly define a weak type system. Provide a code fragment example. b. (4 pts) Recall that functional languages allow functions to be passed as arguments; e.g., map takes a function as an argument and applies it to elements of a list. Java does not directly support passing functions/methods as arguments. Briefly describe how you can encode function-passing in Java to implement something like map. (1 sentence should be sufficient). 2. (6 pts) Ruby a. (4 pts) Name an important difference between Ruby’s nil and Java’s null . b. (2 pts) What is the output (if any) of the following Ruby program? Write FAIL if code does not execute. a = { } # Output = a[1] = “foo” puts a[0]
Background image of page 2
3. (18 pts) Regular expressions & finite automata a. (5 pts) Give a DFA that is equivalent to the regular expression a*b*c.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the 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 / 11

final-spr10 - CMSC330 Spring 2010 Final Exam Name Do not...

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

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