Recall & Review
beginner
What is the Single Responsibility Principle (SRP)?
SRP means a class or module should have only one reason to change. It should do one job only.Click to reveal answer
beginner
Why is SRP important in system design?
It makes code easier to understand, test, and maintain. Changes in one part don't affect others.
Click to reveal answer
beginner
Give a real-life example of SRP.
A car's steering system only controls direction. It doesn't handle engine or brakes. Each part has one job.
Click to reveal answer
intermediate
What can happen if SRP is ignored?
Classes become complex and hard to fix. One change may break many things, causing bugs.
Click to reveal answer
intermediate
How does SRP relate to maintainability?
With SRP, each part is simple and focused. This makes fixing and updating easier and safer.
Click to reveal answer
What does the Single Responsibility Principle state?
✗ Incorrect
SRP means each class or module should have only one reason to change.
Which is a benefit of following SRP?
✗ Incorrect
SRP makes code easier to maintain by keeping responsibilities separate.
Ignoring SRP can lead to:
✗ Incorrect
Ignoring SRP often causes complex classes and more bugs.
Which example best follows SRP?
✗ Incorrect
A class handling only user authentication follows SRP.
SRP helps in:
✗ Incorrect
SRP improves maintainability by keeping code focused.
Explain the Single Responsibility Principle and why it matters in system design.
Think about how one class should do only one job.
You got /3 concepts.
Describe a real-life analogy that helps understand SRP.
Consider parts of a car or kitchen tools.
You got /2 concepts.