UML MCQ

UML Diagrams MCQs Questions With Answers – Part 32

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 does this arrow –|> indicate?


A A simple dependency

B Inheritance between components

C The component provides the IPaiement interface

D The component contains IPaiement

C
In a component diagram, a solid arrow toward an interface means the component provides it—i.e., it implements that contract.
 

2. What mechanism allows adapting a UML model to different contexts using parameters?

A Profiles

B Stereotyped models

C Parameterized models

D Composite structures

C
A parameterized model is a UML template containing formal parameters (like types or classes), allowing multiple model versions to be created by instantiating them.
 

3. You’re building a banking app. You want to show that a checking account and a savings account are types of bank accounts. What UML concept applies?

A Generalization

B Association

C Dependency

D Composition

A
The bank account is a parent class, the others are subclasses → inheritance. Example:
 
 
 

4. In a state diagram, what does an entry action mean?

A An action performed when exiting the state

B An action executed if a guard is true

C An action executed every time the state is entered

D An action triggered only manually

C
Entry actions are automatically executed when entering a state, useful for initialization, triggering animations, etc.
 

5. What is the purpose of {invariant total >= 0}?


A To limit the number of orders

B To link two classes

C To indicate a default value

D To define an OCL (Object Constraint Language) constraint on objects

D
OCL invariants define business logic rules that every instance must comply with.
 

6. What does this “alt” block with “stock error” represent?


A To model an exception or alternate scenario

B To test attributes

C To perform a loop

D To display a secondary diagram

A
In a sequence diagram, “alt” can be used for conditional branches, including error or exception handling.
 
 

7. What does this state diagram model?


A Two independent states

B Transitions between classes

C An infinite loop

D A composite state containing its own substates

D
UML allows for nested states, which are useful for complex objects with internal behaviors.
 

8. What is the role of the word “owns” here?


A It’s a class type

B It’s an attribute name

C It’s an association name describing the role of the relationship

D It’s a method

C
Naming a relationship improves the diagram’s readability by clarifying the logical link between two classes.
 

9. What does this structure model?


A A multiple composition

B An n-ary association between several classes

C A generic interface

D A composite state

B
An n-ary association connects 3 or more classes, typically represented using an intermediate class.
 
 

10. What is the purpose of an association class?

A To associate two abstract classes

B To add attributes to a relationship between two classes

C To define a class without attributes

D To represent a multiple aggregation

B
When a relationship between two classes needs to store its own data (like a start date), it becomes an association class linked to that relationship. Example:
 

You can’t store things like startDate directly in a simple association, so it’s modeled as a dedicated class connected to both classes.
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 *