The CS 203 questions may require familiarity with the primary languages listed here, sufficient to write and understand small code fragments, but not necessarily to know technicalities of syntax or obscure features:
C Lisp (Scheme)
C++
Perl
Pascal
ML
Java
Algol60
Fortran
Prolog
Ada
DUE NEXT TUESDAY JUNE 2, 1998
(10) What is ``lvalue'' and ``rvalue''? 1 sentence each. In the declaration: int i=7, *p = &i; what is i's lvalue and rvalue?
(25) Define the term ``overloading''. 2 or 3 sentences.
Using C++ implement an ADT for type ``rational'', using the appropriate constructs of the language. Recall that a rational number is a ratio of two integers.
You need to declare correctly the standard binary arithmetic functions of addition, subtraction, multiplication and division on rationals, as well as provide a means of converting an integer to a rational.
1-2 pages of code.
(25) Define in one or two sentences the following concepts, show an example, and give a programming language that has the feature:
Opaque Type
Strong Typing
Lexical Scope
Unification or Pattern Matching
Lazy Evaluation
Type Inference
(25) What are three important PL design objectives? Discuss their importance. For each objective, give a different PL that treats the objective as crucial. Explain why that PL has the objective.
For each objective, give a different PL that largely ignores it. For full credit, mention three different languages. Explain why the PL largely ignores the objective.
(15) Define exceptions. Show how exceptions can be treated in programming. Give a typical example of a hardware exception and its treatment. Give a typical example of a software exception and its treatment.