Tech Mahindra
10+ Interview Questions and Answers
Q1. What is the difference between state and props in reaact?
State is mutable and managed within a component, while props are immutable and passed from parent to child components.
State is used to manage internal data within a component.
Props are used to pass data from parent to child components.
State can be changed using the setState() method.
Props are read-only and cannot be modified by the component receiving them.
State is local to a component, while props can be accessed by multiple components.
Example: State can be used to store for...read more
Q2. What is React.js and what are its key features?
React.js is a JavaScript library for building user interfaces.
React.js is a popular front-end library developed by Facebook.
It allows developers to build reusable UI components.
React.js uses a virtual DOM for efficient rendering and updates.
It follows a component-based architecture, making it easy to manage and maintain code.
React.js supports server-side rendering for improved performance and SEO.
It has a rich ecosystem with a large community and extensive documentation.
Q3. What is React Router, and how does it works?
React Router is a library that allows for routing in React applications, enabling navigation between different components.
React Router is a popular routing library for React applications.
It provides a way to handle navigation and rendering of different components based on the URL.
React Router uses a declarative approach, allowing developers to define routes using components.
It supports different types of routing, including browser history, hash history, and memory history.
Rea...read more
Q4. What is the significance of keys in React list?
Keys in React list help identify and track individual items, improving performance and enabling efficient updates.
Keys help React identify which items have changed, been added, or been removed in a list.
They help improve performance by allowing React to reuse existing DOM elements instead of creating new ones.
Keys also help maintain component state and prevent unnecessary re-rendering of components.
Keys should be unique within the list and stable across re-renders to ensure p...read more
Q5. Last and what I learnt in full stack Java
I have experience in full stack Java development and have learned various technologies and frameworks.
I have worked with Java, Spring Boot, and Hibernate for backend development.
I have experience in front-end development using HTML, CSS, and JavaScript.
I have used frameworks like Angular and React for building user interfaces.
I have knowledge of databases like MySQL and MongoDB for data storage.
I have learned about RESTful APIs and have implemented them in my projects.
Q6. What is CSS why are you using a CSS
CSS stands for Cascading Style Sheets and is used to style the appearance of web pages.
CSS is used to control the layout, colors, fonts, and other visual aspects of a website.
It helps in separating the content of a website from its design, making it easier to update and maintain.
CSS can be applied inline, internally within the HTML document, or externally in a separate CSS file.
Selectors in CSS allow targeting specific elements to apply styles.
CSS can also be used for creatin...read more
Q7. What is JSX and why is it used in React.
JSX is a syntax extension for JavaScript used in React to write HTML-like code in JavaScript.
JSX allows developers to write HTML-like code in JavaScript, making it easier to create and manipulate UI components.
It combines the power of JavaScript and HTML into a single syntax, allowing developers to write more expressive and concise code.
JSX is transpiled into regular JavaScript code by tools like Babel before being executed by the browser.
It helps in creating reusable compone...read more
Q8. What is the rate of 1 out of 10 ?
The rate of 1 out of 10 is 10%.
The rate of 1 out of 10 can be expressed as a fraction: 1/10.
To convert the fraction to a percentage, divide the numerator by the denominator and multiply by 100.
In this case, 1 divided by 10 equals 0.1, which when multiplied by 100 gives 10%.
Q9. Explain the concept of Vitual DOM in React.
Virtual DOM is a concept in React where a lightweight copy of the actual DOM is created and manipulated for efficient rendering.
Virtual DOM is a JavaScript representation of the actual DOM.
It allows React to efficiently update and render only the necessary parts of the UI.
When there are changes in the state or props, React creates a new virtual DOM tree and compares it with the previous one.
React then updates only the differences between the two virtual DOM trees in the actua...read more
Q10. Describe the component lifecycle in React.
The component lifecycle in React refers to the different stages a component goes through from creation to deletion.
The lifecycle methods in React can be divided into three main phases: Mounting, Updating, and Unmounting.
During the Mounting phase, the component is created and inserted into the DOM.
During the Updating phase, the component can be re-rendered due to changes in props or state.
During the Unmounting phase, the component is removed from the DOM.
Some commonly used lif...read more
Q11. How does data flow in React?
Data flows in React through a unidirectional flow called props and state.
Data flows from parent components to child components through props.
Child components can modify the data by calling functions passed as props.
State is used to manage data within a component and can be updated using setState().
Changes in state trigger re-rendering of the component and its child components.
Q12. What is HTML important of html
HTML is important for creating the structure of web pages and displaying content on the internet.
HTML is the standard markup language used to create web pages.
It provides the structure for content on the internet, including text, images, links, and more.
HTML elements are used to define the different parts of a web page, such as headings, paragraphs, lists, and tables.
It works in conjunction with CSS for styling and JavaScript for interactivity.
Example:
This is a heading
Q13. Why are you using a bootstrap
Bootstrap is a popular front-end framework for building responsive and mobile-first websites.
Bootstrap provides a grid system for easy layout design
It includes pre-designed components like buttons, forms, and navigation bars
Bootstrap's responsive utilities make it easy to create mobile-friendly websites
Q14. How does React handle forms?
React handles forms using controlled components and state management.
React uses controlled components to manage form input state.
Form input values are stored in the component's state and updated through event handlers.
React provides event handlers like onChange to handle form input changes.
Form submission can be handled using onSubmit event handler.
Validation and error handling can be implemented using conditional rendering and state management.
Q15. Explain the concept of state in React.
State in React is a JavaScript object that stores data and controls the behavior of a component.
State is used to manage and update data within a component.
It is mutable and can be changed using the setState() method.
State allows components to re-render and reflect changes in the UI.
State is local and specific to each instance of a component.
State can be passed down to child components as props.
Top HR Questions asked in null
Interview Process at null
Top Web Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month