Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Midterm 1 Review - Fall 2004
The first midterm in 2340 will include 4-5 questions on the material covered by the questions below. Some questions on the exam may be asked in ways different from these examples.
You can working together with classmates to figure out the solutions or try it on your own. Feel free to comment on answers as they are posted or simply add your own. I will check up on the discussions, but I won't provide answers where no answers are posted.
Unless you need to edit/repair something here, do not edit this page! Put your answers on the answer page. If you do edit this page, please be careful with the formatting. Thanks! Rich LeBlanc
- What's a class? What's an instance?
- What's the difference between a class and instance method?
- What's the difference between a class and instance variable?
- In the following Squeak code what type of method (class or instance) is "new" and what type is "initialize"?
joe := Box new initialize
Put your answers/comments/questions at Fall2004 Midterm Review: O-O Systems
History of Object Systems
- What is Sketchpad?
- What is Simula?
- Who were the key people associated with Sketchpad, Simula, and the original Smalltalk?
- What do they have to do with Squeak?
- How did OO ideas get out into the mainstream (out of the research lab)?
Put your answers/comments/questions at Fall2004 Midterm Review: History of Object Systems
| anArray aString |
anArray := #('abc' 'def' 'ghi' 'jkl').
aString := ''.
anArray do: [:each |
aString := aString, each.].
Transcript show: aString.
1. What appears on the Transcript ?
2. How many times did the do: loop get executed?
| i test |
i := 1.
test := (i < 10).
[test] whileTrue: [Transcript show: 'hello'.
i := i + 1.].
3. How many times does hello get printed in this example?
Put your answers/comments/questions at Fall2004 Midterm Review: Reading Code
Define each and give an example.
- What is Inheritance?
- What is Delegation?
- What is Polymorphism?
- What is Encapsulation?
Put your answers/comments/questions at Fall2004 Midterm Review: Definitions
Draw a Class Diagram of a Student Registration System
You have just completed an analysis of a student registration system:
- Students have names, student numbers, and a transcript
- Transcripts list the sections that a student has taken and the grade for each.
- A Section is an offering of a Class that has a time and term associated with it, and a number of students who took the class that quarter.
- A Class has a name, a number (e.g. "CS2390"), and a number of credits associated with it.
Draw a class diagram for these classes.
Put your answers/comments/questions at Fall2004 Midterm Review: Class Diagram
- What is SUnit and why would you want to use it?
- What is scenario-based testing and why would you want to do it?
- What are the advantages of defining test case before you write code?
Put your answers/comments/questions at Fall2004 Midterm Review: Testing and Refactoring
What is wrong with the following and how do you fix it?
- We decided to have one shape class and have a type attribtue which can be "Circle", "Rectangle", "Triagle". We have to case on the type to figure out what to draw. Later we need to case on the type again to output the postscript.
- Boxes need to use a pen so we had Box inherit from Pen.
- We got lots of coding done because we were able to copy code to many different classes.
- We really only needed one "main" class and a couple of helper classes.
- We call the class that edits the image part of the slide "EditBackground".
Put your answers/comments/questions at Fall2004 Midterm Review: Design Critique
- What are CRC cards? Who invented them? What do they show?
- How are CRC cards used?
- Develop CRC cards for the following scenario:
A customer calls a mail order company. A salesperson answers and gets the customer information (including credit card and shipping address). The customer gives the item numbers for the items in the order and the quantity desired of each. For each item number given the salesperson says the item name, price, and checks if the item is in stock. When the customer says that they have no more items to order the salesperson gives the customer the order total, shipping estimate, and confirmation number.
- Create a UML diagram for the design of your solution for the software to handle the mail order system.
Put your answers/comments/questions at Fall2004 Midterm Review: CRC
Links to this Page