UML MCQ

UML Diagrams MCQs Questions With Answers – Part 24

Test your knowledge and boost your confidence with these multiple-choice quizzes focused on UML diagrams, foundational software engineering concepts, and real-world best practices. Designed for students, developers, and exam candidates, these MCQs offer a quick and effective way to assess your understanding and sharpen your skills.
 
 

1. In a UML state diagram, what is the name of the special state that an object enters at the very beginning of its existence?

A Termination state

B Initial state

C Final state

D Waiting pseudo-state

B
The initial state is represented by a filled black circle. It is the starting state of an object when its lifecycle begins. It has no incoming transitions, only an outgoing one. Example:
 

2. In UML, what symbol indicates a derived (or calculated) association?

A A dotted arrow

B A small diamond

C A line with a / before the association name

D A line with a cross in the middle

C
A derived association is calculated from other associations or attributes. UML denotes it with a /: for example, /totalSpent. This means it is not stored but logically derived. Example:

Here, a Client places several Orders, and their total spending can be calculated from these orders → this total is not stored in the Client class, but derived from the relationship with the orders.
 

3. What is the role of a role name in a UML association?

A Define an operation to perform

B Specify the associated data type

C Name how one class views the other

D Label a dependency for documentation

C
The role name indicates how class A “sees” the other class B in a relationship. It is very useful in object-oriented modeling: for example, an Order class could have an association to Client with the role buyer.
 
 

4. You’re creating a hotel app. A client can book several rooms, but rooms exist independently. What type of relationship is this?

A Composition

B Association

C Dependency

D Aggregation

D
Rooms are not deleted when the client leaves → aggregation, weak relationship.
 

5. How is the destruction of an object represented in a UML sequence diagram?

A An empty square at the bottom of its lifeline

B A cross (X) at the end of its lifeline

C A dashed line

D A transition with a red arrow

B
The cross marks the explicit destruction of an object, usually after a destructor method is called or when the logical lifecycle ends. The lifeline stops at this point. Example:
 

6. What is the particularity of the method convertCurrency()?


A It can access instance attributes

B It requires an instance of the class to be used

C It is a static method accessible without creating an object

D It is abstract

C
In UML, a method preceded by static is a class method (not instance), and can be accessed directly through the class.
 
 

7. What is an active class in UML?

A A class that inherits from multiple interfaces

B An abstract class with at least one virtual method

C A class whose instances have their own thread of execution

D A class that can only be instantiated once

C
Active classes represent autonomous, often concurrent or multithreaded objects. They are drawn with bold borders in class diagrams.
 

8. You’re modeling a movie rental system. A movie can have multiple versions (HD, SD, etc.). What is the relationship between them?

A Association

B Dependency

C Composition

D Aggregation

A
A movie can have multiple versions, but each version can exist independently of a specific movie → association.
 

9. In UML, what does an association with multiplicity 0..1 exactly mean?

A The attribute is mandatory.

B The class must have at least one instance.

C The association is optional, at most one occurrence.

D The object is unique in the model.

C
A multiplicity of 0..1 means that an object may be linked to 0 or 1 instance of another class, but never more. It’s useful for optional relationships.
 
 

10. In an event management app, an event can be organized by multiple people. What type of relationship is this?

A Aggregation

B Dependency

C Composition

D Association

D
An event may have multiple organizers, but the organizers exist independently → association.
mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *