UML MCQ

UML Diagrams MCQs Questions With Answers – Part 4

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 main difference between aggregation and composition?

A There is none

B Composition implies a stronger shared lifetime

C Aggregation does not allow use of objects

D Aggregation is always used with interfaces

B
In a composition, the relationship is strong: if the main object is destroyed, the “contained” object is also destroyed. In aggregation, this is not necessarily the case. Example:
 
 

2. In UML, a simple line between two classes generally represents:

A An association

B A dependency

C A generalization

D A state transition

A
An association is a simple relationship between two classes (e.g.: a customer can book one or more flights). It is represented by a simple line, possibly with multiplicity (1..*, 0..1, etc.). Example:
 
 

3. Which UML diagram is used to model the dynamic behavior of a system by showing object interactions over time?

A Use case diagram

B Sequence diagram

C Class diagram

D Activity diagram

B
The sequence diagram emphasizes the chronological order of messages exchanged between objects to carry out a specific use case. Example:
 

image source: wikimedia.org
 
 

4. In a sequence diagram, what is a “lifeline”?

A A type of arrow

B An abstract class

C A vertical axis representing an object

D A state transition

C
A lifeline is a vertical line that represents the existence of an object over time, in a sequence diagram. Messages (arrows) are exchanged between these lifelines. Example:
 

image source: wikimedia.org
 

5. What type of diagram is shown in the image below?


A Class diagram

B Use case diagram

C Sequence diagram

D Activity diagram

B
This diagram shows an actor (“Customer”) interacting with two use cases: “Order a product” and “Pay for the order”. It illustrates system behavior from the user’s perspective.
 

6. What do the “+” and “-” symbols before attributes and methods represent?


A Nothing special, just style decorators

B Syntax errors

C “+” for method, “-” for attribute

D Visibility level: “+” for public, “-” for private

D
In UML, “+” means public, “-” means private, “#” would mean protected.
 
 

7. What is the purpose of a sequence diagram?


A Show class hierarchy

B Illustrate the evolution of an object over time

C Describe time-based interactions between objects

D Describe a system’s database

B
This diagram shows the order of messages exchanged between entities (actors, classes, systems) in a given scenario.
 

8. What are the rectangles that appear on lifelines during processing called?

A Actions

B Components

C Combined fragments

D Activation (or control focus)

D
An activation (or “control focus”) is a rectangle on a lifeline that indicates when an object is executing an operation. It shows the start and end of a method. Example:
 

A Client object calls the method pay() on an Invoice object. During this method’s execution, an activation is shown as a rectangle on Invoice’s lifeline.
 

9. UML is mainly used during which phase of software development?

A Maintenance phase

B Deployment phase

C Analysis and design

D Unit testing

C
UML (Unified Modeling Language) is primarily used during the analysis and design phase of software development to visually model the structure and behavior of a system before implementation. It helps in understanding requirements, designing architecture, and communicating ideas among stakeholders.
 
 

10. What is the correct way to represent “zero to many” multiplicity in a UML association?

A 0..0

B 0..*

C ..

D 1..*

B
In UML, 0..* means “zero or more” instances. It indicates that a class can be linked to none, one, or many instances of another class. Example:
 

One Book is owned by one or more Libraries. A Library can own zero or more Books.

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 *