Premium Employer

Infosys

3.7
based on 36.3k Reviews
Filter interviews by

Interview Questions and Answers

Updated 19 Aug 2024
Popular Designations

Q1. Explain about hooks and when useRef hook is used

Ans.

Hooks are functions that let you use state and other React features in functional components. useRef hook is used to persist a value between renders without causing a re-render.

  • Hooks are introduced in React 16.8 to allow state and lifecycle features in functional components.

  • useRef hook is used to persist a mutable value that won't trigger a re-render when changed.

  • It is commonly used to access DOM elements or store mutable values in functional components.

  • Example: const inputRe...read more

Add your answer

Q2. What are Higher order components?

Ans.

Higher order components are functions that take a component and return a new component with additional functionality.

  • Higher order components allow code reuse and logic sharing between components.

  • They are commonly used for adding props, state, or lifecycle methods to components.

  • Example: withAuth HOC can add authentication logic to a component.

Add your answer

Q3. How do you maintain code quality

Ans.

Code quality is maintained through code reviews, automated testing, coding standards, and continuous integration.

  • Regular code reviews by peers to catch errors and ensure best practices are followed

  • Implementing automated testing to catch bugs early in the development process

  • Enforcing coding standards and guidelines to maintain consistency and readability

  • Utilizing continuous integration tools to automate the build and testing process

Add your answer

Q4. What is lexical scope

Ans.

Lexical scope refers to the visibility of variables within a specific block of code.

  • Variables declared inside a function are only accessible within that function's scope.

  • Nested functions have access to variables declared in their outer function's scope.

  • Lexical scoping allows for closures, where inner functions retain access to outer function's variables even after the outer function has finished executing.

Add your answer
Discover null interview dos and don'ts from real experiences

Q5. Explain closusers and currying

Ans.

Closures are functions that have access to their own scope and the scope of their outer function. Currying is the process of converting a function that takes multiple arguments into a sequence of functions that each take a single argument.

  • Closures allow functions to retain access to variables from their containing scope even after the outer function has finished executing.

  • Currying allows for partial application of a function, where some arguments are provided and the function...read more

Add your answer

Q6. Component life cycle in react

Ans.

Component life cycle in React refers to the series of methods that are invoked at different stages of a component's existence.

  • Mounting: constructor, render, componentDidMount

  • Updating: render, componentDidUpdate

  • Unmounting: componentWillUnmount

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter