View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Final Exam Review - Spring 2002

The final will be cumulative, but with a strong focus on material in the second half of the class. Below are questions that are similar to the ones that will appear.

I expect the final exam in Spring 2002 CS2340 to be 6-8 questions like each of the below. Some of the questions below are from actual final exams in 2390 and 2340. I recommend working together to figure out the solutions. I will check up on the discussions, but I won't provide answers where no questions are posted. Mark Guzdial

Table of Contents
Explain the Design Methodology Segway Palm
Sensor Management System Helping the Gaming Industry
Language Choices Cellular Web-browser
Virtual Machines Optimizing Collections
Serialization eXtreme Programming
Re-designing a Networked Computer Game Tools for Space Scientists
Designing Networked Games Transposing a Dictionary
MVC vs. Morphic HCI Design
Tradeoffs Design Patterns
Multimedia Programming in Squeak Whiz-O Toys
Design an Alarm System

Explain the Design Methodology

You are working with a group that's trying to decide between a variety of different object-oriented methodologies. For each of their issues below, tell them a few options.

Post comments, discussion, answers at Sp02 Final Exam Review: Explain the Design Methodology.

Designing the Segway Palm

Palm has just announced a new kind of handheld device designed specifically for attaching to the new Segway (previously ``Ginger'' and ``IT'') Personal Transportation device - a kind of scooter for urban commuters. The new SegPilot will feature a map with GPS (``Global Positioning System'') for finding your way around town, an MP3 player and FM radio, a cellphone, and a Zagat's guide to the restauraunts around town, as well as the traditional appointment book, to-do list, and phonebook functions.

Palm wants some of these features to interoperate. For example:

  1. (10) Draw a UML class diagram for the interactions between Maps, Locations, the address book, and the Zagat's guide, including any additional objects you think are necessary. You must account for all of the functionality described in this problem, but you needn't add any other (e.g., you don't have to handle the address book user interface). You do need to show attributes and services that would be necessary to implement the given functionality. Describe briefly what each of your services would do.

  2. (6) Identify one design pattern that would be useful in this problem. Explain how it would be useful, and identify specific classes that you would use in a design for this problem that would correspond to the design pattern participant objects.

  3. (10) Palm is using Squeak to implement the SegPilot. Imagine that you have an ordered collection errands of Location objects that represent places to which you have to run errands. You have a Map gridMap on which all the Locations appear. You are to write workspace code:

    1. To tell gridMap to highlightFor each of these Locations, and

    2. To ask each of the errands locations for its streetname (assume given, returns a string with the name of the street). For each street containing more than one errand location, print to the Transcript a message announcing ``There is more than one errand on street: '' with the street name.

Post comments, discussion, answers at Sp02 Final Exam Review: Segway Palm Pilot.

Programming A Sensor Management System

You are building a new kind of sensor management system. Your system is going to be accepting a continuous stream of data which will be the merged data from many sensors. Your application must make appropriate sense of it. Your stream will be a series of two byte integers (i.e., in the range of 0-65536), which you will read using next off the stream accessed by the global variable SensorStream. That is, SensorStream next will always return an integer between 0 and 65536. Answers can be written below or on the back.

a. The integer value 0 will actually be a flag value indicating a Character Display Message. A reading of 0 is telling you that the next two readings are to be interpreted as an X and Y value and the third reading will be the ASCII value for a character. So, the readings 0 10 100 65 would tell you to put an ASCII capital A at the position 10, 100 on the screen. Write the Squeak code to read the first 100 readings off of SensorStream and process any Character Display Messagescontained in those readings. (Hint: Character value: returns a character for a given ASCII value, Strings understand the message displayAt: which takes a Point.)

b. Some key events require you to correlate readings from multiple sensors. For example, a sound sensor gets triggered with random noise, but if the sound sensor gets triggered multiple times and the motion sensor in the same room gets

triggered, that indicates an alarm must be thrown. Readings in the range of 1-255 indicate that the corresponding sound sensor has gone off. Readings in the range of 256-511 indicate that the corresponding motion sensor has gone off. For example, a value of 1 indicates that sound sensor 1 has been triggered, and a value of 256 indicates that motion sensor 1 has been triggered.

Write code to read 100 values off SensorStream. If values between 1 and 255 come in, record the value and the number of times that that value has appeared (e.g., "5 appeared three times"). If a value between 256 and 511 comes in, put up "ALARM!" in a notifier if the corresponding sound sensor has gone off more than three times. (Hint: Object understands inform: that takes a string, then pops up a notifer with the string.) Besides writing the code, also tell me which data structure you used for recording and quickly finding the values and why you made that choice.

Post comments, discussion, answers at Sp02 Final Exam Review: Sensor Management System.

Helping the Video Game Industry

Given your experience with designing and implementing epic adventure games, you have been hired as a consultant to Electronic Arts as they develop their response to the Myst series of adventure games.

Post comments, discussion, answers at Sp02 Final Exam Review: Helping the Video Game Industry.

Language Choices

For each of the below applications, you are to pick the object-oriented language of your choice for implementing the application (e.g., Smalltalk in general, Squeak in specific, Java, C++, Eiffel, etc.) and provide your rationale! We don't have a right answer in mind for each of these, but we are looking for true, reasonable statements in your rationale. (E.g., ``I'm going to pick C++ because it gives me the most robust implementation'' would be a bad answer.)

