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

Midterm #1 Review - Spring 2004

A midterm in 2340 is 4-5 questions like the questions below.

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


O-O Systems



  1. What's a class? What's an instance?
  2. What's the difference between a class and instance method?
  3. What's the difference between a class and instance variable?
  4. 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 Spring2004 Midterm Review: O-O Systems


History of Object Systems



  1. What is Sketchpad?
  2. What is Simula?
  3. Who were the key people associated with Sketchpad, Simula, and the original Smalltalk?
  4. What do they have to do with Squeak?
  5. How did OO ideas get out into the mainstream (out of the research lab)?

Put your answers/comments/questions at Spring2004 Midterm Review: History of Object Systems



Reading Code


 | anArray aString |
anArray := #('abc' 'def' 'ghi','jkl'). "There shouldn't be a comma here."

aString := ''.
anArray do: [:each |
	aString := aString, each.].
Transcript show: aString.

i'm not sure who added in "there shouldn't be a comma here", but there is no reason for there not to be a comma, comma is the message for concatenating strings, so you get the following strings in the array: abc def ghijkl-ellie
Note: ellie is wrong! # turns , into a symbol #, If you want to do string concatenation within a literal array you have to use the { } syntax.

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 Spring2004 Midterm Review: Reading Code


Definitions


Define each and give an example.


  1. What is Inheritance?
  2. What is Delegation?
  3. What is Polymorphism?
  4. What is Encapsulation?
  5. What is the MVC paradigm? (For an example show an example using MVC)


Put your answers/comments/questions at Spring2004 Midterm Review: Definitions


Changed/Update mechanism



In the third Clock user interface, a Clock instance forms the model and a ClockText instance forms a view. Describe the sequence of messages that occur when a second of time passes by, such that the Clock is updated and the updated time is displayed by the ClockText. Hints: Think about self changed:, nextSecond, update:, and dependents.

Put your answers/comment/questions at Spring2004 Midterm Review: Changed/Update mechanism


Draw a Class Diagram of a Student Registration System


You have just completed an analysis of a student registration system:


Draw a class diagram for these classes.

Put your answers/comments/questions at Spring2004 Midterm Review: Class Diagram



Testing



  1. What is SUnit and why would you want to use it?
  2. What is scenario-based testing and why would you want to do it?
  3. What are the advantages of defining test case before you write code?


Put your answers/comments/questions at Spring2004 Midterm Review: Testing and Refactoring



User Interface



  1. What are some things to consider when developing a UI for K-12?
  2. What are some things to consider when developing a UI for senior citizens?
  3. What are ways to test your user interface? Both before the users are involved and after?
  4. What is a cognitive walkthrough and when is it useful?
  5. What is wrong with the UI for the clock on page 187?
  6. What is a process that you could follow for developing a good user interface?


Put your answers/comments/questions at Spring2004 Midterm Review: User Interface



Design Critique



What is wrong with the following and how do you fix it?

  1. We decided to have one shape class and have a type attribtue which can be "Circle", "Rectangle", "Triangle". 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.
  2. Boxes need to use a pen so we had Box inherit from Pen.
  3. We got lots of coding done because we were able to copy code to many different classes.
  4. We really only needed one "main" class and a couple of helper classes.
  5. We call the class that edits the image part of the slide "EditBackground".


Put your answers/comments/questions at Spring2004 Midterm Review: Design Critique



CRC



  1. What are CRC cards? Who invented them? What do they show?
  2. How are CRC cards used?
  3. 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.
  4. 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 Spring2004 Midterm Review: CRC

Links to this Page