Interview Questions and Answers (React, Web, OS, JS, Tools)
1. What is React JS?
Answer: React JS is a JavaScript library for building user interfaces, maintained by Facebook.
2. What are the key features of React?
Answer: JSX, Components, Virtual DOM, One-way data binding, and Performance optimization.
3. What is a component in React?
Answer: A component is a reusable piece of UI that can be a function or a class.
4. What is the difference between state and props?
Answer: Props are read-only and passed to components, while state is managed within the
component.
5. What is the Virtual DOM?
Answer: Virtual DOM is a lightweight JavaScript representation of the actual DOM.
6. What is JSX?
Answer: JSX stands for JavaScript XML. It allows us to write HTML inside JavaScript.
7. What are hooks in React?
Answer: Hooks are functions that let you use state and lifecycle features in functional components.
8. What is useEffect used for?
Answer: useEffect is used for side effects like fetching data, subscriptions, or manually changing the
DOM.
9. What is useState?
Answer: useState is a Hook that allows you to add state to functional components.
10. What is the difference between controlled and uncontrolled components?
Answer: Controlled components are managed by React state, while uncontrolled components
manage their own state internally.
11. What are JavaScript data types?
Answer: String, Number, Boolean, Undefined, Null, Symbol, Object.
12. What is hoisting in JavaScript?
Answer: Hoisting is JavaScript's default behavior of moving declarations to the top.
13. Difference between var, let, and const?
Answer: var is function-scoped, let and const are block-scoped. const cannot be reassigned.
14. What is closure in JavaScript?
Answer: A closure is a function having access to the parent scope, even after the parent function
has closed.
15. What is the event loop?
Answer: The event loop is what allows JavaScript to perform non-blocking operations by offloading
operations to the browser APIs.
16. Explain 'this' keyword in JavaScript.
Answer: 'this' refers to the object from where it was called.
17. What are promises?
Answer: Promises are used to handle asynchronous operations in JavaScript.
18. What is async/await?
Answer: Async/await is syntax to handle promises in a cleaner way.
19. What is the difference between == and ===?
Answer: == checks for value equality, === checks for both value and type.
20. What is a callback function?
Answer: A callback is a function passed into another function to be executed later.
21. What is semantic HTML?
Answer: Semantic HTML uses tags that convey meaning about the content inside them.
22. What are HTML5 new elements?
Answer: article, section, nav, header, footer, figure, etc.
23. What is the difference between id and class?
Answer: id is unique; class can be used on multiple elements.
24. What is the purpose of the alt attribute?
Answer: It provides alternative text for an image if it cannot be displayed.
25. What is a meta tag?
Answer: Meta tags provide metadata about the HTML document.
26. What is the use of the <canvas> tag?
Answer: It is used to draw graphics on the fly using JavaScript.
27. What is the difference between block and inline elements?
Answer: Block takes full width; inline only takes as much width as needed.
28. What is the DOM?
Answer: DOM stands for Document Object Model. It represents the page so programs can change
the document structure, style, and content.
29. What is a form in HTML?
Answer: A form is an HTML element used to collect user input.
30. What is the use of placeholder attribute?
Answer: It provides a short hint that describes the expected value of an input field.
31. What is the difference between classes and IDs in CSS?
Answer: IDs are unique while classes can be reused on multiple elements.
32. What are pseudo-classes in CSS?
Answer: Pseudo-classes define a special state of an element, e.g., :hover, :focus.
33. What is specificity in CSS?
Answer: Specificity determines which CSS rule is applied by the browser.
34. What is the box model?
Answer: The box model includes margins, borders, padding, and content.
35. What is the difference between relative and absolute positioning?
Answer: Relative is positioned relative to its normal position; absolute is positioned relative to the
nearest positioned ancestor.
36. What is Flexbox?
Answer: Flexbox is a layout module that allows items to align and distribute space within a
container.
37. What is the difference between em and rem units?
Answer: em is relative to the parent, rem is relative to the root.
38. What are media queries?
Answer: Media queries are used to apply styles based on device characteristics.
39. What is z-index in CSS?
Answer: z-index determines the stack order of elements.
40. What is the difference between visibility: hidden and display: none?
Answer: Hidden hides the element but keeps its space; display: none removes it entirely.
41. What is Bootstrap?
Answer: Bootstrap is a CSS framework for developing responsive and mobile-first websites.
42. What are the key features of Bootstrap?
Answer: Grid system, responsive design, pre-styled components, and JavaScript plugins.
43. What is a container in Bootstrap?
Answer: A container is used to center and horizontally pad your site's contents.
44. What is the difference between .container and .container-fluid?
Answer: .container has fixed width, .container-fluid has full width.
45. What are Bootstrap classes for responsive layout?
Answer: col-sm, col-md, col-lg, col-xl.
46. What is a jumbotron in Bootstrap?
Answer: Jumbotron is a lightweight, flexible component to showcase content.
47. How can you make an image responsive in Bootstrap?
Answer: Use the class .img-fluid.
48. What is the use of the card component?
Answer: Card is a flexible content container with multiple variants and options.
49. What is the grid system in Bootstrap?
Answer: Bootstrap's grid system uses a series of containers, rows, and columns to layout and align
content.
50. How to add a button in Bootstrap?
Answer: Use class .btn followed by .btn-primary, .btn-success, etc.
51. What is HTTP?
Answer: HyperText Transfer Protocol, used for transferring web pages on the internet.
52. What is HTTPS?
Answer: Secure version of HTTP that uses encryption via TLS/SSL.
53. What is DNS?
Answer: Domain Name System, translates domain names to IP addresses.
54. What is the difference between TCP and UDP?
Answer: TCP is connection-oriented and reliable; UDP is connectionless and faster.
55. What is IP Address?
Answer: A unique address that identifies a device on the internet or a local network.
56. What is a REST API?
Answer: An API that follows the constraints of REST architecture, uses HTTP for communication.
57. What is a GET request?
Answer: GET is an HTTP method used to request data from a server.
58. What is the difference between PUT and POST?
Answer: PUT is idempotent and updates existing data, POST creates new data.