DOC PREVIEW
UMD CMSC 330 - Quiz #3

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CMSC330 Spring 2011 Quiz #3 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. • This is a closed book exam. No notes or other aids are allowed. • For partial credit, show all of your work and clearly indicate your answers. • Write neatly. Credit cannot be given for illegible answers. 1. (12 pts) OCaml a. (4 pts) Give the type of the following OCaml expressions, or write “ERROR” if there is none. Here map refers to the standard curried list-processing function that was covered in class (and is also implemented in the List module). fun x y -> x (y+1) Type = map (fun x -> 2*x) Type = b. (2 pts) Write an OCaml expression (not a declaration!) with the following type (bool -> int) -> int Code = c. (6 pts) Write a function rmZeros that, given a list of integers, returns the same list except with all occurrences of 0 removed. For example, rmZeros [1;0;2;0] should return [1;2].2. (4 pts) Scope rules Consider the following OCaml declarations. let x = 0;; let f y = x;; The following questions refer to the expression let x = 1 in f x a. (2 pts) Under OCaml’s usual static scoping rules, what is the value of the expression? b. (2 pts) Now suppose OCaml uses dynamic scoping instead. What would the value of the expression


View Full Document

UMD CMSC 330 - Quiz #3

Documents in this Course
Exam #1

Exam #1

6 pages

Quiz #1

Quiz #1

2 pages

Midterm 2

Midterm 2

12 pages

Exam #2

Exam #2

7 pages

Ocaml

Ocaml

7 pages

Parsing

Parsing

38 pages

Threads

Threads

12 pages

Ruby

Ruby

7 pages

Threads

Threads

7 pages

Quiz #4

Quiz #4

2 pages

Exam #2

Exam #2

6 pages

Exam #1

Exam #1

6 pages

Threads

Threads

34 pages

Quiz #4

Quiz #4

2 pages

Threads

Threads

26 pages

Exam #2

Exam #2

9 pages

Exam #2

Exam #2

6 pages

Load more
Download Quiz #3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Quiz #3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Quiz #3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?