← Quiz: SOLID Principles: all 10 questions
Quiz: SOLID Principles · Question 1 of 10
A class calculates salary, formats the payslip PDF and saves it to the database. Which principle does it break?
A class calculates salary, formats the payslip PDF and saves it to the database. Which principle does it break?
- A.Liskov Substitution
- B.Single Responsibility
- C.Interface Segregation
- D.Dependency Inversion
Answer & explanation
Correct answer: Single Responsibility
Payroll rules, payslip layout and storage are three different reasons to change.
Can you get the rest right without peeking?
Take the timed Quiz: SOLID Principles quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →