Final Study Guide

 

Question 1

 

Draw an Activity Diagram for the following C++ snippet of code:

 

        x = 5;

        for (i = 0; i < x; i++)

        {

                y += i * x;

                if (y > 1000)

                        break;

                else if (y > 500)

                        i = x - 2;

                else if (y > 100)

                        i = x * -1;

                else

                        y++;

                y++;

        }

        cout << "\nx, y, z, i:\n";

        if (y > 10000)

                continue;

        cout << x;

        cout << endl;

        cout << y << endl;

        cout << z << endl << i << endl;

 

 

Question 2

 

Draw an activity diagram for the following routine expressed in C++

(Quicksort partition as expressed in Sedgewick (C++ 3rd edition p319)

 

template <class Item>

int partition(Item a[], int l, int r)

  {

    int i = l-1, j = r; Item v = a[r];

    for (;;)

      {

        while (a[++i] < v) ;

        while (v < a[--j]) if (j == 1) break;

        if (i >= j) break;

        exch(a[i], a[j]);

      }

    exch(a[i], a[r]);

    return i;

  }

 

 

Question 3

 

Draw the activity diagram

 

partition(a[],l, r)

{

        int lhs = l - 1;

        int rhs = r;

 

        while(true)

        {

                while(a[++lhs] < a[r]);

                while(a[--rhs > a[r])

                {

                        if(rhs == l) break;

                }

                if(lhs >= rhs) break;

                swap(a[lhs], a[rhs]);

        }

 

        swap(a[lhs], a[r]);

        return lhs;

}

 

Question 4

Take a cell phone (the functionality is close enough amongst different

manufacturers for this problem I believe), and draw the sequence diagram

for the following 2 situations:

 

A) User looks up a number in the cell phone's phonebook, calls the number,

talks, ends conversation, and then checks in the recent call list the

duration of the call.

 

B) User receives a phone number, enters the number into phone, enters

person's name, forgets to enter the type of phone (cell, home, pager,

etc.), receives an error message, so goes back and enters phone type, then

returns to home screen.

 

Question 5

The software engineering process has matured over time, but there still are very real difficulties that all programming groups go through to try and get their product out.  One version of going through the development process, known as the waterfall model, goes something like this:

 

-Get client's requirements

-Create requirements document

-Create design doc

-Code the application

-Perform testing on each part

-Perform integration testing

-Document and prepare to send out product

-Provide updates/patches after product release

 

This model, however, usually doesn't provide the best results (too much money and time spent on the project, and the integrity of the software itself may be lacking).  The problem is that the model doesn't allow for reiteratation through earlier steps if a problem is found in a later part of the project (for example, during the coding stage of the waterfall model, the programmers may just hack together a fix for a design bug instead of sending it back to the design stage).

 

Now, the actual problem:

 

Draw both an activity diagram and a statechart diagram that describes a software engineering model that allows step reiteration.  State assumptions as needed.

 

Note: fixing bugs in the later stages (as in testing and documentation) is much more expensive than in the early stages, so you want to catch the problems as early as possible.

 

Question 6

 

Last night at 4am your clumsy housemate fell down the stairs waking the entire house. After the rude awakening you decide to implement a net at the bottom of the stairwell to catch the kid. Your net is being implemented by a piece of software you designed called

"Catch-the-clumsy-kid", or CTCK for short. When designing the software you find that the stairs already have pressure sensors imbedded under the lime green carpet. Included in the stair design, a radar speed detector aims at the stairwell. It triggers a signal if an object moves by at velocity F (Fall Velocity). Because sometimes the radar detector doesn't work, you design your software to run the pressure system as a back up check, waiting for large surges in weight (your housemate plummeting to his demise).

 

Also, since usually when he falls you decide to wake up anyway, you want the system to start a pot of coffee, turn on all the lights downstairs, and start up the shower every time he falls. Of course, the only way to do any of those actions is with a toggle switch, so the program has to check if anything is on already before you turn the shower off on your other housemate (the insomniac).

 

Brief rundown:

 

If your housemate falls, the radar gun should send a signal and at the same time the stairs should be picking up large surges of weight as the clumsy guy tumbles down the stairs. The net should be deployed and the program should check the status of the coffee pot, the shower, and the lights downstairs. If any of the coffee pot, shower, or lights are off, the program should turn them on. If any of them are on, they are simply ignored.

 

