UML MCQ

UML Diagrams MCQs Questions With Answers – Part 21

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 activity diagram, what does a guard condition represent?

A A logical test applied before an event occurs.

B A condition that decides if an activity is accepted in a workflow.

C A constraint written in brackets [ ] on a transition, used to determine the path to follow.

D A loop of activities repeated indefinitely.

C
Guards (or guard conditions) are boolean expressions, written as [condition], on the outgoing arrows of a decision node. They control the path taken after an activity, like an if statement in a program. Example:
 

A system moves through different states depending on the value of a variable x:

  • If x ≤ 10 → go to Normal state
  • If x > 10 → go to Alert state
 

2. In an activity diagram, what does a diamond with several outgoing arrows represent?

A A loop

B A conditional decision

C A terminal state

D A subprocess

B
The diamond represents a choice between multiple paths based on a condition. Example:
 

3. You want to model the repeated execution of an action (e.g., login attempt). Which combined fragment should you use?

A opt

B alt

C loop

D ref

C
The loop fragment allows you to repeat a sequence as long as a condition is true (e.g., max 3 attempts). Example:
 
 
 

4. What is the difference between a synchronous and an asynchronous message in a UML sequence diagram?

A A synchronous message never returns a response.

B An asynchronous message blocks the sender until it receives a reply.

C A synchronous message waits for a response; an asynchronous one does not.

D There is no difference in UML.

C
A synchronous message (solid line with closed arrowhead) blocks the sender until the operation ends (like a method call). An asynchronous message (solid line with open arrowhead) does not block; the sender continues its processing. Example:
 
 

5. This diagram represents __________


A A relationship between objects in the same program

B Software components and their interactions in an architecture

C The relationship between an application and a database

D A relationship between a class and its interface

B
This diagram shows software components in a system architecture, where Server interacts with Database.
 

6. What does this diagram represent?


A Concrete instances of the Client class

B An abstract Client class

C Objects in a class diagram

D Objects in an object diagram representing specific instances

D
The diagram shows specific objects (client1, client2), representing concrete instances of classes in an object diagram.
 
 

7. What does the OCL (Object Constraint Language) allow you to express in UML?

A Logical interfaces for components.

B Visual styles for UML diagrams.

C Precise constraints on UML models such as invariants, preconditions, or postconditions.

D User interaction scripts.

C
OCL is a declarative language used to specify precise rules in a UML model. It is often used to express invariants (always true), preconditions (before an operation), or postconditions (after).
 

8. In UML, what is multiple generalization?

A A child class that inherits from a single parent class.

B A child class that inherits from multiple parent classes.

C A class that inherits from an entire package.

D An interface that inherits from a concrete class.

B
Multiple generalization in UML means that a class can inherit from multiple classes, which can be useful but should be used with caution (conflict issues or the “diamond problem”). Example:
 

 

9. You are building an e-learning system. What UML relationship between a course and its chapters if the chapters exist only with the course?

A Aggregation

B Association

C Dependency

D Composition

D
If the course is deleted, the chapters disappear too → composition.
 
 

10. What does the relationship Student <--> Course mean?


A A Student can be enrolled in several Courses, but a Course can have no Students.

B A Student can be enrolled in only one Course.

C A Course must have at least one enrolled Student.

D A Student cannot be enrolled in multiple Courses.

A
The multiplicity 1 and 0..* means a Student can enroll in multiple Courses, but a Course may have no Students.
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 *