Browser & Web Performance Junior interview questions and answers
75 questions for a Browser & Web Performance (Junior) interview - with correct answers, explanations and links to the docs.
Take this quiz- 1.You type a URL and press Enter. Which order of steps is closest to what the browser does first?
- 2.What does the browser build from the HTML it parses?
- 3.What is the render tree?
- 4.Which order of rendering stages is correct after the render tree is built?
- 5.What happens during the layout (reflow) stage?
- 6.What is the critical rendering path?
- 7.Why is CSS called render-blocking?
- 8.What does a classic
<script src>withoutasyncordeferdo to HTML parsing? - 9.What's the difference between
deferandasyncon a script? - 10.How does
<script type="module">load by default? - 11.What's the difference between the
DOMContentLoadedandloadevents? - 12.What is the browser's preload scanner?
- 13.Which three metrics are the Core Web Vitals today?
- 14.What does LCP (Largest Contentful Paint) measure?
- 15.What is a 'good' LCP value?
- 16.What does INP (Interaction to Next Paint) measure?
- 17.What is a 'good' INP value?
- 18.What does CLS (Cumulative Layout Shift) measure?
- 19.Which change is most likely to reduce CLS caused by images?
- 20.What does TTFB (Time to First Byte) measure?
- 21.What does FCP (First Contentful Paint) measure?
- 22.What's the difference between lab data and field data?
- 23.Which tool gives you a lab performance report with suggestions directly in Chrome?
- 24.Why can't Lighthouse report INP in a normal page-load audit?
- 25.What is a long task on the main thread?
- 26.Why does heavy JavaScript make a page feel slow even after it has loaded?
- 27.What does
loading="lazy"on an<img>do? - 28.Why shouldn't you add
loading="lazy"to the hero image at the top of the page? - 29.What does
srcsetwithsizeson an<img>let the browser do? - 30.Which image formats usually give smaller files than JPEG and PNG at similar quality?
- 31.What does
font-display: swapdo? - 32.What is FOIT?
- 33.Which is a cheap way to make images download faster without changing their content?
- 34.What does
<link rel="preload">do? - 35.What does
<link rel="preconnect" href="https://cdn.example.com">do? - 36.What is
<link rel="prefetch">meant for? - 37.What does
dns-prefetchdo? - 38.What does
Cache-Control: max-age=3600mean? - 39.What's the difference between
no-cacheandno-store? - 40.What is an
ETagused for? - 41.What does a
304 Not Modifiedresponse mean? - 42.Why do build tools put a content hash in file names like
app.3f9a1c.js? - 43.Which caching policy fits the HTML page of a frequently updated site that uses hashed asset URLs?
- 44.What does
Cache-Control: privatemean? - 45.Where can an HTTP response be cached on its way to the user?
- 46.What does a hard reload (Ctrl+Shift+R) typically do with the cache?
- 47.Why does serving text resources with Brotli or gzip help performance?
- 48.What is a key benefit of HTTP/2 over HTTP/1.1?
- 49.How does a CDN make a site faster?
- 50.Why are redirects bad for page load speed?
- 51.What makes two URLs the same origin?
- 52.Are
https://example.comandhttps://example.com:8443the same origin? - 53.What does the same-origin policy prevent by default?
- 54.What is CORS?
- 55.Who enforces CORS?
- 56.A frontend on
https://app.comcallshttps://api.comand sees a CORS error. Where is the fix usually needed? - 57.What is a CORS preflight request?
- 58.Which header in a response allows any origin to read it?
- 59.What is cross-site scripting (XSS)?
- 60.Which way of putting user input into the page is safe from XSS?
- 61.Why don't React and Vue templates usually cause XSS when you render
{userInput}? - 62.What are the three classic types of XSS?
- 63.What is Content Security Policy (CSP)?
- 64.If you must insert user-provided HTML (e.g. formatted comments), what should you do?
- 65.What does the
HttpOnlyflag on a cookie do? - 66.What does the
Secureflag on a cookie do? - 67.What does
SameSite=Laxmean for a cookie? - 68.Why is storing an auth token in
localStorageconsidered risky? - 69.How do cookies affect performance?
- 70.What is mixed content?
- 71.What does the
Strict-Transport-Security(HSTS) header do? - 72.Why is HTTPS required for many modern web features like service workers?
- 73.What does
Content-Encoding: brin a response mean? - 74.What does
<img decoding="async">hint to the browser? - 75.Which DevTools panel shows each request's timing, size, status and caching?