Homework Assignment 4

Submission Instructins

Answer all of the following questions using either a word processor or text editor and submit your homework as either a pdf file or an ascii text file. Use the submission script to submit your assignment.


  1. Explain the distinction between compilation and interpretation. What are the comparative advantages and disadvantages of the two approaches?

  2. What is the difference between a compiler and a preprocessor?

  3. List the principal phases of compilation, and describe the work performed by each phase.

  4. What distinguishes the front end of a compiler from the back end?

  5. In C++, how can I inherit a class's implementation without inheriting its interface?

  6. These questions all concern types:

    1. What is a type?
    2. What is a subtype?
    3. What is the relationship between an interface and a type?
    4. What is the relationship between a class and a type?
    5. What is the relationship between a subclass and a type?

  7. What is the difference between replicated inheritance and shared inheritance. What is the default type of inheritance in C++?

  8. What is polymorphism? As discussed in class, what is the difference between inheritance polymorphism and parametric polymorphism?

  9. Write regular expressions to describe the following set of tokens. Please use the notation used in class, although if you have used Perl, it is acceptable to use \d to represent the digits 0-9.

    1. Calendar dates of the form mm/dd/yyyy. Months and days may be either 1 or 2 digits. Years must be four digits. Do not worry about out-of-range dates such as 24/88/3005.

    2. Html header tags that start with h1, h2, or h3, then have a header with letters, numbers, blank spaces, and dashes, and end with a /h1, /h2, or /h3. For example <h2>Super Bowl-41</h2> is a valid header but <h2>Super Bowl-41</h3> is not because of the non-matching header tags and <h2>Super Bowl: 41</h2> is not because of the :.

    3. Scott #2.1c

    4. Scott #2.1f