University of Toronto

Faculty of Arts and Science








Duration 2 hours


Examination Aids: books and notes




Total Marks: 100

CHECK YOUR EXAMINATION PAPER. Questions are printed on both sides of the sheets. There are 2 pages on this exam including this cover page.

Answer all questions in the EXAMINATION BOOKS provided. All answers in the books must be numbered to correspond with their question.

1.      [30 marks] Give UML and a written explanation of a design for a program that will read in a list of numbers from the standard output, storing them in memory, and then apply one or more arithmetic functions to this set of numbers (examples are count, sum, sum of squares, product, average, and so on). These functions must be dynamically loadable by the user. Include as many patterns as you can reasonably use, making explicit reference to them. Include class diagrams, and some form of collaboration diagram. Give method names and class attributes. Describe each class you include. DO NOT GIVE ANY CODE.

2.      [30 marks] Write a program in Java that reads in a sequence of pages, composed of lines of text, in turn composed of blank-separated words. Assume a new page occurs every P lines. Words within a line are separated by whitespace. Use the Composite pattern to store the information. Use the Flyweight pattern to ensure you never allocate storage for the same word more than once. Implement a substitute function that can substitute one word for another everywhere in the document. Provide a UML class diagram as the only design documentation (no explanations are necessary). GIVE THE JAVA CODE.

3.      [15 marks] Discuss the issue of whether distributed systems necessarily have cleaner architectures than monolithic systems.

4.      [15 marks] When would you prefer a simple client/server RDBMS architecture to a 3-tiered architecture (accessing an RDBMS) and vice-versa?

5.      [10 marks] What is the difference between plain Java Beans and Enterprise Java Beans? Describe both.


Total Marks = (100).