Revision Flashcards

1
Q

What is a class diagram?

A

A static diagram that describes the structure of a system by showing its classes, attributes, operations, and relationships.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the purpose of a state diagram?

A

To describe the behavior of a system by showing its states and the transitions between those states.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does a sequence diagram depict?

A

It shows how objects interact in a particular scenario of a use case, highlighting the sequence of messages exchanged.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define invariant in OCL.

A

An invariant is a condition that must always hold true for a system at all times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write an OCL constraint restricting the course name to between 10 and 25 characters.

A

context Course
inv: courseName.size() >= 10 and courseName.size() <= 25

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the context keyword specify in OCL?

A

It specifies the class to which the constraint applies.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What does the inv keyword declare in OCL?

A

It declares an invariant constraint.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you ensure that the length of courseName is at least 10 characters and at most 25 characters in OCL?

A

courseName.size() >= 10 and courseName.size() <= 25

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Write an OCL constraint ensuring that if fees are paid, the student must be registered for at least one course.

A

context Student
inv (feesPaid == True) implies (self.registeredFor->notEmpty())

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the OCL operation ->size() do?

A

It returns the number of elements in a collection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What does the OCL operation ->isEmpty() check?

A

It checks if a collection is empty.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does the OCL operation ->notEmpty() check?

A

It checks if a collection is not empty.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does the OCL operation ->includes(element) check?

A

It checks if a collection includes a specific element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the OCL operation ->forAll(x | condition) do?

A

It checks if a condition holds true for all elements in a collection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the OCL operation ->exists(x | condition) do?

A

It checks if there exists at least one element in a collection that satisfies a condition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the ‘=’ operator represent in OCL?

A

Equality operator

17
Q

What does the ‘<>’ operator represent in OCL?

A

Inequality operator

18
Q

What does the ‘and’ operator represent in OCL?

A

Logical AND operator

19
Q

What does the ‘or’ operator represent in OCL?

A

Logical OR operator

20
Q

Write an OCL if/else statement ensuring course name size is based on course level.

A

context Course
inv: if courseLevel = CourseLevel::bachelor then courseName.size() >= 10 else courseLevel = CourseLevel::master and courseName.size() >= 15 endif

21
Q

Write an OCL constraint ensuring student categories and course levels match.

A

context Student
inv: self.registeredFor-> forAll(course | (studentCategory = StudentCateg::bachelor implies courseLevel = Courselevel::bachelor) and (studentCategory = StudentCateg::master implies courseLevel = Courselevel::master))

22
Q

What is a box-and-line diagram?

A

A diagram that shows the high-level structure of a system, including its components and the relationships between them.

23
Q

What is a pipe and filter diagram?

A

A diagram that represents a system as a series of processing steps (filters) connected by pipes, which transport data between the steps.

24
Q

What is the intent of the strategy pattern?

A

To define a family of algorithms, encapsulate each one, and make them interchangeable, allowing the algorithm to vary independently of clients that use it.

25
Q

What is the applicability of the strategy pattern?

A

It is applicable when many related classes differ only in their behavior, providing a way to configure a class with one of many behaviors.

26
Q

What does the context class do in the strategy pattern?

A

It maintains a reference to a strategy object and uses it to execute the algorithm defined by the strategy.

27
Q

What is a concrete strategy in the strategy pattern?

A

A class that implements a specific algorithm defined by the strategy interface.

28
Q

What is the role of the strategy interface?

A

To define a common interface for all supported algorithms, allowing them to be interchangeable.