CSE 130: Principles of Programming Languages
Midterm Examination, 15 February 2005

You should write answers in a blue book, but this paper could be used if you do not have a blue book.
Be sure to write your name on every sheet you hand in!
  1. [18pts] After each phrase write the letter of the definition that most closely matches its meaning in this course.

    phrase answer definition
    1. postcondition   a. determine sizes for storage needed
    2. precedence   b. determine locations for storage
    3. coercion   c. declaration of a variable
    4. activation   d. variable with undefined value
    5. dangling pointer   e. invisible type conversion
    6. dereference   f. subtype relationship
    7. lexical scope   g. structure with multiple layouts
    8. dynamic binding   h. storage that is no longer needed
    9. overloading   i. compile time name binding
        j. run time name binding
        k. find the value in a cell
        l. find the pointer to a cell
        m. operation with multiple meanings
        n. code that does not work
        o. property true after execution
        p. operation argument binding strength
        q. change the value of a variable
        r. variable with multiple meanings

  2. [9pts] What is an activation tree? What good is it? Give an example.
  3. [19pts] Apply tail recursion elimination to the following Pascal program: function f(n: integer): integer; begin if n = 0 then f := 1 else f := n * f(n - 1) end;
  4. [14pts] Match each name in the first list with the name or names in the second list that best fit it.
  5. [10pts] Explain why coercions are appropriate for the original intended applications of C but less so for those of FORTRAN.
  6. [10pts] What is the scope of each of the three quantifiers in the following formula?
       (∀ x)((∃ y) x < y) ∧ ((∃ y) y < x)
    Are these scopes lexical? Explain why or why not.
  7. [10pts] Express the formula of problem 6. using postfix notation, and also using prefix notation. Explain why these can be done without parentheses.
  8. [10pts] Define "strong type system", give an example type system that is not strong, and an expression that is not type safe in that system.

To CSE 130 homepage
Maintained by Joseph Goguen
© 2005 Joseph Goguen