UML MCQ

UML Diagrams MCQs Questions With Answers – Part 26

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 role of an artifact in a UML deployment diagram?

A Represent a system process

B Describe a user activity

C Represent a file or physical element deployed on a node

D Identify a dependency between classes

C
An artifact corresponds to a concrete system element, such as an executable, a JAR file, a database, etc. It is deployed on a node (machine, server…) and is often linked to a software component. Example:
 

This application has several artifacts:

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

2. In a carpooling app, a car can be used by several trips. Trips can exist without the car. What relationship is this?

A Composition

B Association

C Dependency

D Aggregation

D
The trips doesn’t disappear if the car is deleted → this is an aggregation. Example:
 
 

3. What does this relationship represent?


A An Employee can supervise several other employees, but not themselves

B An Employee inherits from another

C An Employee contains another Employee

D This represents a recursive composition

A
This is a reflexive association, meaning a class is linked to itself, useful for internal hierarchies like an organizational chart.
 
 

4. You want to represent a conditional choice in an activity diagram (e.g., “if payment is validated, send confirmation, otherwise cancel”). Which symbol should you use?

A Diamond

B Rectangle

C Circle

D Horizontal line

A
The diamond is used to represent a decision point (if / else). Example:
 
 

5. In UML, a composite state contains ______________

A An activity diagram

B One or more class transitions

C Other internal states

D A conditional structure

C
A composite state is a state that contains other states (called sub-states), allowing for hierarchical behavior modeling. It can have a local initial state, internal transitions, etc. Example:
 

This diagram could model a music application:

  • The global state “MusicPlayback” contains internal steps: Loading, Playing, Paused
  • Externally, you can go back to the “Paused” state
 

6. What is the purpose of packages here?


A To declare abstract classes

B To organize the code based on the visibility of attributes

C To group classes by functionality or domain

D To separate objects and classes

C
UML packages are used to logically organize system elements, often according to the application’s modules.
 
 

7. In a UML object diagram, how do you indicate an object’s attribute value?

A In brackets [ ] under the name

B As name:Class without further indication

C By listing attribute = value pairs inside the rectangle

D By coloring them in blue

C
Objects in object diagrams can display their attribute values directly, inside the object’s rectangle, after its name and class, e.g.:

client1 : Client
name = Dupont
status = active
 

8. In a use case diagram, what does a generalization relationship between two cases mean?

A The specialized case is always called

B The specialized case inherits the behavior of the general case

C The general case depends on the child case

D The main actor changes dynamically

B
Just like with classes, a use case can inherit from another: this allows you to specialize a general scenario with specific variations while reusing the common steps. Example:
 

“Pay by card” and “Pay via PayPal”: these are specializations of the generic “Make payment” action.
 

9. Which UML rule is illustrated here?


A A class can only inherit from a single interface

B A class can only implement an interface if it is abstract

C UML allows multiple inheritance of interfaces

D Interfaces must be in composition

C
In UML, a class can implement multiple interfaces, which promotes flexible design.
 
 

10. In UML, what does a <<realize>> dependency between two elements mean?

A An abstract class becomes concrete

B An interface is implemented by a class

C An activity is executed automatically

D A component inherits from another

B
The <<realize>> dependency is used to show that one element implements the contracts (interfaces) of another. It is often used between classes and interfaces, or between components and provided 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 *