# browser & web platform
// [40] real interview questions. Answers and sources live in the practice app.
practice this topic- Describe the process from the time you type a URL into the browser to the page finishing loading on your screen.(senior)
- What does CORS stand for and what issue does it address? Your frontend gets 'blocked by CORS policy' calling an API — walk through how you debug it.(mid)
- Describe the difference between `<script>`, `<script async>` and `<script defer>`.(mid)
- Explain event delegation. You have a list with 1000 rows, each needing a click handler — how do you implement it and why is it better?(mid)
- A `<p onclick="console.log('p')">` sits inside a `<div onclick="console.log('div')">`. When you click the paragraph, what logs and in what order? Name the phases of event propagation.(junior)
- What is the difference between `event.target` and `event.currentTarget`? In nested elements with one delegated listener, which one do you use?(mid)
- What is the difference between `event.preventDefault()` and `event.stopPropagation()`? Give a real case for each.(junior)
- Explain the difference between layout, painting and compositing in the browser rendering pipeline.(senior)
- A page janks while scrolling — frames drop visibly. What are the likely causes and how do you find and fix them?(senior)
- Is there any reason you'd want to use `translate()` instead of absolute positioning (top/left) for moving an element, or vice-versa? Why?(mid)
- What are techniques for reducing reflows (layout) and repaints when updating the DOM?(mid)
- What is Cross-Site Scripting (XSS) and how do you prevent it in a real frontend codebase?(mid)
- Explain Cross-Site Request Forgery (CSRF) and its mitigation techniques.(senior)
- What is Content Security Policy (CSP) and how does it enhance security?(senior)
- What are the differences between long-polling, WebSockets and Server-Sent Events? When would you choose each?(mid)
- Explain the HTTP caching headers: Cache-Control, ETag, and Expires. How do they interact on a real asset pipeline?(senior)
- What are Web Workers and when would you use them? What are their limitations?(mid)
- Why would you use a `srcset` attribute on an image tag? Explain how the browser evaluates it.(mid)
- What is the difference between an HTML attribute and a DOM property?(mid)
- What is CSS selector specificity and how does it work?(junior)
- Describe z-index and how stacking context is formed. Why can an element with `z-index: 9999` still appear behind one with `z-index: 1`?(mid)
- What is the difference between CSS Grid and Flexbox? When would you use one over the other?(junior)
- How do you abort an in-flight web request using AbortController? Why does this matter in UI code?(mid)
- What is a service worker? Describe its lifecycle and the common caching strategies it enables.(mid)
- Your app shows live data over a WebSocket. How do you detect connection loss and handle reconnection without breaking the UI?(senior)
- What is clickjacking, and how do you prevent your site from being attacked this way?(mid)
- What is the difference between `innerHTML` and `textContent`? Why is one of them a classic XSS sink?(mid)
- Where should the frontend store an auth token — localStorage, a cookie, or memory? Walk through the tradeoffs.(senior)
- What is ARIA, when should you actually use it, and what are common incorrect usages?(mid)
- How do you manage keyboard focus in a single-page app — when opening a modal, and when the route changes?(senior)
- What is the accessibility tree, and how does a screen reader work out an element's accessible name?(senior)
- Describe how to hide content: from all users, from screen readers only, and from sighted users only. When is each appropriate?(mid)
- What are Core Web Vitals? Explain what LCP, CLS, and INP measure and what counts as a good score.(mid)
- Field data shows poor LCP and CLS on your landing page. What are the usual culprits and the fixes for each?(senior)
- You close the tab, quit the browser entirely, come back a day later, and the site still knows who you are without asking you to log in again. Where did it keep that, and how do cookies, localStorage, and sessionStorage differ for 'remember me'?(mid)
- A push notification from a web app pops up on your phone even though the tab was closed and the browser wasn't open. If a page's JavaScript stops when you close it, what is actually still running to receive that message?(senior)
- You start typing your address into a checkout form and the browser offers to fill in your street, city, and zip in one tap. How does the browser know which field is which, and what should a developer do so this works reliably?(junior)
- You navigate to an article, then hit the back button and the previous page reappears instantly, already scrolled to where you were, with no reload spinner. Why is back so much faster than a fresh navigation?(mid)
- On a search results page the links you've already clicked show up purple while the rest are blue. How does the browser remember which links you visited, and why can't a page just read that to snoop on your history?(junior)
- You browse a shopping site in a private/incognito window, buy nothing, close it — and afterward the site seems to have no memory of you: no cart, no login, no history entry. What is actually different about storage and state in that mode?(mid)