UML MCQ

UML Diagrams MCQs Questions With Answers – Part 15

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. A composition differs from an aggregation by:

A The direction of the arrow

B The style of the diamond

C The multiplicity

D The names of the classes

B
  • Aggregation: white diamond (weak relationship)
  • Composition: black diamond (strong relationship, dependent existence)

Example:

 

2. What is missing in this diagram?


A There is no associated class

B getPrice is incorrectly defined

C The attributes are not typed

D The constructor is missing

B
In UML, a method must have parentheses. Therefore, getPrice should be: +getPrice() : double.
 

3. In a sequence diagram, what is the purpose of a return message (dashed line with a solid arrow)?


A To illustrate a dependency

B To represent a state transition

C To complete a diagram

D To show a response to a method call

D
A dashed line with an arrow in a sequence diagram represents a return message: it is the response to a method call.
 
 

4. In a sequence diagram, what symbol is used to send a synchronous message?

A Dashed line

B Solid arrow with a black triangle head

C Solid arrow with an open head

D Empty arrow

B
A synchronous message is represented by a solid arrow with a black triangle head, indicating that a response is expected. Example:
 
 

5. In UML, what do we call a class that cannot be instantiated directly?

A A utility class

B A concrete class

C An abstract class

D An external class

C
An abstract class is a class that cannot be instantiated directly. It is often used as a base for other concrete classes. In UML, it is denoted in italics or marked with the <<abstract>> stereotype.
 

6. What is the issue in this diagram?


A The class names are too short

B There is unhandled recursion

C Methods are missing

D The “inheritance” relationship is poorly represented

D
Inheritance should be represented by a triangular arrow (A <|-- B), not a simple arrow -->. Example:
 
 
 

7. What is the main difference between a dependency and an association in UML?

A An association is temporary, a dependency is permanent

B A dependency is stronger than an association

C An association involves a direct link between objects, a dependency does not

D There is no significant difference

C
An association represents a permanent structural link between classes (e.g., a student and their class). A dependency is weaker: it indicates that a class temporarily uses another without a direct link. Example:
 
 

8. In UML, what does a generalization arrow between two use cases mean?

A A process inclusion

B An inheritance between actors

C A functional dependency

D A specialization of a use case

D
A generalization arrow between two use cases indicates that the child use case specializes or extends the behavior of the parent use case. This allows modeling variations. Example:
 

  • Parent use case: Order a product
  • Child use case: Order with express shipping, which specializes the parent behavior (e.g., fast delivery)
 

9. In a class diagram, what is an operation?

A A relationship between two classes

B A calculated attribute

C A method that a class can execute

D An abstract class

C
An operation is equivalent to a method in UML: it represents a function that the class can perform. For example: display(), calculateTotal(), etc.
 
 

10. What does this diagram represent?


A A hierarchy of inheritance between concrete classes

B An abstract class with two subclasses

C A class that implements two interfaces

D Two classes merged into one

C
The notation ..|> means that the class MultifunctionPrinter implements both the Printable and Scannable interfaces.
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 *