CSC 123/252 Study Guide for the Final Exam.
The final exam will focus on the material covered after the midterm
but may include some questions on earlier subjects.
There will be an emphasis on polymorphism in C#, and programming in
F# and AspectJ
Writing code fragments in these languages will be required.
==Topics:
Polymorphism: use of 'object' versus generic types (like ) in C#
Difference between C++ templates and Java/C# generics
Covariance and Contravariance in C#, including covariant arrays.
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.
AOP/AspectJ programming
pointcut expressions (call/execute,cflow, etc...)
writing advice
intertype declarations and other technical features emphasized in class.
Understand AOP keywords such as cross-cutting, weaving, join-points.
Don't just memorize the definitions. Understand their purpose.
One of the emphasis 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