

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


The final exam is cumulative, covering topics from the entire semester. These questions mainly cover topics since the 2nd midterm. Look at the two midterms and their practice exams for questions on topics covered earlier in the course.
(a) Pre: p is not already registered, Post: p is registered and t is a Ticket for p (b) Pre: p is not already registered, Post: (returns normally, p is registered and t is a Ticket for p) or (throws SoldOutException) Exception) (c) Pre: true, Post: (returns normally, p is registered and t is a FirstClassTicket for p) or (throws AlreadyRegisteredException) Ticket for p) AlreadyRegisteredException) SoldOutEx- ception) (d) Pre: Event not sold out, Post: (returns normally, p is registered and t is a Ticket for p) or (throws AlreadyRegisteredException)
Assume that fa returns to f with pre and post conditions given in a, etc. Note that FirstClassTicket is a subtype of Ticket, and that AlreadyRegisteredException and SoldOutException do not have a subtype relationship.
(a) What is the QueryInterface function, and how does it typically work? (b) What are the security implications of declaring that a Java class implements Serializable? (c) How is Leasing used in distributed systems, and why is it useful? (d) Give an example where the Singleton design pattern would be useful.
where Point has interface:
interface Point { int getX(); int getY(); void setX(int); void setY(int); }
Include functions that allow other Beans to register as listeners on bound properties, and make the color and visible properties bound so that they trigger events in listeners.
interface Visitor { visitA(A a); // This method should be called on all A nodes visitB(B b); // This method should be called on all B nodes }
abstract Class Node { static void visitAll(Set s, Visitor v) { for(Iterator i = s.iterator(); i.hasNext(); ) { Node n = (Node) i.next(); // fill in here } } // fill in here }
Class A extends Node { // fill in here } Class B extends Node { // fill in here }