Capgemini Engineering
10+ Ethiraj Associates Interview Questions and Answers
Q1. What are Hooks in React? Name the ones you have used in your project.
Hooks are a feature introduced in React 16.8 that allow developers to use state and other React features in functional components.
useState() - for managing state in functional components
useEffect() - for performing side effects in functional components
useContext() - for accessing context in functional components
useReducer() - for managing complex state and actions in functional components
useCallback() - for memoizing functions in functional components
useMemo() - for memoizing...read more
Q2. What are Higher Order Functions and Higher Order Components. Give examples.
Higher Order Functions are functions that take other functions as arguments or return functions as their results.
Higher Order Functions can be used to create reusable code by abstracting common functionality into a separate function.
They can also be used to implement functional programming concepts like currying and composition.
Example: Array.prototype.map() is a higher order function that takes a callback function as an argument and applies it to each element of an array, re...read more
Q3. How does Event Loop works? What are Event Queue and Event Stack?
Event Loop is a mechanism that allows JavaScript to handle asynchronous operations.
Event Loop is a continuous process that checks the Event Queue and moves events to the Event Stack.
Event Queue holds all the events that are waiting to be processed.
Event Stack holds the events that are currently being processed.
When the Event Stack is empty, the Event Loop checks the Event Queue for new events.
JavaScript uses Event Loop to handle asynchronous operations like setTimeout(), setI...read more
Q4. Difference between Let, Const and Var. Write code and explain.
Let, Const, and Var are used to declare variables in JavaScript with different scoping and reassignment abilities.
Var has function scope and can be redeclared and reassigned.
Let has block scope and can be reassigned but not redeclared.
Const has block scope and cannot be reassigned or redeclared.
Q5. How can you optimize a React App?
Optimizing a React app involves reducing bundle size, using lazy loading, and optimizing rendering performance.
Reduce bundle size by code splitting and using dynamic imports
Use lazy loading to load components only when needed
Optimize rendering performance by using shouldComponentUpdate and PureComponent
Use React.memo to memoize functional components
Avoid unnecessary re-renders by using useMemo and useCallback
Use performance profiling tools like React DevTools and Chrome DevTo...read more
Q6. What are state and props. Difference.
State and props are two important concepts in React. State represents the internal data of a component, while props are used to pass data from a parent component to a child component.
State is mutable and can be changed within a component.
Props are read-only and cannot be modified within a component.
State is used to manage component-specific data, while props are used for inter-component communication.
State is initialized and managed within a component, while props are passed ...read more
Q7. Difference between Local and Session Storage
Local Storage is persistent storage that remains even after the browser is closed, while Session Storage is temporary and is cleared when the browser is closed.
Local Storage has no expiration date, while Session Storage is cleared when the session ends
Local Storage can store larger amounts of data compared to Session Storage
Local Storage is accessible across different browser tabs and windows, while Session Storage is limited to the current tab or window
Local Storage can be a...read more
Q8. Difference between Promise and Async-Await?
Promise is a callback function that returns a value in the future. Async-Await is a syntax that simplifies working with Promises.
Promises are used to handle asynchronous operations and avoid callback hell.
Async-Await is a syntax that allows writing asynchronous code that looks like synchronous code.
Async-Await is built on top of Promises and uses the same underlying mechanism.
Async-Await can only be used within an async function.
Async-Await can handle errors using try-catch b...read more
Q9. What is Hoisting in JS?
Hoisting is a JavaScript behavior where variable and function declarations are moved to the top of their scope.
Hoisting applies to both variable and function declarations.
Variable declarations are hoisted but not their initializations.
Function declarations are fully hoisted, including their definitions.
Hoisting can lead to unexpected behavior if not understood properly.
Q10. What are Closures in JS?
Closures are functions that have access to variables in their outer scope, even after the outer function has returned.
Closures are created when a function is defined inside another function.
The inner function has access to the outer function's variables and parameters.
Closures can be used to create private variables and methods.
Closures can also be used to create functions with pre-set arguments.
Q11. What is Context API?
Context API is a feature in React that allows data to be passed down the component tree without manually passing props at each level.
Context API provides a way to share data between components without the need for prop drilling.
It consists of two main components: Provider and Consumer.
The Provider component allows data to be provided and accessed by any component within its subtree.
The Consumer component allows components to consume the data provided by the Provider.
Context A...read more
Q12. Explain Redux workflow.
Redux is a state management library for JavaScript applications, providing a predictable and centralized workflow.
Redux follows a unidirectional data flow pattern.
The application state is stored in a single JavaScript object called the store.
Actions are dispatched to describe state changes.
Reducers are pure functions that specify how the state should change based on the dispatched actions.
Selectors are used to extract specific data from the store.
Middleware can be used to add...read more
Top React Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month