2D1385 Programutvecklingsteknik



Take Home Exam (Omtentamen)

NOTES: (Please read these carefully!)

(i) Clearly mark at the top of each sheet you use: (a) your name, (b) the page number.

(ii) On the front page indicate (a) how many pages are contained in your work in total. Clearly mark: (b) your name (c) your personnummer, (d) your e-mail address (in case I need to contact you)

(iii) There are two ways to submit your work. (a) Your work may be handed in to NADA's studentexpedition no later than Tuesday 30th August 2005 at 11.00 am. After this time it will be marked as late, and marks will be subtracted. (b) If for any reason your are unable to reach the studentexpedition yourself (for example if you are at work) then you may post your manuscript to: Studentexpeditionen, NADA, KTH, 100 44 Stockholm. The date and time on the postmark will be taken as the date and time of your submission. The same deadline applies to manuscripts submitted by post.

(iv) If manuscripts are submitted in any other place or by any other means than those described in Part (iii) then the examiner and NADA cannot be held responsible in the case that manuscripts are lost.

(v) If you have any questions about the exam (for example, if you do not understand a question) you may call my mobile number 076 223 86 79. Please do not call before 9.00 am or after 9.30pm! You may also e-mail me.

(vi) You may use your kursbunt, and any course books. You are allowed to use the internet including search engines. However, any work which you download and use must be credited to its source. You are not allowed to discuss or develop your answer with anyone else before all manuscripts have been handed in. You are not allowed to copy anyone else's work. By handing in your manuscript you are declaring that you have abided by these rules. In the case that cheating is suspected, actions will be taken against any students involved.

(vii) Write clearly. No marks will be awarded for work that I cannot read. You can write your answers in swedish or english.

Answer all questions. Maximum marks are 50 points. A grade 3 will be awarded for 25 points or more, grade 4 is awarded for 30 points or more, grade 5 is awarded for 35 points or more.

Question 1 . Consider the following collection of nouns and relations suitable for a geographical database of the United States of America, USA:

Nouns: USA, state, state_capital, town, city, motorway, river, ocean, lake, mountain, population_size, name, length, area, altitude, co-ordinates.

Relations: has_a, is_a, connects, located_in.

Note: we say that a motorway M connects towns or cities A and B if M runs directly from A to B. So connects is a ternary or 3-place relation.

(i) (10 points) Arrange all these nouns and relations into a UML class diagram. By using additional classes where necessary and inheritance, carefully avoid repeating the same attributes within several classes. Be careful to include multiplicity information on relations where this can be clearly defined. Be careful to correctly distinguish between has_a and located_in, why might these relations be different?

(ii) (5 points) Instantiate your class diagram of Part (i) to give a simple UML object diagram for the State of California. You should instantiate every class type and its attributes by at least 1 object and set of values. You should also instantiate each relation by at least 1 link.


Question 2. Consider the activity of making a telephone call from a public telephone kiosk that takes coins or credit cards. Consider the entire activity that takes place from first lifting the receiver to finally replacing the receiver and collecting any unused coins.

(i) (5 points) Write a text use case for this activity. be careful to include all normal (sunny day) scenarios include the sub activities of entering coins, entering a credit card and dialling a number. Also include the exceptional scenarios where: (a) the phone is broken, (b) a coin is not valid, (c) the dialled number is busy.

(ii) (10 points) Draw a UML sequence diagram which models your text use case of Part (i) exactly. Try to structure the information hierarchically by using subsequence diagrams and references. Be careful to correctly model any activities which can be repetitive or contain alternatives.

Question 3. Company FastBucks Inc. thinks it has spotted a niche in the mobile telephony market for its current 3D graphics interactive computer game Grand Theft Also that can currently be networked for several players over the internet. FastBucks needs to produce a demo version of the game in 3 months for the next CeBit trade fair. It is unclear, how much of the game can be ported to a mobile phone platform. It is also unclear whether what can be ported, will remain an interesting and attractive game. FastBucks plans to test the product on a large team of young people, before making a decision about final marketing and price. FastBucks has too few employees to staff all its projects, so that employees are shifted around between projects according to the greatest need for programmer resources. This stressful environment means that staff turnover is high.

(i) (7 points) What life-cycle model would you recommend FastBucks to use? Draw a workflow diagram for your choice of model, and describe each phase of the model.

(ii) (3 points) Name three different factors from the above project description which motivate your choice of model, and explain whythese motivate your choice.


Question 4. (10 points) Suppose that you wish to store and send information from the geographic database of Question 1 using the XML format.

(i) (3 points) For this part of the problem we shall ignore all relations between classes. Write a DTD that is suitable for defining XML files that are instances of your class diagram of Question 1.a.

(ii) (3 points) Write a short XML file that represents your instantiation of the State of California developed in answer to Question 1.b. Make sure that your solution is a valid instance of your DTD defined in Part (i).

(ii) (4 points) Briefly indicate how you might add relation information to the DTD and hence link information to an XML file. Illustrate how this works using the State of California example.