Typically, a final exam in 2390 is 4-6 questions like each of the below. Most of the questions below are from actual final exams in 2390. I recommend working together through the CaMILE links (FinExam Review Collaboration Space) to figure out the solutions. I will check up on the discussions, but I won't provide answers where no answers are posted.
Design You have been given the enviable task of designing the new "Jurassic Park: The Lost World" videogame. The studio is considering doing this new game in Smalltalk (Squeak, specifically) to be immediately portable to all platforms at once. They have a few questions for you, their ace Object-Oriented Consultant (Who Makes Really Big Bucks).
Post comments, discussion, answers in CaMILE at Design of Dino Game Collaboration Space
Languages
Post comments, discussion, answers in CaMILE at Languages Collaboration Space
Post comments, discussion, answers in CaMILE at Discrete vs. Continuous Collaboration Space
User Interfaces in VisualWorks Imagine that you have a class named Student with instance variables ssn containing a social security number, classes containing an ordered collection of strings with the names of the students' classes, and major containing a string naming the student's major. You are now working on the openOn: aStudent method for your view of Student.
view := TextView on: BLANK1
aspect: #BLANK2
change: #BLANK3
menu: nil.
view := SelectionInListView on: BLANK4
aspect: #BLANK5
change: #BLANK6
list: #BLANK7
menu: nil
initialSelection: #BLANK8.
Post comments, discussion, answers in CaMILE at User Interfaces in VisualWorks Collaboration Space
Fixing a C++ Class StructureConsider the below C++ class definitions: (You
can assume that a class library definition for String has been #include'd. Also, this is valid C++, even without the public/private/protected
keywords.)
class CrossingGuard : public EmpRec{
String _school;
String _crossStreet1;
String _crossStreet2;};
class PoliceOfficer : public EmpRec{
int _precinct;
float _salary;};
class MeterMaid : public PoliceOfficer{ float _hourly_wage;};
class EmpRec
{ String _lastname
String _firstname;
String _street;
String _city;
String _state;
String _zip;};

There are a couple of major flaws with this structure:
Below:
Post comments, discussion, answers in CaMILE at Fixing a C++ Class Structure Collaboration Space
Simulations You are building a simulation of a shipping port where boats are entering and leaving, docking at a given dock, unloading and re-loading cargo, and trucks are taking the cargo in and out of the port. The following components will be part of your simulation:
(12) (a) Of the following questions, which call for a discrete simulation and which call for a continuous simulation? And WHY?
(8) (b) For these questions, which of the following should be modelled as resources and which as simulation objects? And WHY?
Post comments, discussion, answers in CaMILE at Simulations Collaboration Space
Language ChoicesFor each of C++, Java, and Smalltalk, tell me:
Post comments, discussion, answers in CaMILE at Language Choices Collaboration Space
Short Answer
A. What does the virtual keyword do in C++? Why don't we
have one in Smalltalk or Java?
B. Characterize Smalltalk's inheritance mechanisms in terms of
C++'s public, private, and protected. Is anything
private in Smalltalk? How about public? Protected?
C. What is a bytecode compiler and a virtual machine (as used
in Smalltalk and Java implementations)? What is the advantage
of this approach? What is the disadvantage?
D. What is polymorphism? (Hint: printstring and inspect
are both polymorphic.)
E. What is the sequence of messages between a model and its view
(use Count as an example) when the model executes a self changed: #value message? (Hint: Model sends one to view, view sends
one to model)
Post comments, discussion, answers in CaMILE at Short Answer Collaboration Space
LinkedList: You are working on a project using Smalltalk where you need linked lists, but you've decided that you don't like the implementation of linked lists provided in the Smalltalk image. You decide to implement your own class MyLinkedList. You need the following functions in your implementation:
isEmpty returns true if the receiver list is
empty
isEqual: anotherList returns true if both lists
have the same elements
first returns the first item on the list
rest returns the list minus the first item
addToFirst: anItem places anItem at the front
of the list
cons: anotherList returns the receiver list concatenated
with the argument list.
Object subclass: #MyLinkedList
instanceVariableNames: YOU FILL IN HERE
classVariableNames:
poolDictionaries:
category: 'My-Data-Structures'
Post comments, discussion, answers in CaMILE at LinkedList Collaboration Space
Count in C++ Below is the definition in C++ of the class Count.
template<class Count_Type>class Count { public: //Constructors/destructors Count() { } virtual ~Count() { } //Implementors virtual void decrement() =0; virtual void increment() =0; void reset() { value = reset_value; } //Accessors Count_Type get_value() { return value; } void set_value(Count_Type new_value) { value = new_value; } Count_Type get_reset_value() { return reset_value; } void set_reset_value(Count_Type new_value) { value = new_value; } protected: //Data members Count_Type value; Count_Type reset_value;} ;
(a) In terms of inheritance, does this definition differ from the definition of the class Count in Smalltalk? Can subclasses of Count in Smalltalk access anything more or less than derived class of Count in C++? Can external classes that use Count in Smalltalk access anything more or less than external classes that use Count in C++?
(b) Why are the data members declared protected in the class above? Why not declare them private?
(c) Why are ~Count(), increment(), and decrement() declared virtual? What does that mean?
(d) Suppose that we don't want to allow the data members of Count to be arbitrarily manipulated from outside of this class or classes derived from Count. What would you change in the above definition? Why?
Post comments, discussion, answers in CaMILE at Count in C++ Collaboration Space
News Page | CS2390 Sum'97 Home Page | MMC-CaMILE | STABLE
Questions/comments/concerns to guzdial@cc.gatech.edu
Page last updated 8/27/97; 11:57:35 AM