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 (when does dynamic
dispatch occur).
Writing code fragments in these languages will be required.
==Topics:
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, used in ASSIGNMENTS
**Understand the relationship between F# pattern matching and dynamic
dispatch and the visitor design pattern.
Rust:
Understand the rules of ownership, lifetime, and borrowing
Study the what-you-need-to-know program and be prepared to answer
questions about Rust programs (but you won't have to write Rust code).
AOP/AspectJ programming (lightly covered)
pointcut expressions (call/execute, etc...)
writing advice
intertype declarations and other technical features emphasized in class.
Understand AOP concepts/keywords including "advice", "cross-cutting",
"join point", "inter-type declarations", and "weaving"
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 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