Frontend Web Developer Interview Questions &
Answers (HTML, CSS, JavaScript, ReactJS)
Q1: What are the key differences between HTML, CSS, and JavaScript?
HTML provides the structure of a webpage, CSS is used for styling and layout, and JavaScript adds
interactivity and dynamic behavior.
Q2: What are semantic HTML elements?
Semantic HTML elements clearly describe their meaning in a human- and machine-readable way.
Examples: <header>, <footer>, <article>, <section>.
Q3: What is the difference between relative, absolute, and fixed positioning in CSS?
Relative: positioned relative to its normal position. Absolute: positioned relative to the nearest
positioned ancestor. Fixed: positioned relative to the viewport.
Q4: What is the difference between == and === in JavaScript?
== checks for value equality with type conversion, while === checks for both value and type
equality (strict equality).
Q5: What are React components?
React components are reusable building blocks that define how a part of the UI should look and
behave. They can be functional or class-based.
Q6: What is JSX in React?
JSX stands for JavaScript XML. It allows writing HTML-like syntax inside JavaScript, which is then
transpiled to [Link] calls.
Q7: What are props in React?
Props are inputs to React components. They are passed from parent to child components and are
read-only.
Q8: What is the difference between state and props in React?
Props are immutable data passed from parent to child, while state is mutable data maintained within
a component.
Q9: What is the virtual DOM in React?
The virtual DOM is a lightweight copy of the real DOM that React uses to optimize updates by
comparing changes (diffing) before updating the real DOM.
Q10: What are React hooks?
Hooks are functions introduced in React 16.8 that allow using state and lifecycle features in
functional components. Examples: useState, useEffect, useContext.
Q11: What is the difference between inline, internal, and external CSS?
Inline CSS is written inside the element's style attribute, internal CSS is written inside a <style> tag
within the HTML file, and external CSS is written in separate .css files.
Q12: Explain event bubbling in JavaScript.
Event bubbling is a type of event propagation where the event starts from the target element and
bubbles up to its ancestors in the DOM tree.
Q13: What is responsive web design?
Responsive design ensures that a webpage looks good and functions well on all devices and
screen sizes using techniques like flexible grids, media queries, and fluid images.
Q14: What are controlled and uncontrolled components in React?
Controlled components are those where form data is handled by React state. Uncontrolled
components store their own data internally using refs.
Q15: What is the difference between var, let, and const in JavaScript?
var is function-scoped, let and const are block-scoped. let allows reassignment, const does not
allow reassignment.