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. The UML communication diagram is used to represent:
A Data flows between databases
B Messages exchanged between objects (with their static structure)
C Class structure
D State transitions
B
The communication (or collaboration) diagram shows how objects interact with each other, highlighting the links and exchanged messages. Example:
2. Which of these UML diagrams is structural (and not behavioral)?
A Sequence diagram
B Use case diagram
C Activity diagram
D Class diagram
D
Structural diagrams describe the static composition of the system (e.g., classes, objects, components). The others are behavioral, related to what the system does.
3. In UML, what is an operation provided by an interface called?
A A virtual method
B A service
C A responsibility
D An abstract operation
D
UML interfaces define abstract operations, which the implementing classes must realize. Example:
Interface Animal defines two abstract operations: eat() and sleep(). These methods have no implementation in the interface itself. Classes Dog and Cat implement the Animal interface. This means they must realize the eat() and sleep() methods (not shown here, but assumed to be implemented in the classes).
4. What is the correct representation of an interface in a class diagram?
A A rectangle with the keyword <<interface>>
B A circle with a name inside
C An abstract class in italics
D An arrow pointing to a concrete class
A
In UML, an interface is represented like a class, but with the stereotype <<interface>> above the name. Sometimes it may also be shown as a small circle (called “lollipop” notation). Example:
5. How is an abstract class usually represented?
A Its name is bold
B Its name is underlined
C Its name is italicized
D It has a black arrow
C
An abstract class cannot be instantiated directly. In UML, its name is written in italics in class diagrams. Example:
abstract class Animal is the abstract base class. It can have:
Attributes (e.g. name, age)
Concrete methods (e.g., eat())
Abstract methods (e.g., makeSound()) – methods that subclasses must implement.
Dog and Cat are concrete subclasses that inherit from Animal and must implement makeSound().
6. In a class diagram, what does an arrow with a black diamond mean?
A A dependency
B A composition
C An aggregation
D A simple association
B
The black diamond indicates a composition, a strong whole-part relationship. The contained object cannot exist without the container. Example:
7. In UML, the sequence diagram mainly shows:
A Dependency relationships
B Object transitions
C The temporal order of interactions
D The logical structure of classes
C
The sequence diagram emphasizes the order of messages exchanged between objects over time—perfect for describing a business scenario. Example:
image source: wikimedia.org
8. The use case diagram is useful to __________
A Detail the database
B Define user roles and their interactions with the system
C Draw the logical structure of an API
D Specify software components
B
The use case diagram focuses on functional needs: what do users want to do? It’s perfect for the early stages of analysis. Example:
9. Which of these UML diagrams shows the internal state of an object over time?
A Activity diagram
B Class diagram
C State diagram
D Communication diagram
C
The state diagram (or state-transition diagram) represents the various states of an object (e.g., connected, paused, inactive) and the events that trigger transitions. Example:
image source: wikimedia.org
10. Which UML relationship indicates that a class “uses” another class, e.g., as a parameter or within a method?
A Association
B Dependency
C Inheritance
D Composition
B
A dependency is a weak relationship: one class temporarily uses another (e.g., passing an object as a method parameter). Represented by a dotted arrow. Example:
MCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More