One problem - since you've been woken up every night for the past 8 weeks you tend to forget things easily now. To remind yourself you wrote down an activity diagram, but now you can't find it. Do yourself a favor and write another activity diagram for the system described.

 

 

Question 7

 

Suppose you work for MusicCorp(tm), and you are given the following description from marketing:

 

"Here at MusicCorp, we have the largest audio-fingerprinting operation in the world.  Our internal process is quite sophisticated.  Music CDs are delivered to us from five major vendors.  These CDs are processed by our MusicTeam.  Cracked discs are sent to a separate company, CD-Replacer(tm), who recycles them and places re-order requests for us.  Good discs are sent to our EntryTeam.  The EntryTeam is responsible for placing each CD in the AudioStation, which automatically starts our AudioStation software. The AudioStation software will fingerprint the music, and these fingerprints will be stored in our massive Fingerprint Database, which will be available for use by our clients.

 

Desiring more information, you speak to the lead developer, who has more information about the AudioStation software:

 

The AudioStation software consists of three modules.  The first module reads the audio data from the CD-ROM drive, and stores it to the hard disk.  The second module is responsible for performing FFT analysis on the audio data.  The third module reads data from an external music profile database, and combines it with the FFT data to create a fingerprint.  This fingerprint is sent over the network to our master database.

 

To prepare for a meeting with potential investors (which, coincidentally, happens after this test), you must provide a Dataflow Diagram for the audio-fingerprinting operation.  The investors will be split up into two departments: R&D and Operations.  Make sure your diagram is split up into sub-diagrams to appropriately address both departments.

 

Question 8

 

Make an activity diagram for the procedure of calculating an employee's wage

for a week according to the following description:

 

- Accounting receives the employee's Hourly Rate, and how many hours he                      worked that week.

 

- If he worked more than 40 hours, he receives 1.5* his Hourly Rate for each                        hour of overtime (over 40 hours).

 

- If he has over 5 hours of overtime his name is sent to Management for review.

 

- If this is the third time this month that the employee has worked over 5 hours of overtime Management records a fine of 2* his Hourly Rate, and adds it to any previous fines for this employee.

 

- If the employee's fine is over 200 dollars, he is fired immediately and he does not receive a paycheck.

 

- Otherwise, being very inefficient and cruel, Management subtracts one hour from the how many hours the employee worked this week, and resubmits the data to Accounting to be recalculated.

 

-If the employee's name is not sent to Management for review, Accounting subtracts any fines he has accrued from his wage, and sends the amount to DataProcessing to issue the employee his paycheck.

 

 

 

 

Question 9

 

Angell Hall Computing Site has about 100 PCs and 50 Macs. All of the computers are connected to a KeyServer, Kerberos (Login) Server, DHCP Server, AFS Server, and router which route data to outside servers (like Googles server, ip 216.239.33.100). There five printers on for the PCs and 4 for the Macs, and a one color printer shared between them. Each group of printers will have a spooler (print queue) connected to it. Recently a 6 wireless hubs were installed in the ceiling, with is connected to its particular server, which then gets connected to the all the rest of the servers. The all hardware is connected through a hub. Draw the Hardware Deployment Diagram for this system.

 

Question 10

 

The Personal Digital Assistant (PDA) has had a great impact on the way people perform their jobs and organize their lives.  One of the most important features of a PDA is the ability to synchronize data between a PC and the PDA.  Suppose a PDA's synchronization operation is performed as follows:

 

- The PDA signals the PC that it wishes to synchronize

- The PC launches the PDA synchronization software

    - The software loads the PC's data files for each of the following:

         - Calendar

         - Address Book

         - ToDo list

         - Memo Pad

         - Email Inbox

    - The software loads the PDA's data files for each of the same, except:

 

         - The Email Inbox is disregarded, and the Email Outbox of the PDA is loaded

         - The software compares the data files, updating each database with the most current information from either data store, except the Email Inbox

         - The PDA's Email Inbox is overwritten with data from the PC's Inbox

         - The software moves email from the Email Outbox of the PDA to the PC's email application's outbox- The PDA synchronization software exits

- The PDA gives and audible signal that the synchronization is complete.

 

Draw a Statechart Diagram for the PDA synchronization software.