m2-fall10 - CMSC330 Fall 2010 Midterm #2 Name Discussion...

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

View Full Document Right Arrow Icon
CMSC330 Fall 2010 Midterm #2 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 75 minutes to take this midterm. This exam has a total of 100 points, so allocate 45 seconds for each 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 2-3 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. You are not allowed to use any OCaml library functions unless otherwise noted . Problem Score 1 OCaml types & type Inference /22 2 OCaml programming /12 3 OCaml higher order & anonymous functions /12 4 OCaml polymorphic datatypes /14 5 Context free grammars /22 6 Parsing /18 Total /100
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. (22 pts) OCaml Types and Type Inference Give the type of the following OCaml expressions a. (2 pts) fun x y -> [x + y] Type = b. (3 pts) fun x y -> [x ; y] Type = c. (3 pts) fun x y -> [x y] Type = Write an OCaml expression with the following type d. (2 pts) bool -> int Code = e. (3 pts) bool -> int -> int Code = f. (3 pts) (bool -> int) -> int Code = Give the value of the following OCaml expressions. If an error exists, describe it
Background image of page 2
Image of page 3
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 / 7

m2-fall10 - CMSC330 Fall 2010 Midterm #2 Name Discussion...

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

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