A. You're building a claims-entry system for a large insurance firm. You're not using the Web because you're using your own proprietary secure networking protocol. You have to run on whatever platform the insurance agent may purchase. New claims forms are defined by the company fairly frequently-usually several a month. This requires new GUI forms and new processing code to be implemented for each new form.
B. You're building a new adventure game based on the movie Shrek to run only on Windows boxes with hardware acceleration. You're going to be distributing the code on CD. You'll have a small, hand-picked group of developers who are expert in your language of choice. There is intense pressure to have the game out by summer's end, so you only have a month or two to implement the complete game.
C. The Bell operating companies have decided to finally rewrite TIRKS, the massive multi-million line database system that keeps track of all the phone lines in the country, including keeping track of change records, etc. TIRKS is currently written in PL/1 and System 360 assembler. This rewrite is a huge investment, and it's not expected to be rewritten again for another 30 years-but it must be maintained. It's going to be done in an object-oriented language with a team of hundreds of programmers.
D. You're building an MPEG library for a set-top box. MPEG decoding, of course, is a numeric code that is very compute intensive. The library will be burned into ROM and executed from an embedded ARM processor running only a single application. You expect to sell millions of these boxes, and the library is expected to change very, very little, if at all, after it's finished, since the MPEG spec is cast in stone.
E. You're building a distributed Doom-like game, intended to support players on home PCs and Macs, that tie into a central server over the internet (possibly via a slow link, like a phone line). The game requires heavy, compute-intensive 3D rendering. Players are allowed to define their own characters and weapons; the 3D models and behavioral code for these entities are uploaded to a central server. Instead of running the behavioral code and rendering the models on the central server, they are broadcast to all the other players' computers, where they are executed locally. This allows for crisp interaction over slow communications links-when Felicia fires her laser blaster at George, the laser-gun simulation runs and renders locally on George's computer.
F. You need to choose a language & language implementation to allow people to define the programed behaviors for game characters and weapons-i.e., the bits of code that get shipped around between players.

Post comments, discussion, answers at Sp02 Final Exam Review: Language Choices.

Cellular Web-browser

You're designing a web crawler for a new cellular-phone service that's going to offer wireless Internet access. The key features that you need your web crawler to provide:

You begin your design, and you make several decisions about your classes:

The CEO is betting the entire company on this new application. Once he discovers you've had CS2340, he instantly promotes you to chief architect of the system. Here are your immediate tasks:

(15 points) Draw a class diagram for the classes CFHserver, BCObject, BCMLObject, BCIObject, and URLdatabase.
(10 points) Identify at least one other UML diagram (your choice which one!) that would be useful in describing how this design would work. Describe the UML diagram you have chosen, why you have chosen it, and what it would show that the class diagram does not.
(10 points) Imagine that you are now actually implementing this design. Your CFHserver will be sent the message store:forURLs: which will take two arguments: An ordered collection of BCMLObject and BCIObject objects, and a matching ordered collection of Strings containing the URLs for the HTML/GIF/whatever matching documents. You want to store these into the database of the server. You may use any of the methods described above.

Write the Squeak method store:forURLs: for CFHserver.

