CS 3723/3731 Programming Languages
Fall 2003 -- Review for Final Exam
Exam is Monday, 8 December 2003
The final exam will be comprehensive, but will emphasize topics since the
mid-term exam. The most important items below are the Lisp and the Postscript:
you should know much more about them than about Prolog.
The final will be worth about 50% more than the mid-term.
Previous review (for Mid-term):
Mid-term Review.
Main Additional Topics
Since the Mid-term, Based on Recitations:
- The Lisp Language (2 recitations):
- Lisp Rec 1:
Basics and Functions.
- Lisp Rec 2:
Functions and mapcar
- What you should know:
- Lisp S-expressions (definition).
- Lisp notation for use of functions (prefix, fully
parenthesized), that is, (+ (* 2 3) (/ 8 4)).
- Functions to work with Lisp lists: car,
and cdr to take lists apart and
cons to create lists or put lists together.
Also append and list.
- Basic (recursive) Lisp evaluation.:
Given a list to evaluate, separate off the car, which should
be a Lisp function. Then recursively evaluate each of
the following items in the list (those at the top level).
Finally evaluate function with those evaluated items as
its actual parameters.
- True (t) and false (nil
in Lisp, and predicates: functions that return
t or nil.
- Lisp's version of if-the-else: cond
and its syntax -- not evalutated the same way as an ordinary
Lisp S-expression. (The successive predicates in the
cond are evaluated in order until one
is found that returns t.)
- The syntax for Lisp function definition -- not evaluated
like an ordinary Lisp S-expression, but absorbed to provide
a new user-defined function.
- Understanding Lisp functions and writing simple recursive
Lisp functions.
- Simple uses of mapcar and apply.
- The internal representation of S-expressions in Lisp, using
Lisp cells: Which are just a pair of pointers, the
first to the car and the second to the cdr, except for atoms.
In case the cdr pointer is neither null nor a list, one gets a
dotted pair.
- The Postscript Language:
- Postscript
Rec 1: Basics.
- Postscript
Rec 2: Business Card.
- What you should know:
- The "basics" as listed under items 1 through 11 under
"Basic Topics (from the Blue Book)" in the writeup for the
first Postscript recitation
here.
(There is a lot of material here -- you only need a rough
understanding of all of it.)
- Specifics about the "Overlapping boxes" examples in the
above web page.
- Specifics from the "Practice with translate, rotate, and scale"
examples in the above web page.
- Other material from more complex examples and from your
business card.
- The Prolog Language:
- Prolog Recitation.
- What you should know:
- Specifics about Prolog facts, rules, and queries as
illustrated in the example:
Prolog knowledgebase example.
- Simple uses of Prolog in database management type
examples, as shown on the Prolog recitation:
here.
- structs in C (with discussions of C++ and Java):
- Practice with structs in C.
- What you should know:
- How a struct in C or a class in C++ is fundamentally
different from an array in C/C++/Java or from a class in Java,
since the name in these latter cases always is a reference
or pointer to the object, whereas the name of a struct in C
or a class in C++ gives the object itself. If one wants a pointer
here, one must explicitly declare the pointer.
- An assignment operator between two structs or classes in
C or C++ copies the contents of the struct or class.
- If one returns a struct or class in C or C++ from a
function, a copy is returned. Because of this, one usually
returns a pointer to a struct or class in C or C++
(which is the only possibility in Java: to return a reference
to a class).
- Generic constructs in C, C++, and Java:
- Generic Constructs.
- What you should know:
- How C++ uses the template feature to
achieve genericity (just the basic ideas and implications,
without details of the syntax of templates).
- How Java can handle an arbitrary Object
including code to print an object without knowing until
run time just what the object is (accomplished by including
a toString method in the class implementing
the object, if one is not already provided.
- How Java can use the Comparable type,
which is defined by any class that "implements Comparable" by
providing a compareTo method. The examples
showed how to handle any type with a compareTo
method, including String, the "wrapped"
classes Integer and Double
(which already have compareTo defined),
and any user-defined class with a compareTo
method (illustrated with the Rational type
in the example in the recitation).
Revision date: 2003-12-02.
(Please use ISO
8601, the International Standard.)