Beruflich Dokumente
Kultur Dokumente
Lipp
Exam System Design (1010/1039) / MSE
(Prüfungsleistung) WS2013/14 B (27.03.14)
Support Material • UML Reference List
Remarks • Please check immediately if all pages of the exam (25) + UML
reference list are available
• Duration: 180min
• Enter your name, Matr.-Number on the first page and sign it
• Write legible! Hard to read writing will not yield any points.
• Don’t use a pencil.
• Keep the pages stapled together. Exams that aren't stapled
will not be accepted!
• If you finish within the last 15min of the exam, please stay
seated to avoid disturbing your colleagues.
Name
Matr.-Number
Signature
Mark: ________
Page 1 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
... keep their state after the destructor has been invoked
Page 2 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
... access the private and public attributes of their base classes
... access the protected and public attributes of their base classes
[2] Testing …
... is only important after the implementation has been finished
... should not require more than 25% of the total project effort
Page 3 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
x
o x
o
x
x
x – Waypoints
Route o – Points of Interest
The design for this concept is already implemented in the class diagramm below.
In this exercise, we want to extend a functionality TripDatabase, which tracks a trip and stores it in
a database.
•
Page 4 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 5 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
class CTrip {
private:
public:
CTrip();
bool storeGpsInTrip();
};
Page 6 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 7 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 8 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 9 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 10 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 11 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 12 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 13 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 14 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
5 7 13 15
6 8 14 16
2 4 10 12
1 3 9 11
This scheme has some interesting properties. An interesting property is that all seats with odd
numbers are windows seats and seats with even numbers are aisle seats.
For this exercise we use a simplified class CWagon as shown in this UML diagram.
The attribute m_booked is an array of bools dynamically allocated by the constructor. It contains
as many bools as there are seats in the wagon. A value of true in the array indicates that the
corresponding seat is booked, a value of false indicates that it is free. Note that while seat
numbers start with 1 when used as parameters or return values (i. e. at the class interface), the
first element in the array (corresponding to seat 1) has index 0, of course.
Page 15 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Assume that the number of seats in the wagon is 4. Find out how many test cases you need to
achieve C1 test coverage for this code. For each test case provide the parameter for the invocation
of findSeat and the required values in the array m_booked.
Page 16 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 17 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 18 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
4 Template (20)
Your task is to implement a flexible storage class representing a simple list data structure, storing
any number of any object.
A list consists of a list object, pointing to the first and last content object. Every content object
points to its successor. The last element points to Null (0).
Page 19 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
The iterator class allows the user to access the data using the iterator design pattern, e.g.
CList<int> intList;
intList.addEnd(1);
intList.addEnd(2);
intList.print();
private:
/**
* @link aggregation
*/
CContent<T>* m_next;
Page 20 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
T m_content;
public:
CContent(T content)
{
m_content = content;
m_next = 0;
cout << "created content at " << this << endl;
}
CContent<T>* getNext()
{
return m_next;
}
T getContent()
{
return m_content;
}
};
Page 21 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 22 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
Page 23 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
CListIterator(CList<T> &list)
{
//Connects the pointer attribute to the list passed as parameter
m_list = &list;
}
void first()
{
//Set's the pointer to the first element of the connected list
bool last()
{
//Checks if the pointer points to a not allocated element,
//which is represented by the value 0
return m_current == 0;
}
Page 24 / 25
System Design (1010 / MSE) Prof. P. Fromm / Prof. M. Lipp
T operator*()
{
//return the content of the list element the pointer points to
}
};
Page 25 / 25