Computer Science 3675
Section 001
Fall 2005
Practice questions for quiz 3

  1. Consider the following definition written in Astarte.

        Define f(?n) = (:n*n :: f(n+1):).
      
    What value does expression f(2) compute? Give the full value, as it would be if it were examined. (It suffices to give a clear description of the full value.) Evaluating a promise does not change the value that is represented, it only changes the representation of the value.

  2. What is the value of Scheme expression (car (cdr (cons 'horse (cons 'zebra ()))))?

  3. Write a Scheme function called prefix so that (prefix x y) returns true if list x is a prefix of list y. Be careful to use Scheme syntax correctly.

  4. Write a Scheme function called descending so that (descending L) is true for a list of numbers L if L is in descending order. (The Scheme function < does a less-than test, and > does a greater-than test.) List (a b c d) is in descending order if a > b > c > d. The empty list is in descending order by definition, as is a singleton list.

  5. What is the purpose of the static link in a frame in the run-time stack?

  6. What is the purpose of the dynamic link in a frame in the run-time stack?

  7. What information is stored in a function closure?