TCS
10+ Shreeramaya Nidhi Interview Questions and Answers
Q1. What is a single page appliction?
A single page application is a web application that loads once and dynamically updates the content without refreshing the page.
Loads once and dynamically updates content
No page refreshes
Uses JavaScript frameworks like React to handle routing and rendering
Improves user experience by providing a seamless and responsive interface
Q2. what are fragments in react js
Fragments in React.js are used to group multiple elements without adding an extra node to the DOM.
Fragments are a way to group multiple elements without using a wrapper element.
They help in avoiding unnecessary divs in the DOM.
Fragments can improve performance by reducing the number of DOM nodes.
They are useful when returning multiple elements from a component's render method.
Fragments can be written using the
syntax or the shorthand <> syntax.
Q3. How the performance optimization can be done in React Js Application
Performance optimization in React Js can be achieved through code splitting, memoization, virtualization, and minimizing re-renders.
Implement code splitting to load only necessary components when needed
Use memoization techniques like useMemo and useCallback to prevent unnecessary re-renders
Implement virtualization for long lists or tables to render only visible items
Minimize re-renders by using shouldComponentUpdate or React.memo for functional components
Q4. What are the advantages of react?
React provides efficient and flexible UI rendering, component reusability, and easy integration with other libraries.
Virtual DOM allows for faster rendering and improved performance
Component-based architecture promotes reusability and modularity
Easy integration with other libraries and frameworks like Redux and React Native
JSX syntax allows for easy creation of complex UI components
React community provides a vast array of resources and support
Q5. What is useMemo and its usecases
useMemo is a hook in React that memoizes the result of a function and returns the cached value on subsequent renders.
useMemo is used to optimize performance by avoiding unnecessary re-renders.
It takes two arguments: a function and an array of dependencies.
The function is only re-executed if any of the dependencies change.
Common use cases include expensive calculations, filtering, and sorting.
Example: useMemo(() => calculateExpensiveValue(a, b), [a, b])
Q6. what is the purpose of useMemo and UseCallBack hook
useMemo and useCallback are hooks in React used for optimizing performance by memoizing values and functions respectively.
useMemo is used to memoize the result of a function so that it is only recomputed when its dependencies change.
useCallback is used to memoize a function instance so that it is not recreated on every render unless its dependencies change.
Both hooks help in optimizing performance by preventing unnecessary re-renders of components.
Example: useMemo(() => expen...read more
Q7. What is callback function? What are hooks?
Callback function is a function passed as an argument to another function to be executed later. Hooks are functions that let you use state and other React features without writing a class.
Callback function is used to handle asynchronous operations or events in JavaScript.
Example: setTimeout function takes a callback function as an argument to execute after a specified time.
Hooks are introduced in React 16.8 to allow functional components to use state and other React features....read more
Q8. What is react and tell the advantages of React.
React is a JavaScript library for building user interfaces.
Component-based architecture for reusability
Virtual DOM for efficient updates
One-way data binding for predictable data flow
Supports server-side rendering for SEO optimization
Q9. What are functional components
Functional components are a type of React component that are defined as a function rather than a class.
They are simpler and easier to read than class components.
They don't have state or lifecycle methods.
They receive props as an argument and return JSX.
They are often used for presentational components.
They can use React hooks to manage state and lifecycle.
Example: const MyComponent = (props) => { return
{props.text}}
Q10. From CSS - What is box model?
Box model is a fundamental concept in CSS which defines the spacing and dimensions of an element.
The box model consists of content, padding, border, and margin.
Content area is where the actual content of the element is displayed.
Padding is the space between the content and the border.
Border surrounds the padding and content.
Margin is the space outside the border, separating the element from other elements.
Example: div { width: 200px; padding: 20px; border: 1px solid black; ma...read more
Q11. difference between if else and ternary
Ternary operator is a shorthand for if else statement in JavaScript.
Ternary operator is written as condition ? expression1 : expression2
If the condition is true, expression1 is executed, else expression2 is executed
Ternary operator is more concise and can be used inline in JSX
Q12. Difference between let,var and const
let, var, and const are all used for variable declaration in JavaScript, but they have different scopes and behaviors.
let has block scope, var has function scope, and const is a constant that cannot be reassigned.
Using let allows you to declare variables that are limited to the scope of a block statement.
var variables are hoisted to the top of their function scope.
const variables must be initialized with a value and cannot be reassigned.
Q13. What is JSX in react
JSX is a syntax extension for JavaScript used in React to write HTML-like code within JavaScript.
JSX allows developers to write HTML-like code directly in their JavaScript files
It makes the code more readable and easier to understand
JSX gets transpiled into regular JavaScript by tools like Babel before being rendered by the browser
Q14. Explain redux flow in react
Redux flow in React involves actions, reducers, store, and components to manage state in a centralized manner.
Actions are dispatched to describe what happened in the application.
Reducers specify how the state changes in response to actions.
Store holds the state of the application.
Components can connect to the store to access and update the state.
Q15. Optimization in react
Optimization in React involves improving performance and efficiency of the application.
Use shouldComponentUpdate or PureComponent to prevent unnecessary re-renders
Avoid using inline functions in render method to prevent re-renders
Use keys in lists to help React identify which items have changed
Splitting components into smaller ones can improve performance
Use React.memo for functional components to memoize the result
Q16. Explain useSelector
useSelector is a hook provided by React-Redux for accessing the Redux store state in functional components.
Allows functional components to access the Redux store state without connecting to the store
Accepts a selector function as an argument to specify which part of the state to extract
Automatically subscribes to the Redux store updates and re-renders the component when the selected state changes
More about working at TCS
Interview Process at Shreeramaya Nidhi
Top Reactjs Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month