Post comments, discussion, answers at Sp02 Final Exam Review: Cellular Web-browser.

Virtual Machines

Post comments, discussion, answers at Sp02 Final Exam Review: Virtual Machines.

Optimization: Collection Differences

a. Identify a use where Arrays are the best choice, where Bags are the best choice, and where Dictionaries are the best choice.

b. For figuring out if an element is in the Collection, Sets are much, MUCH faster than Arrays. Why?

c. When are OrderedCollections much slower than Arrays? When are OrderedCollections almost the same speed as Arrays? What causes OrderedCollections to be slower?

Post comments, discussion, answers at Sp02 Final Exam Review: Collection Differences.

The Issues of Serialization

Post comments, discussion, answers at Sp02 Final Exam Review: Issues of Serialization

eXtreme Programming

You're advising a team of developers who are considering adopting XP. Being an expert on XP, please answer their questions.

  1. "XP programmers don't document their code!?! How can their code still be readable after they write it?"

  1. "What in the world do they mean that code written by an individual has to be thrown away? What other kind of code is there?"

  1. "Integrating daily sounds like we'll spend all our time in integration. How can we make daily integration work more smoothly?"

  1. "Is there any evidence that this really works?"

Post comments, discussion, answers at Sp02 Final Exam Review: XP

Re-designing a Networked Computer Game

Mattel finds that Barbie software has become so wonderfully successful, as has first-person role-playing games, that they've merged these to produce a new title: Barbie's First Cocktail Party. But they've run into lots of problems. You've been hired as a consultant to help sort it all out for them.

a. "We're downloading 3-D models of Barbie and all her guests, and it's taking a horrendously long time. Is there anything that we can do to reduce that time?"

b. "Cross-platform is very important to us, but someone in upper management suggested we go with Visual Basic. And Bill Gates isn't returning our calls about producing Linux and Macintosh versions of VB. What do you recommend that we use, and what argument should we provide to upper management for it?"

c. "We've heard about this UML stuff for our design notations, and it sounds great. We know all about UML class diagrams. What's another UML diagram that you think is good? What's it good for?"

Post comments, discussion, answers at Sp02 Final Exam Review: Networked Barbie Game

Tools for Space Scientists

You are going to be designing a suite of tools for space scientists. Your scientists are going to need to work with three kinds of documents:

a. Explain how one (your choice which one) Design Pattern would be useful in building this application. Draw a UML class diagram of the portion of your design where the design pattern would be useful. (Note: You are not drawing the whole class diagram, nor are you showing me the structure of the Design Pattern. Rather, you are showing me a few classes in your application whose design would be based on the Design Pattern you've selected.)

b. The Space Scientists think this object-oriented stuff is just silly. "Fortran was good enough for my advisor and for me and for my students," they say. "Why not just use that?" What are the advantages of object-oriented design and programming for this problem?

Post comments, discussion, answers at Sp02 Final Exam Review: Tools for Space Scientists

Designing Networked Games

You are responsible for design and development of a new video game based on the Rugrats cartoon series on Nickelodeon. The video game will allow players to take on the roles of Tommy, Chuckie, Angelica, Phil, and Lil, and then interact to work through puzzles. The players will sit all over the network, and it's desirable to be entirely cross-platform. You must make several technical decisions up front.

a. Do you use a virtual machine? Why or why not?

b. How do you want to transmit the images of Tommy, Chuckie, and the rest? Some of your teams want to send around 3-D models of them, and others want to use Flash. What do you think and why?

c. There will be need for various kind of audio in this game: Background music based on the cartoon, recordings of the voices. What formats do you think you would want to use and why?

Post comments, discussion, answers at Sp02 Final Exam Review: Design Networked Games

Transposing a Dictionary

Imagine that you have a dictionary that looks like this:

Key Value
Fred Wilma
Barney Betty
George Martha
Ozzie Harriet

And you want to create the transpose of the dictionary so that it looks like this:

Key Value
Wilma Fred
Betty Barney
Martha George
Harriet Ozzie

Do it. Can you do it in one line of code? In how few lines of code if you need more than one?

Post comments, discussion, answers at Sp02 Final Exam Review: Transposing a Dictionary

MVC vs. Morphic

a. Name an application where MVC is preferable to Morphic.

b. Name an application where Morphic is preferable to MVC.

c. Identify three major design differences between Morphic and MVC.

d. Can you use the MVC Paradigm in Morphic? Why or why not?

e. Name at least one commercial UI package today that is based on the MVC paradigm.

Post comments, discussion, answers at Sp02 Final Exam Review: MVC vs. Morphic

HCI Design

A company has just designed a user interface that was an utter disaster. You have been brought in as an HCI consultant to explain what they did wrong. For each of the below quotes from the companies engineers, respond and explain what they should have done.

a. "We used it ourselves for over a week! We really loved it! I can't understand why we're getting all these nasty letters from our users!"

b. "We wanted to save on screen real estate so we used 9 point text throughout the user interface. Well, now it turns out that all these Senior Citizens homes bought our software. Did you know that older folks have trouble with reading smaller text?"

c. "All of us felt that OK and Cancel buttons in the lower right hand corner were boring. So instead, if you click at the top of the dialog box, it closes as if you did 'OK,' and if you click at the bottom, it closes as if you clicked 'Cancel.' What's that? No, we didn't use any labels – they would just take up screen real estate."

Post comments, discussion, answers at Sp02 Final Exam Review: HCI Design


A. What are the strengths and weaknesses of the Model-View-Controller structure for user interfaces? Give me an example of an application where MVC would really help, and another where MVC wouldn't help.

B. What are the strengths and weaknesses of an object-oriented approach? Give me an example of a project where using OOA/D/P is the right idea, and an example where it's a bad idea.

C. What are the strengths and weaknesses of Squeak vs. Java? Give me an example where using Squeak is a good idea and one where it's a bad idea, and one where Java is a good idea and one where it's a bad idea.

Post comments, discussion, answers at Sp02 Final Exam Review: Tradeoffs

Design Patterns

a. Factory Method and Abstract Factory design patterns are quite similar. How are they similar and how are they different?

b. How are the Adapter and Bridge patterns similar and different?

Post comments, discussion, answers at Sp02 Final Exam Review: Design Patterns

Multimedia Programming in Squeak

Recall that you can play three notes in Squeak like this:

(AbstractSound noteSequenceOn:
    (FMSound soundNamed: 'brass1')
    from: #((c4 1.0 500) (d4 1.0 500) (e4 1.0 5000))) play
    "Triplet are note, duration, and volume"
(a) Recall, too, how to move a Pen, from wherever the Pen appears when first created.

Write the Squeak code to draw a box, where you play C in the fourth octave during the first line, D in the second, E in the third, and F in the fourth – as a clarinet.

(b) Recall that moving a Morph involves setting its bounds: to a new rectangle. Recall that you change the color of a Morph with a color: command.

Write the Squeak code to move a red EllipseMorph. Start it at 0,0 and play C; then go to 0,100 and play a D; then go to 100,100 and play an E; and finally go to 100,0 and play an F.

Post comments, discussion, answers at Sp02 Final Exam Review: Multimedia Programming in Squeak

Whiz-O Toys

You are a consultant to the WhizO Toy Company ("Makers of toys for tots of all ages"). WhizO is considering a shift to an object-oriented software development process. If they do make such a shift, you're in for big bucks as the consultant who leads the way. First step is to respond to the specific concerns of the Manager of their Software Development unit:

Post comments, discussion, answers at Sp02 Final Exam Review: Whiz-O Toys

Design an Alarm System

Design an alarm system for installation in homes or businesses. You may assume that someone else is creating sensors and the mechanism to trigger alarms. You have to create the software to respond to alarms and to alert authorities.

Draw the UML class diagram for this class structure. (You don't have to add more features than what's described.) Note: Partial credit will be given, so err on the side of too much, not too little. In your analysis, be sure to address:

Note! This is an important one!

Displaying the Current Status. You must now provide an interface for your alarms: An AlarmStatusView that shows that status (triggered by a sensor or still waiting) of each alarm.

How do you implement View/Model communication? How would you change your Alarm class(es) to implement this feature? Be sure to tell me (a) how the AlarmStatusView finds out an alarm being triggered and (b) how it finds the vicinity of the triggered alarm to display.

Post comments, discussion, answers at Sp02 Final Exam Review: Displaying Alarm Status

Links to this Page