CS 3304 Homework #4

Date Assigned: October 1, 2003
Date Due: October 8, 2003, in class, before class starts
  1. (10 points) Pascal implements a form of discriminated union using variant records. Write a program to test whether the FreePascal compiler actually tests the discriminant of a variant record when a variant field is accessed. Report your observations.

  2. (10 points) Write sample C programs to determine which form of type equivalence (structural equivalence or declaration equivalence or name equivalence) this language uses for

    1. arrays
    2. pointers
    3. structs
    4. unions

    Explain your observations.

  3. (10 points) Create an expression that will give different results between evaluation in applicative-order and evaluation in normal-order. Then write sample code in suitably selected languages to show how they produce different answers. You have to choose the languages yourself to make your point. For full credit, show the expression and the sample codes that you have written.

  4. (10 points) Problem 13 of Chapter 7 of your textbook.

  5. (10 points) Identify all the operators in the C language that associate from right to left.


Return Home