Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/piyalidas10/oops-interview-preparation

OOPs Interview Questions and Answers
https://github.com/piyalidas10/oops-interview-preparation

interview javascript oops typescript

Last synced: about 1 month ago
JSON representation

OOPs Interview Questions and Answers

Awesome Lists containing this project

README

        

# OOPS-Interview-Preparation
| No. | Questions & Answers |
| --- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | Encapsulation implementaion in JavaScipt & TypeScript?

1. In JavaScript, encapsulation is achieved by using closures and access modifiers, such as the private and public keywords.
2. In NestJS, encapsulation is observed in how services and controllers are constructed and used.
3. In TypeScript, we can achieve encapsulation using access modifiers (public, private, protected). TypeScript supports the use of accessors, also known as getters and setters, to provide controlled access to class properties. Getters and setters allow us to define custom logic when retrieving or assigning property values, enabling better encapsulation and validation.
https://medium.com/@piyalidas.it/encapsulation-practical-uses-22d5f5b9e697
| 2 | Inheritance implementaion in JavaScipt & TypeScript?

1. In JavaScript, inheritance is achieved by using the prototype property and the Object.create() method.
2. TypeScript supports single inheritance, where a class can inherit from a single base class. TypeScript supports multiple inheritance using Interfaces.
https://medium.com/@piyalidas.it/inheritance-practical-uses-0c95884e880d
| 3 | Polymorphism implementaion in JavaScipt & TypeScript?

1. In JavaScript, polymorphism is achieved by using function overloading and function overriding.
2. TypeScript supports polymorphism through inheritance and interfaces.
3. Generics in TypeScript are a way to implement parametric polymorphism.
https://medium.com/@piyalidas.it/polymorphism-practical-uses-2ed5d029589a
| 4 | Abstraction implementaion in JavaScipt & TypeScript?

1. In TypeScript, abstraction is achieved through classes and interfaces.
2. In JavaScript, the concept of an abstract class is not natively supported as it is in other languages such as Java, TypeScript, and Python.
https://medium.com/@piyalidas.it/abstraction-practical-uses-febbe3c65bb6