The following questions and answers help prepare for frontend interview. You should be able to answer each in your own words — not memorization, understanding matters.
HTML and CSS questions
What is Semantic HTML? Tags that express meaning (header, nav, main, article, section, footer). Instead of div and span. Important for SEO and accessibility. Browser and search engines understand.
Flexbox vs Grid difference? Flexbox one-dimensional (row or column), Grid two-dimensional. Flexbox — navigation, card row, centering. Grid — complex layout, gallery, dashboard. Can use both together.
How does CSS specificity work? Inline > ID > Class > Element. !important highest but avoid — hard to debug. Calculation: 1000 (inline), 100 (ID), 10 (class), 1 (element).
JavaScript questions
let, const and var difference? var — function scope, hoisting (can use before declaration). let and const — block scope (inside {}). const — immutable but data inside object/array can change. const preferred.
Promise and async/await? Promise — async operations (API request). async/await — simpler way to write Promise. try/catch for errors. Alternative to .then() and .catch().
What is Event delegation? One event listener on parent for child elements. Works due to bubbling. Convenient for dynamic elements — newly added ones work too.
React questions
useState and useEffect? useState — component state, re-render trigger. useEffect — side effects (API request, subscription, DOM). Dependency array [] — once, [value] — when value changes. Cleanup function — on unmount.
What is Virtual DOM? Lightweight copy of real DOM (JavaScript object). Compares changes and updates only needed parts. Faster. Reconciliation — diff algorithm.
Why is key prop needed? React identifies elements. In list key — must be unique. Index as key bad — errors on reorder, add, remove. id or unique string.
Conclusion
These questions are core. You should be able to answer each in your own words. Practice — best teacher. Do mock interviews — with friend or online.


