← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
PayPal's "Building Interface Implementation (School/Hospital)" interview question focuses on OOP design using interfaces to model buildings with varying functionalities.
Design an interface-based system for buildings like schools and hospitals. Create a Building interface with core methods (e.g., open(), close(), getCapacity()), then implement concrete classes School and Hospital that extend it with domain-specific behaviors like conductClass() for School or treatPatient() for Hospital. Emphasize polymorphism, abstraction, and extensibility for adding more building types.[1]
No explicit I/O formats are provided, as this is a design exercise. Typical test cases include:
School s = new School(1000); s.open(); s.conductClass("Math");
Output: Building opens; class scheduled for 1000 capacity.[2]Hospital h = new Hospital(500); h.treatPatient("flu");
Output: Patient treated in appropriate ward.[2]List<Building> buildings = Arrays.asList(new School(), new Hospital()); for(Building b : buildings) b.open(); – All open uniformly.