UML MCQ

UML Diagrams MCQs Questions With Answers – Part 9

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. What is the difference between an association and a dependency?

A An association is a type of dependency

B The dependency is stronger than the association

C An association is a lasting relationship between two classes

D No difference, they are synonyms

C
An association is more structural (e.g., “a client has orders”), while a dependency is often temporary or behavioral (e.g., “used in a method”). Example:
 
 

2. In UML, what is an artifact?

A A software library

B A file produced by development (code, document, binary, etc.)

C An abstract class

D A unit test

B
An artifact is a tangible element of software development: file, source code, executable, technical document, etc. They appear in deployment diagrams. Example:
 

This application has several artifacts:

  • A source code (.jar)
  • A database
  • A technical document in PDF
 

3. What is the difference between “include” and “extend” in a use case diagram?

A “include” is optional, “extend” is mandatory

B “include” reuses behavior, “extend” adds optional behavior

C There is no difference

D Both represent a composition

B
  • <<include>>: extracts common behavior from several use cases. It is mandatory.
  • <<extend>>: adds optional behavior that executes under certain conditions.

Example:

 
 

4. What is the purpose of a combined fragment in a sequence diagram?

A Represent an abstract interaction

B Add a private method

C Show alternatives or loops

D Draw temporary classes

C
Combined fragments allow integrating control structures in a sequence diagram, such as:

  • alt: alternative (if/else)
  • loop: loop
  • opt: option

Example:


 
Here, we model a scenario with a condition (if/else):

  • If the payment is validated, we send a confirmation.
  • Otherwise, we cancel the order.
 

5. The composite structure diagram is used to:

A Model network components

B Show the internal architecture of a class

C Detail use cases

D Model SQL scripts

B
The composite structure diagram is used to model the inside of a class, including how it is composed of other elements (ports, internal parts, collaborations, etc.).
 

6. In a class diagram, a navigable association in one direction is represented by:

A A solid line without an arrow.

B A solid line with an open arrow pointing to the target class of the navigation.

C A dashed line with an open arrow.

D A solid line with a diamond head.

B
Navigation indicates which direction an instance of one class can access instances of the other associated class. An open arrow indicates the direction of navigation. Example:
 
 

7. Which relation is used here?


A Simple association

B Aggregation

C Composition

D Inheritance

C
The filled diamond represents a composition, meaning that the Door is an integral part of the House (it does not exist without it).
 

8. What is the difference between this relation and the previous one?


A No difference

B Here, the Book cannot exist without the Library

C Here, the Book can exist independently of the Library

D This is an inheritance relationship

C
The empty diamond represents an aggregation, a “whole-part” relationship that is more flexible than composition.
 

9. In UML, which diagram illustrates real objects and their links at a given moment?

A Class diagram

B Activity diagram

C Object diagram

D Component diagram

C
The object diagram is a snapshot of the system: it shows concrete instances of classes (with their values and relationships), often used to illustrate a specific example.
 
 

10. What is the representation of an actor in a use case diagram?

A A diamond

B A rectangle

C A stick figure

D A circle

C
An actor is represented by a stick figure. It symbolizes an external user (human or system) interacting with the system. Example:
 
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 *