Interview Q&A / Object-Oriented Programming

INTERVIEW Q&A · 69 QUESTIONS

Object-Oriented Programming interview questions

The four pillars, interfaces, abstract classes and design basics.

  1. A class calculates salary, saves it to the database and prints a payslip. How does it break SRP, and how do you fix it?

    It has three reasons to change: pay rules, database layout and payslip format. Split it into three classes, each with one job, and let a small coordinator call them.

    BeginnerQuick answer1 min read