






Hotspots: Admin Pages | Turn-in Site |
Current Links: Case Final Project Summer 2007
Final Exam Review - Fall2001
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 Fall 2001 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
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 Fall01 Final Exam Review: Sensor Management System.
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 Fall01 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 have to follow links breadth-first from a list of
most-popular sites that marketing is going to provide you, to a depth
of 5 clicks from the top.
- As you find these pages, you need to convert them into
your company's BCML (Bizarre Cellphone Markup Language), and convert
all GIF, JPEG, PNG, and BMP images into the BCI (Bizarre Cellphone
Image) format.
- All documents should be stored into the database of the
``cellphone faux HTTP server'' that will serve the
appropriate BCML or BCI document for a given URL. This
server sits at the phone company, and ships web documents
(translated into BCML and BCI format) out
to cellphones in response to URL requests.
You begin your design, and you make several decisions about your
classes:
- You want a class named CFHserver (Cellphone
Faux HTTP server). An instance will handle the
store:forURLs: message (defined in detail below),
and produce a document when sent the
forURL: message. A CFHserver will also know its
urlDatabase.
- A class named BCObject will be an abstract superclass,
and its concrete subclasses will be BCMLObject and
BCIObject. All BCObjects will know how to
displayOn: a given Canvas. They will also respond
to isBCML and isImage.
- You want the URLdatabase to understand the messages
storeDocument:forURL: for BCML documents and
storeImage:forURL: for BCI documents. The instances of
URLdatabase will know its current file and
index.
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 Fall01 Final Exam Review: Cellular Web-browser.
Virtual Machines
- Give three reasons that one might use a virtual machine instead of a compiler to machine code.
- Give three good and frequent reasons that one might add a primitive to a VM.
- What takes up the majority of time and effort in a VM (typically)?
- Why are VMs so often stack-based architectures? Why not have registers?
Post comments, discussion, answers at Fall01 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 Fall01 Final Exam Review: Collection Differences.
An Individual Communications Tool
You are part of a design team for a new Beeper-WebBrowser-CellPhone-GarageDoorOpener device. Help make these design decisions and provide rationale for them.
a. Your team has decided to use Squeak, but canít decide whether to use Morphic or MVC for the UI. Which would you recommend and why? (Remember: Concrete, arguable-to-management rationale.)
b. Your Marketing Department says that your device is going to be most useful to constantly traveling, over-worked, Suburban "Soccer Moms" (especially the feature of being able to open the garage door while talking on the phone). What should you do now, before your project starts designing the software or interface, to make sure that the interface is usable by your audience?
c. Your team finds that their code is a bit too slow in Squeak. Give them some suggestions for what they can do next. Your answer should include both (a) how to figure out where the slow parts are and (b) speeding up the slow parts. (Hint: Algorithm changes, constructing primitives, and even improving the VM are all available options to you.) But specificity counts! Why do you propose what you do?
Post comments, discussion, answers at Fall01 Final Exam Review: Individual Communications Tool
The Issues of Serialization
- Identify three challenges to the strategy adopted by Microsoft in their .NET Framework where objects will be serialized to XML and XML instances (defined through XML Schemas) can be compiled to objects.
- What are XML schemas? How are they like and unlike class definitions?
- What's the argument that XML "instances" aren't really objects?
Post comments, discussion, answers at Fall01 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.
- "XP programmers don't document their code!?! How can their code still be readable after they write it?"
- "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?"
- "Integrating daily sounds like we'll spend all our time in integration. How can we make daily integration work more smoothly?"
- "Is there any evidence that this really works?"
Post comments, discussion, answers at Fall01 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 download the 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:
- Data Collection Documents: Containing live satellite data in a form appropriate for doing numeric calculations with.
- Data Visualization Documents: Does 2-D and 3-D graphs of satellite data linked to it.
- Data Planning Documents: For organizing modules both on the satellite and off for gathering and processing sensor data.
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 Fall01 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 Fall01 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 Fall01 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.
Post comments, discussion, answers at Fall01 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 Fall01 Final Exam Review: HCI Design
Tradeoffs
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 Fall01 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 Fall01 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 Fall01 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:
- "We usually have multiple teams of developers working on different parts of the programs at once. How does object-orientation help us with that?"
- "We rely heavily on simulation when developing sophisticated toys. What would be absolutely perfect would be if we could take parts of our simulation and use it in the code for the real toy. Can we do that? How?"
- "What happens if we develop add-ons for a toy, like a new Laser Gun for our Omega Video Game System? Or if we develop a new variation on a toy, like the Phaser Range Finder Gun (which is like the Laser Gun)? Can O-O help our productivity in doing this?"
Post comments, discussion, answers at Fall01 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.
- For any kind of alarm, you need to send all the alerts necessary for a given alarm. For example, for all fire alarms, the fire department is always called. The head of the house or business is always called for all alarm, and one or more "local experts" might also be called. For example, if there is a fire or intruder in the warehouse, the warehouse manager should also be called.
- You need to respond to Intruders by sounding the audio alarm in the vicinity. Assume that you just send the message trigger to the audio alarm object and it will sound.
- You need to respond to Fire by triggering the sprinklers in the vicinity, if available. Assume that you just send the message trigger to the sprinklers object.
- Your system is pretty sophisticated with respect to alerting authorities. It can handle IP or phone messaging. You can assume that the messaging is handled by another piece of the system. You need to provide the address of the authority (i.e., either a phone number or an email address) and the message to be sent (which should include, for example, the kind of alarm and the alarm vicinity).
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:
- What classes do you need? What service do each need to provide? What attributes do each need to know?
- Where are there generalization-specialization relationships? Where are there part-whole relationships?
Post comments, discussion, answers at Fall01 Final Exam Review: Design an Alarm System
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 Fall01 Final Exam Review: Displaying Alarm Status
Links to this Page