CS 3723/3721, Fall 2004
Programming Languages
Review for Final
(Exam is Monday, 9 May 2005
1:30 - 4:15 pm)
|
Overview:
The final exam will be comprehensive, but will emphasize topics since the
mid-term exam. The most important items below are the Lisp and Postscript
and the Ruby:
you should know more about them than about Prolog.
The final will be worth about 50% more than the mid-term.
Spring 2005 Mid-term Review and Exam:
Review,
Exam,
Answers.
Main Additional Topics
Since the Mid-term, Based on Recitations:
- Generic constructs in C, C++, and Java
Genericity:
- Rec 9: 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).
- The Lisp Language (2 recitations)
Lisp basics:
- Rec 10: Lisp
Basics.
- Rec 11: Lisp
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 basics:
- Rec 12: Initial
Postscript Program.
- Rec 13: Postscript
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 Ruby Language
Ruby basics:
- Rec 14: Ruby
basics.
- What you should know:
- See the start of Recitation 14 above for material you
should know.
- The Prolog Language
Prolog basics:
- (No 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 write-up about Prolog basics:
db_design.html.
Most Important Topics and
Sample Questions:
- See the previous mid-term and final exams for sample questions,
sometimes with answers (though
be aware that this exam may be considerably different, even
covering some different topics):
- All the above topics are important, but there is emphasis
on:
- Genericity.
- Especially the use of the
Comparable interface to get genericity
in Java.
- Lisp.
- Write a simple recursive function in Lisp.
- Possible other question about Lisp, covering perhaps
Lisp recursive evaluation or Lisp internal representation
(and dotted pairs).
- Postscript.
- Basics, including paths, coordinate
transformations, right justifying (or centering) text.
- Perhaps give you a Postscript program or code fragment
and ask questions about it.
- Ruby.
- Basics of Ruby classes.
- Object-oriented version of regular expressions in Ruby.
- See the beginning of the
ruby recitation
for what to study.
- Prolog.
- Earlier parts of the course:
- Especially grammars, parsers, and syntax-directed
translation.
Revision date: 2005-05-03.
(Please use ISO
8601, the International Standard.)