UML MCQ

UML Diagrams MCQs Questions With Answers – Part 5

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 UML, what is the role of stereotypes?

A Assign default values to attributes

B Add colors to classes

C Specialize or categorize a UML element

D Represent the database

C
Stereotypes are used to add a specific meaning to a UML element. For example, <<interface>>, <<control>>, <<boundary>>, etc. They are displayed between double angle brackets. Example:
 
 

2. The activity diagram is often used to represent:

A Class structures

B Organization of use cases

C Composition of a software component

D Logical flow of a process

D
The activity diagram models a control or data flow. Very useful to visualize the steps of a process or business workflow. Example of processing an online order:
 

 

 

3. What does an arrow between two use cases with the keyword <<include>> represent?

A An error

B An inheritance relationship

C A mandatory inclusion of a behavior

D An optional feature

C
<<include>> means that one use case mandatorily integrates another. Example: “Order a product” includes “Log in”. It is a mandatory reuse.
 
 
 

4. What UML keyword is used to represent an optional extension between two use cases?

A <<optional>>

B <<include>>

C <<extend>>

D <<use>>

C
<<extend>> indicates an optional behavior, executed under certain conditions. Example: “Pay with loyalty points” may extend “Place Order”.
 
 

5. In UML, what does a “component” model?

A A database

B A graphical interface

C A unit test

D A physical part of a software system (module, library, etc.)

D
A component is a reusable or deployable part of a system: it may be a module, an API, a DLL… Modeled in the component diagram. Example:
 
 

6. Which UML diagram is particularly useful for modeling business processes, workflows, and algorithms?

A Use case diagram

B Sequence diagram

C Class diagram

D Activity diagram

D
The activity diagram uses specific symbols to represent actions, decisions, branches, and parallel flows within a process. Example of an order processing with parallel flows:
 

1- The customer places an order.
2- The system checks the payment.
3- In parallel:
    + Prepare the order
    + Send the invoice
4- Once both are complete, ship the package.
 
 

7. What is the standard representation of a class in UML?

A An oval divided into two parts

B A rectangle divided into three parts: name, attributes, methods

C An arrow toward an interface

D A circle with a line

B
A UML class is represented by a rectangle divided horizontally: Class name, attributes, and methods (or operations). Example:
 
 

8. What is the role of the deployment diagram?

A Show code modules

B Represent the logical flow of a process

C Describe how elements are installed on hardware

D Model the user interface

C
The deployment diagram is a structural diagram that shows how the system is physically deployed: servers, databases, network connections… Example: Classic web application
 

A web client accesses an application server. The application server is connected to a database server.
 

9. Which UML relationship is often used to model the “is-a” relationship?

A Association

B Composition

C Inheritance (generalization)

D Dependency

C
If we say a class is a specialization of another (e.g., “A Dog is an Animal”), we use an inheritance relationship, also called generalization in UML. Example:
 

We have a class Animal, and a class Dog which is a specialization of Animal. In UML, this is modeled with an arrow with an empty triangle pointing to the parent class.
 
 

10. In a class diagram, how is a private attribute represented?

A By prefixing with +

B By prefixing with –

C By prefixing with #

D By writing it in italics

B
In UML, visibility modifiers are used to indicate the accessibility of class members:

  • + : Public (accessible from anywhere)
  • – : Private (accessible only within the class)
  • # : Protected (accessible within the class and its subclasses)
  • ~ : Package (accessible to classes in the same package)
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 *