CSC 123/252 Study Guide for the Final Exam.
The final exam will mostly focus on the material covered after the midterm
but may include some questions on earlier subjects (especially concerning
static/dynamic scoping).
Writing code fragments in these languages will be required.
==Topics:
1. Generics (templates): use of 'object' versus generic types (like )
Covariance and Contravariance in C#/Java, including covariant arrays.
Differences in implementation of generics in Java, C# and C++
F# programming, including:
understanding how types are handled (polymorphic inference, static safety)
Discriminated union type definitions (as in type expr = |... |...)
pattern matching
writing some code fragments
Features will reflect those emphasized in class and used in ASSIGNMENTS
**Understand the relationship between F# pattern matching and dynamic
dispatch and the visitor design pattern.
** Understand how simulated dynamic scoping was used in the implementation
of 'advice'.
Rust and Related Topics
Understand C++ unique_ptr, shared_ptr and weak_ptr. You don't have
to write code but you need to answer specific questions about their
use, as well as their limitations (how they compare to Rust).
Understand the Rust rules of ownership, lifetime, and borrowing, and
be able to write small Rust programs and answer questions about
Rust code.
Advanced Rust that involves lifetime parameters <'a> will not be
covered. Key Rust programs to study: wymk.rs, nicerust.rs (contains
expression trees and rust pattern matching), newlits.rs (linked lists
using Box smartpointers).
AOP/AspectJ programming (lightly): know what the central capabilities
of AspectJ are. You will not be required to write programs in AspectJ
but may be asked answer questions about AspectJ code.
Contrast AspectJ with attempts to implement AOP features in Perl,
F#. For example, how dynamic scoping is useful in simulating the
effects of advice on programs. What features are still missing in
these languages that AspectJ provides (extension methods, changing
types).
Another type of question on the exam will be to see if you understand
the relative tradeoffs between the languages. This topic was covered
extensively using the different EXPRESSION TREE PROGRAMS.
----------------------------------------------------------------------------
How to Study:
Do the sample problems here without looking at the answer.
Do NOT memorize definitions or simply learn the mechanics without
understanding their purpose.
Study previous programming assignments.
---- Sample questions to prepare for the final exam ----
Answers posted separately
1. Compare the following implementations of polymorphic linked lists:
class list
{
object head;
list tail;
}
class list
{
A head;
list tail;
}
What are the advantages of using one form instead of another?
2. Given the F# definition of a polymorphic linked list structure:
type 'a llist = NIL | Cons of ('a*'a llist);
What would be the closest equivalent definition in C#. Defend your answer.
3. Describe what will happen with the following C# segments of code, in terms
of any compiler errors, or runtime errors, and EXPLAIN WHY
// assume using System; an using System.Collections.Generic;
a. object[] A = new string[10];
A[0] = 1; // 1 is not a string but it's an object
b. List