Airbnb Interview Questions
Practice with real Airbnb interview questions
01
A Software Engineer was asked
Asked in 2024
Q. How would you implement a simple class in Python that demonstrates the four pillars of Object-Oriented Programming: encapsulation, abstraction, inheritance, and polymorphism?
Ans. Here's an example of how to implement these concepts in Python:
In this code:
- Encapsulation is demonstrated through the protected attribute
_name.
- Abstraction is shown with the speak method in the Animal class.
- Inheritance is seen in Dog and Cat classes that extend Animal.
- Polymorphism occurs as we can call the speak method on different animal objects and get different results based on the object type.Software EngineerCore Concept
02
A Frontend Developer was asked
Asked in 2024
Q. Describe the core concepts of React components and props, and provide an example of passing props to a component.
Ans. In React, components are the building blocks of the UI. A component can be a class or a function that returns a React element. Props (short for properties) are used to pass data from a parent component to a child component. Here’s an example:
In this example,
Greeting is a functional component that receives name as a prop. The App component passes 'Airbnb User' as a prop to Greeting. Always ensure to validate props using PropTypes or TypeScript to avoid runtime errors.
Frontend DeveloperCore Concept
