prac6-fall09

prac6-fall09 - CMSC330 Fall 2009 Practice Problems 6 1...

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

View Full Document Right Arrow Icon
CMSC330 Fall 2009 Practice Problems 6 1. Programming languages a. Describe how functional programming may be used to simulate OOP. b. Describe the difference between OCaml modules and Java classes. c. Describe the difference between strong and weak typing. d. Explain how call-by-name simplifies implementing lazy evaluation. e. Describe the difference between an L-value and an R-value. f. What is an activation record (frame), and why is it usually allocated on a stack? 2. Function arguments For each code, explain whether g is an upward or downward funarg. a. let f x = let g y = x + y in let app a b = a b in app g 1 ;; b. let f x = let g y = x + y in g ;; 3. Static vs. Dynamic Scoping Consider the following OCaml code. let a = 1 ;; let f = fun ( ) -> a ;; let a = 2 ;; f ( );; a. What value is returned by the invocation of f( ) with static scoping? Explain. b. What value is returned by the invocation of f( ) with dynamic scoping? Explain. Consider the following OCaml code.
Background image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

prac6-fall09 - CMSC330 Fall 2009 Practice Problems 6 1...

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