Computer

UML Diagrams & Software Design Patterns MCQs with Answers

Which UML diagram is used to represent the interactions between system components over time?
a) Class Diagram
b) Sequence Diagram
c) Component Diagram
d) Deployment Diagram

Answer
b) Sequence Diagram

Which of the following is NOT a type of UML diagram?
a) Use Case Diagram
b) Flowchart Diagram
c) Activity Diagram
d) State Diagram

Answer
b) Flowchart Diagram

In UML, which diagram represents the static structure of a system?
a) Class Diagram
b) Sequence Diagram
c) Activity Diagram
d) State Diagram

Answer
a) Class Diagram

Which design pattern ensures only one instance of a class is created?
a) Factory Pattern
b) Singleton Pattern
c) Observer Pattern
d) Prototype Pattern

Answer
b) Singleton Pattern

Which UML diagram is used to show the interactions between different objects in a system?
a) Use Case Diagram
b) Sequence Diagram
c) Activity Diagram
d) State Diagram

Answer
b) Sequence Diagram

Which design pattern provides a simplified interface to a larger system?
a) Facade Pattern
b) Adapter Pattern
c) Observer Pattern
d) Composite Pattern

Answer
a) Facade Pattern

What does a UML use case diagram primarily represent?
a) The dynamic behavior of a system
b) The relationships between system actors and use cases
c) The internal logic of a system
d) The physical structure of a system

Answer
b) The relationships between system actors and use cases

Which pattern is used when an object needs to notify multiple observers about changes?
a) Factory Pattern
b) Observer Pattern
c) Prototype Pattern
d) Strategy Pattern

Answer
b) Observer Pattern

Which UML diagram is most useful for modeling workflows and business processes?
a) Activity Diagram
b) Class Diagram
c) Deployment Diagram
d) Object Diagram

Answer
a) Activity Diagram

Which design pattern allows a class to change its behavior at runtime?
a) Strategy Pattern
b) Singleton Pattern
c) Factory Pattern
d) Observer Pattern

Answer
a) Strategy Pattern

Which UML diagram is used to represent object instances and their relationships?
a) Object Diagram
b) Sequence Diagram
c) Class Diagram
d) State Diagram

Answer
a) Object Diagram

Which design pattern is used to create objects without specifying their exact class?
a) Factory Pattern
b) Singleton Pattern
c) Adapter Pattern
d) Decorator Pattern

Answer
a) Factory Pattern

Which UML diagram represents the physical deployment of software components?
a) Class Diagram
b) Use Case Diagram
c) Deployment Diagram
d) Activity Diagram

Answer
c) Deployment Diagram

Which pattern is used when one object controls access to another?
a) Proxy Pattern
b) Singleton Pattern
c) Composite Pattern
d) Factory Pattern

Answer
a) Proxy Pattern

Which UML diagram is used to model a system’s finite states and transitions?
a) Activity Diagram
b) State Diagram
c) Sequence Diagram
d) Class Diagram

Answer
b) State Diagram

Which design pattern allows objects to be created from a prototype?
a) Prototype Pattern
b) Factory Pattern
c) Adapter Pattern
d) Facade Pattern

Answer
a) Prototype Pattern

Which UML diagram is used to show relationships between system components?
a) Component Diagram
b) Activity Diagram
c) Sequence Diagram
d) State Diagram

Answer
a) Component Diagram

Which pattern is used to structure objects into tree hierarchies?
a) Composite Pattern
b) Bridge Pattern
c) Proxy Pattern
d) Factory Pattern

Answer
a) Composite Pattern

What is the primary purpose of an Adapter Pattern?
a) To create a simplified interface for a complex system
b) To convert an interface into one that clients expect
c) To define a one-to-many dependency between objects
d) To create an instance of a class only once

Answer
b) To convert an interface into one that clients expect

Which UML diagram is used to visualize interactions between objects at runtime?
a) Object Diagram
b) Sequence Diagram
c) Class Diagram
d) Deployment Diagram

Answer
b) Sequence Diagram

Which design pattern is used for allowing multiple objects to handle a request?
a) Chain of Responsibility Pattern
b) Observer Pattern
c) Singleton Pattern
d) Prototype Pattern

Answer
a) Chain of Responsibility Pattern

Which UML diagram models the flow of control or data in a system?
a) Sequence Diagram
b) Activity Diagram
c) Deployment Diagram
d) Object Diagram

Answer
b) Activity Diagram

Which pattern provides a way to traverse elements of a collection without exposing its structure?
a) Iterator Pattern
b) Facade Pattern
c) Singleton Pattern
d) Composite Pattern

Answer
a) Iterator Pattern

Which UML diagram is used to model high-level system interactions?
a) Use Case Diagram
b) Class Diagram
c) Deployment Diagram
d) Object Diagram

Answer
a) Use Case Diagram

Which pattern is used when objects need to communicate without knowing each other’s identities?
a) Mediator Pattern
b) Observer Pattern
c) Facade Pattern
d) Singleton Pattern

Answer
a) Mediator Pattern

Which UML diagram represents the detailed structure of a class and its attributes?
a) Class Diagram
b) Sequence Diagram
c) Activity Diagram
d) Component Diagram

Answer
a) Class Diagram

Which design pattern allows objects to behave differently based on their state?
a) State Pattern
b) Strategy Pattern
c) Singleton Pattern
d) Observer Pattern

Answer
a) State Pattern

Which UML diagram is most useful for system architects designing software deployment?
a) Deployment Diagram
b) Activity Diagram
c) Use Case Diagram
d) Object Diagram

Answer
a) Deployment Diagram

Which pattern provides a way to access elements of an aggregate object sequentially?
a) Iterator Pattern
b) Composite Pattern
c) Proxy Pattern
d) Observer Pattern

Answer
a) Iterator Pattern

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button