Massachusetts Institute of Technology
Department of Electrical Engineering and Computer Science

6.171 Mid-Term Exam

Spring 2006

Rules

This is a take-home exam. You can take it where you want to and use any resources you like, except that you must do the exam by yourself (no collaboration, not even with your team members). If you are relying on a section of a book or Web page, cite the source. An 80/100 will be a great score on this exam so if there is one part that is taking forever and doesn't interest you, write up your thoughts and move on.

When you are through with the exam, send your work by email (in plain text, please, with a subject line of "6.171 mid-term exam") to philg@mit.edu. At the beginning of the message, please include a statement affirming that you worked on the exam completely by yourself. Your mail must be received by 2:30 PM on Tuesday, May 2nd (before class begins).

Handed out: Thursday, April 27th, 2:00 am. Due: Tuesday, May 2nd, 2:30 pm.

Resources

Here are some resources that will help you answer the questions below.

Problems or questions? Email philg@mit.edu.

Usability Analysis

Visit www.rentacoder.com and register as a coder. Perform the following steps: Identify three usability problems with rentacoder.com and write instructions to their programmers on how to fix them. Extra credit: email these ideas to the rentacoder.com folks and attach their response.

Expected length of answer: 1 page.

Note: In a previous semester, we published the best suggestions. Please state somewhere underneath your answer whether you are willing to let your answer be excerpted and published (and whether or not you want your name used).

Question 2: Developing a Data Model

Now develop a data model for the rentacoder.com site. Your data model should be complete enough to handle all of the user experience that you toured in the previous question and operate the core rentacoder.com service. Assume the existence of a users table, keyed with user_id or id. The data model should include appropriate integrity constraints and indices to facilitate the queries that you believe are necessary for the pages that you just experienced. The data model should contain appropriate in-line comments.

Test your data model by feeding it to an RDBMS and making sure that the CREATE TABLE and index definition statements are accepted without errors. You will probably want to create a new database user so that your table definitions don't conflict with any tables that you might have defined for your team project.

Expected length of answer: if your data model contains more than 15 or 20 tables, you're probably handling too many special cases. The important thing is to get the structure of the data model right and the relations. Don't spend a lot of time making sure that you have every possible column in every table. For example it would be okay to say "-- ... address columns ..." to imply that there would be a way to store a member's street address, city, state, etc.

Question 3: Fancy SQL Queries

Using the data model you defined in Question 2 write the following computer programs:

Part a: a computer program that prepares a report showing the coders who were the lowest bidders on projects, ordered by descending count of how many projects on which they were the lowest bidder (so if Joe was the lowest bidder on 15 projects, he would appear above Mary, who was the lowest bidder on 12 projects). For each coder, the report should show the total amount of money actually paid to that coder for completed projects on which he or she was the low bidder, and the most recent date of a low bid.

Part b: a computer program that prepares a report showing total project completion by country of origin (number of projects and total dollars paid) and the average customer satisfaction for work done by coders from that country

Ideally each program will be a single SQL query. It is acceptable to use procedural language crutches, e.g., stored procedures.

Test your queries by filling your data model tables with some sample data and then run the queries. Print out a transcript of a database session in which you use your queries.

Note that it is possible that you'll start doing these queries and discover that you want to make changes to your data model. That's a perfectly natural way to refine a system. See if a data model supports some queries then go back and modify it until it does.

Don't spend more than a few hours on this question. You can get partial credit if you show that you're thinking along the right lines, e.g., by coming up with some smaller queries that give you reports that could be useful in solving the larger problem.

Question 4: Fun with Data Warehousing

Note that doing this problem will prepare you for the user activity analysis chapter exercises.

Using the Levi Strauss data model defined in the "Real World Example" section of http://philip.greenspun.com/sql/data-warehousing, write SQL queries that answer the following questions:

Suppose now that you are asked to prepare a report of average waist size of a pair of shipped pants, broken down by region of the country. To which table would you add a waist_size column and why?

Turning it in

Please email your answers to the questions to philg@mit.edu.

At the beginning of the message, please include a statement affirming that you worked on the exam completely by yourself.

Who Wrote This and When

This exam was written by Philip Greenspun in April 2006 for MIT Course 6.171.. It is copyright 2006 by the author but may be reused provided credit is given to the original author with a hyperlink to this document.
philg@mit.edu