Infosys
20+ Sneha Junior College Interview Questions and Answers
Q1. what is callback, event deligaton, react reconcillaton, react life cycle methods
Callbacks, event delegation, React reconciliation, and React lifecycle methods are key concepts in React development.
Callback functions are functions passed as arguments to be executed later, commonly used in event handling and asynchronous operations.
Event delegation is a technique where a single event listener is attached to a parent element to manage events for multiple child elements.
React reconciliation is the process of updating the DOM to match the virtual DOM represen...read more
Q2. What is first paint and temporal dead zone
First paint refers to the time when the browser starts rendering pixels to the screen. Temporal dead zone is a period in JavaScript where a variable exists but cannot be accessed.
First paint is the time when the browser starts rendering content on the screen.
Temporal dead zone is a period in JavaScript where a variable is declared but cannot be accessed due to the variable being in an inaccessible state.
Example: const x = 10; console.log(x); // This will throw a ReferenceErro...read more
Q3. What is closures explain about it
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, even after the outer function has returned.
Closures can be used to create private variables and functions in JavaScript.
Example: function outer() { let x = 10; function inner() { console.log(x); } return inner; } const closur...read more
Q4. what is first class function and
A first class function is a function that can be treated like any other variable in a programming language.
Can be passed as an argument to other functions
Can be returned from other functions
Can be assigned to variables
Can be stored in data structures
Q5. What is hoisting explain about it
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope.
Hoisting applies to variable and function declarations, not initializations
Function declarations are hoisted before variable declarations
Variables declared with let and const are not hoisted
Hoisting can lead to unexpected behavior and should be avoided
Q6. Coding question reversing of own name spelling
Reverse the spelling of your own name
Create a function that takes a string as input
Use the split, reverse, and join methods to reverse the spelling of the name
Return the reversed name
Q7. Diff between virtual dom and original dom
Virtual DOM is a lightweight copy of the original DOM that React uses to improve performance by minimizing actual DOM manipulation.
Virtual DOM is a representation of the actual DOM in memory.
React compares the virtual DOM with the original DOM and only updates the parts that have changed.
Virtual DOM updates are faster than directly manipulating the original DOM.
Virtual DOM helps in optimizing performance by reducing the number of DOM manipulations.
Example: When a user interac...read more
Q8. Create a table component from array of objects
Create a table component from array of objects in React JS
Map through the array of objects to render rows in the table
Use Object.keys() to dynamically generate table headers
Utilize CSS for styling the table
Q9. example is given to call an dummy api
To call a dummy API, use fetch() method with the API URL and handle the response using .then()
Use fetch() method to make a GET request to the dummy API URL
Handle the response using .then() method to access the data returned by the API
You can also use async/await syntax for cleaner code
Q10. What is closure
A closure is a function that has access to its own scope, as well as the scope in which it was defined.
A closure allows a function to access variables from an outer function even after the outer function has finished executing.
Closures are commonly used to create private variables in JavaScript.
Example: function outerFunction() { let outerVar = 'I am outer'; return function innerFunction() { console.log(outerVar); }; }
Q11. What is webworkers
Web Workers are a way to run JavaScript code in the background, separate from the main thread of the web application.
Web Workers allow for multi-threading in JavaScript, improving performance by offloading tasks to separate threads.
They can be used for tasks like heavy calculations, image processing, or other CPU-intensive operations.
Communication between the main thread and Web Workers is done through message passing.
Web Workers are supported in modern browsers and can be cr...read more
Q12. Detailed explanation of useffect
useEffect is a React hook that allows for side effects in functional components.
useEffect is used to perform side effects in functional components.
It runs after every render by default.
It can be used to fetch data, subscribe to events, update the DOM, and more.
To run useEffect only once, pass an empty array as the second argument.
To clean up effects, return a function from useEffect.
Q13. difference between map and filter
Map is used to transform each element of an array, while filter is used to select elements based on a condition.
Map returns a new array with the same length as the original array, but with each element transformed based on a function.
Filter returns a new array with only the elements that pass a certain condition specified by a function.
Q14. What is hooks in react
Hooks in React are functions that let you use state and other React features without writing a class.
Hooks were introduced in React 16.8.
They allow you to use state and other React features in functional components.
Some commonly used hooks are useState, useEffect, useContext, and useRef.
Hooks help in reusing stateful logic across components.
Example: useState hook is used to add state to a functional component.
Q15. Difference between props and data
Props are used to pass data from parent to child components in React, while data refers to the information stored within a component.
Props are read-only and cannot be modified by the child component.
Data is mutable and can be changed within the component.
Props are passed down from parent to child components, while data is stored within the component itself.
Example: Passing a 'name' prop from a parent component to a child component to display the name.
Example: Storing a list o...read more
Q16. What is hoisting
Hoisting is a JavaScript mechanism where variable and function declarations are moved to the top of their containing scope.
Variable declarations are hoisted to the top of their scope, but not their initializations.
Function declarations are fully hoisted, meaning they can be called before they are declared.
Hoisting can lead to unexpected behavior if not understood properly.
Q17. What is event loop
Event loop is a mechanism in JavaScript that allows for asynchronous operations to be executed in a non-blocking way.
Event loop is responsible for handling the execution of code in a single-threaded environment.
It continuously checks the call stack for any functions that need to be executed.
If the call stack is empty, it looks at the task queue for any pending tasks to be executed.
Event loop ensures that JavaScript remains responsive by handling asynchronous operations effici...read more
Q18. What is react js
React JS is a JavaScript library for building user interfaces.
React JS is a front-end library developed by Facebook.
It allows developers to create interactive user interfaces.
React uses a component-based architecture for building reusable UI components.
It uses a virtual DOM for efficient rendering of UI components.
React can be used to build single-page applications, mobile apps, and more.
Q19. implementing redux
Implementing Redux in a React application involves several steps to manage state globally.
Install Redux and React-Redux libraries using npm or yarn.
Create a Redux store to hold the state of the application.
Define reducers to specify how the state should change in response to actions.
Dispatch actions to update the state in the Redux store.
Connect React components to the Redux store using the connect function from React-Redux.
Access the state in components using mapStateToProps...read more
Q20. Native area details?
Native area details refer to the specific region or location where a particular group of people or species naturally reside or originate from.
Native area details are important for understanding the natural habitat and distribution of a particular group.
Examples include the native area details of certain plant species, animal species, or indigenous human populations.
Studying native area details can help in conservation efforts and understanding biodiversity.
Q21. destructiring of array
Destructuring of array is a way to unpack values from arrays into distinct variables.
Use square brackets to destructure an array.
Assign variables in the order of array elements.
Can skip elements using commas.
Can use rest syntax to capture remaining elements.
Example: const [first, second, ...rest] = ['apple', 'banana', 'cherry', 'date'];
Q22. lifecycle of reactjs
ReactJS lifecycle methods control the behavior of components at different stages of their lifecycle.
Mounting: constructor, render, componentDidMount
Updating: shouldComponentUpdate, render, componentDidUpdate
Unmounting: componentWillUnmount
Interview Process at Sneha Junior College
Top React Js Frontend Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month