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

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 Solutions 1. Programming languages a. Describe how functional programming may be used to simulate OOP. An object may be simulated as a tuple, where each element of the tuple is a closures representing a method for the object. b. Describe the difference between OCaml modules and Java classes. Both provide a public definition for a group of functions whose internal details are hidden, but Java classes can also instantiate objects and inherit attributes from other classes (not possible with OCaml modules). c. Describe the difference between strong and weak typing. Strong typing prevents types from being used interchangeably, weak typing allows types to be treated as other types through many implicit type conversions. d. Explain how call-by-name simplifies implementing lazy evaluation. Expressions to be evaluated lazily may be passed as arguments to functions, since function arguments are not evaluated until used. e. Describe the difference between an L-value and an R-value. L-values refer to the address of a symbol, R-values refer to the value for a symbol. f. What is an activation record (frame), and why is it usually allocated on a stack? An activation record contains state information for a function invocation.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
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 / 3

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

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