Frontend Engineer Interview Questions & Answers
React.js
Q1: What is React and why is it used?
A: React is a JavaScript library for building UI components efficiently using a virtual DOM.
Q2: Explain the concept of Virtual DOM.
A: Virtual DOM is a lightweight copy of the real DOM, making updates faster.
Q3: What are React Hooks? Name a few.
A: Hooks let you use state and lifecycle methods in functional components. Examples: useState,
useEffect.
Q4: Difference between class and functional components?
A: Class components use lifecycle methods, functional components use hooks.
Q5: How does React handle state management?
A: React uses useState for local state and Redux for global state.
Q6: Explain React's reconciliation process.
A: React compares the Virtual DOM with the real DOM and updates only the changed parts.
Q7: What is React Context API?
A: Context API is used to pass data without prop drilling.
Q8: Explain lazy loading in React.
A: Lazy loading defers component loading until needed, improving performance.
Q9: How do you handle API calls in React?
A: Use fetch, axios, or libraries like React Query inside useEffect.
Q10: How do you optimize React performance?
A: Using memoization, avoiding unnecessary re-renders, and optimizing component structure.
Angular
Q1: What is Angular and its key features?
A: Angular is a TypeScript-based framework for building single-page applications.
Q2: Explain Angular lifecycle hooks.
A: Hooks like ngOnInit, ngOnDestroy allow control over component behavior.
Q3: What are directives in Angular?
A: Directives like *ngIf and *ngFor manipulate DOM elements.
Q4: Difference between services and components?
A: Services manage logic and data, components handle UI rendering.
Q5: What is dependency injection in Angular?
A: A design pattern where dependencies are provided rather than created.
Q6: Explain RxJS in Angular.
A: RxJS is used for reactive programming with observables.
Q7: How does Angular handle forms?
A: Template-driven and reactive forms for handling user input.
Q8: What is Angular CLI?
A: Command-line tool to create, build, and manage Angular projects.
Q9: How does routing work in Angular?
A: Router module manages navigation between views.
Q10: How do you handle HTTP requests in Angular?
A: Using HttpClientModule for GET, POST, PUT, DELETE operations.