UML MCQ

UML Diagrams MCQs Questions With Answers – Part 33

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 purpose of OCL (Object Constraint Language) constraints in UML?

A To define user permissions

B To specify formal logical rules on a model

C To compile a UML model

D To automatically generate source code

B
OCL is a declarative language used to add precise constraints (like self.solde >= 0) to a UML model. It helps validate the model’s consistency.
 

2. Which arrow symbolizes a dependency between two UML packages?

A A continuous line with a diamond

B A dashed white arrow

C A solid black arrow

D A curved arrow

B
Dependencies (between packages, classes, etc.) are represented by a dashed arrow pointing to the element being depended on. It shows that the source package uses the contents of the target package. Example:
 

This shows, for example, that the “Payment” module needs access to user information.
 

3. In a component diagram, a provided interface is represented by:

A A rectangle with <<interface>>

B A half-moon pointing outward

C A filled circle connected to a component

D An arrow directed towards an abstract class

C
A provided interface is represented by a circle (lollipop) attached to the component. This means the component implements and exposes this interface to others. Example:
 
 
 

4. Which UML approach is used to model systems distributed across multiple levels of abstraction?

A Multiple inheritance

B A single metamodel

C Weak aggregation

D Multi-level modeling

D
Multi-level modeling allows defining models of models (metamodeling), which is useful for complex systems like those in systems engineering or domain-specific modeling (DSM).
 

5. In a component diagram, a required interface is represented by:

A A circle

B A square

C A half-moon open (socket)

D A diamond

C
A required interface (what a component needs) is represented by a half-moon pointing outward. Example:
 
 

6. You want to represent that a print server receives requests from multiple clients. Which UML diagram would help?

A Activity diagram

B Class diagram

C Communication diagram

D Sequence diagram

C
Perfect for illustrating interactions between objects without focusing on the temporal order. Example:
 
 
 

7. You want to show that the “Card” object is created in a sequence diagram. Which arrow should you use?

A Solid arrow with <<create>>

B Dashed arrow with new()

C Solid arrow with return

D Loop arrow

A
UML uses the <<create>> stereotype to indicate object creation. Example:
 

The <<create>> stereotype is used to signal the birth of an object during an interaction.
 

8. What is the purpose of the <<utility>> stereotype?


A To create an abstract class

B To create a temporary object

C To indicate a static (utility) class

D To indicate an interface

C
<<utility>> is used to group static methods, like in Java or Python (helper class).
 

9. In a library management app, a subscriber card is associated with exactly one subscriber. What is the multiplicity on the “subscriber” side?

A 0..*

B 1

C 1..*

D 0..1

B
Each card is linked to exactly one subscriber, so multiplicity = 1. Example:
 
 
 

10. What does {readOnly} mean here?


A The name is hidden

B The name is private

C The name is linked to an interface

D The name cannot be modified after initialization

D
{readOnly} is a UML constraint indicating that the attribute is read-only.
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 *