Web performance: Core Web Vitals, loading and runtime speed – Front End interview prep

261 interview-style multiple-choice questions on Web performance: Core Web Vitals, loading and runtime speed, organized by topic: concepts, scenarios, code to read and tradeoffs, each with a short explanation. Learn the 52 key terms with the flashcards first, then test yourself.

Take the practice test · Flashcards · All study tools

What it covers

  1. 10.1 Core Web Vitals and performance metrics
  2. 10.2 Optimizing Largest Contentful Paint
  3. 10.3 Preventing layout shifts (CLS)
  4. 10.4 Interaction responsiveness and INP
  5. 10.5 JavaScript cost: bundles, splitting and third parties
  6. 10.6 Images, video and fonts
  7. 10.7 Network delivery, compression and caching
  8. 10.8 Runtime performance, memory and animation
  9. 10.9 Measuring, monitoring and performance budgets

Key terms

10.1 Core Web Vitals and performance metrics

LCP
Largest Contentful Paint: when the main content becomes visible
INP
Interaction to Next Paint: responsiveness to user input
CLS
Cumulative Layout Shift: visual stability
TTFB
Time to First Byte: how fast the server starts responding
FCP
First Contentful Paint: first text or image painted
TBT
Total Blocking Time: blocking past 50 ms per long task
CrUX
Chrome UX Report of real-user metrics
Soft navigation
SPA route change without a full load

10.2 Optimizing Largest Contentful Paint

Resource load delay
TTFB to LCP resource start
Render delay
LCP resource loaded to painted
Image CDN
Service resizing and converting images
Edge rendering
Generating HTML on servers near users

10.3 Preventing layout shifts (CLS)

Layout shift regions
DevTools overlay showing shifts
Layout Instability API
Reports layout-shift entries
Facade
Lightweight stand-in for a heavy embed
font-display: optional
Use web font only if ready at once

10.4 Interaction responsiveness and INP

Input delay
Wait before handlers run
Presentation delay
Handlers done to next paint
Rage click
Rapid repeated clicks from frustration
Partial hydration
Hydrating only the interactive parts

10.5 JavaScript cost: bundles, splitting and third parties

Hydration payload
Serialized data in HTML for hydration
Barrel file
Module re-exporting many others
JS execution time
Parse, compile and run time per script
Dependency audit
Reviewing npm packages for weight and risk

10.6 Images, video and fonts

AVIF
Modern image format with strong compression
Font subsetting
Removing unused glyphs
FOIT
Flash of invisible text
Save-Data
Client hint asking for lighter pages

10.7 Network delivery, compression and caching

Code splitting
Breaking JavaScript into chunks loaded on demand
Tree shaking
Removing unused exports from bundles
CDN
Content delivery network: servers near users that cache content
fetchpriority
Attribute hinting how important a resource is
Brotli
Compression format better than gzip for text
Cache hit ratio
Share of requests served from cache
Origin shield
Cache tier in front of the origin
Server-Timing
Header exposing back-end timings

10.8 Runtime performance, memory and animation

Long task
Main-thread work longer than 50 ms
Debounce
Run once after activity stops for a set time
Throttle
Run at most once per interval
Virtualization
Rendering only the visible part of a long list
Web Animations API
element.animate() from JavaScript
Frame rendering stats
DevTools overlay of FPS and dropped frames
GC pause
Garbage collection stalling the main thread
Unbounded cache
Cache that never evicts

10.9 Measuring, monitoring and performance budgets

Lighthouse
Automated auditing tool for performance and quality
Performance budget
A limit on metrics or sizes enforced during development
RUM
Real User Monitoring: metrics collected from real visitors
User Timing API
performance.mark and performance.measure for custom timings
PageSpeed Insights
Field CrUX plus Lighthouse lab run
WebPageTest
Detailed lab testing from real locations
Navigation Timing
API for the page's own load timings
Lighthouse CI
Lighthouse on every change

Sample practice questions

  1. What does Largest Contentful Paint (LCP) measure?

    1. How long until all JavaScript has finished running
    2. The total time to download every resource on the page
    3. When the largest visible image or text block is rendered
    4. How long until the first byte arrives from the server

    Answer: C. When the largest visible image or text block is rendered "Good" LCP is 2.5 seconds or less at the 75th percentile of page loads.

  2. The LCP element is a hero image referenced only from a CSS background. What helps most?

    1. Lazy-load it with `loading="lazy"` so it doesn't compete
    2. Move all the CSS to the end of the body so HTML parses first
    3. Put it in an `<img>` or preload it, with `fetchpriority="high"`
    4. Convert it to a GIF so it starts showing frames sooner

    Answer: C. Put it in an `<img>` or preload it, with `fetchpriority="high"` The browser can't find a CSS background image until it has parsed the CSS and built the render tree.

  3. An image without width and height attributes loads and pushes the text below it down. Which metric suffers most?

    1. CLS
    2. TTFB
    3. LCP
    4. INP

    Answer: A. CLS Set `width`/`height` or `aspect-ratio` so the browser reserves space before the image arrives.

  4. A button click runs a 400 ms synchronous loop before the UI updates. Which metric suffers most?

    1. LCP
    2. INP
    3. TTFB
    4. CLS

    Answer: B. INP Long tasks on the main thread delay the next paint after an interaction.

  5. What does code splitting do for a single-page app?

    1. Moves all of the JavaScript inline into the HTML file
    2. Splits each source file into two smaller files at build time
    3. Splits the bundle so each route loads only the code it needs
    4. Duplicates code across bundles to avoid extra requests

    Answer: C. Splits the bundle so each route loads only the code it needs Smaller initial JavaScript means faster parsing and interactivity.

  6. Which image format usually gives the smallest files for photos with broad browser support today?

    1. AVIF or WebP
    2. GIF or SVG
    3. PNG or APNG
    4. BMP or TIFF

    Answer: A. AVIF or WebP Serve them with `<picture>` and fall back to JPEG when needed.

  7. What does Brotli or gzip compression on text responses do?

    1. Converts every image in the response to WebP
    2. Combines all the site's files into a single download
    3. Minifies the variable names inside JavaScript files
    4. Shrinks HTML, CSS and JS on the wire; the browser decompresses

    Answer: D. Shrinks HTML, CSS and JS on the wire; the browser decompresses Already-compressed formats like JPEG gain little from it.

  8. What does list virtualization (windowing) do?

    1. Moves the list into a separate browser tab
    2. Renders only the visible rows plus a small buffer
    3. Caches each rendered row as a static image
    4. Loads the list's data from a virtual machine

    Answer: B. Renders only the visible rows plus a small buffer Fewer DOM nodes means faster rendering and less memory.

  9. What is the difference between lab data and field data?

    1. Lab: a controlled test like Lighthouse; field: real users' visits
    2. They're two names for the same set of measurements
    3. Lab data is always more accurate, so field data is rarely used
    4. Field data comes from the developer's own machine and network

    Answer: A. Lab: a controlled test like Lighthouse; field: real users' visits Core Web Vitals assessments use field data (such as the Chrome UX Report); lab data helps you debug.

  10. Which metric replaced First Input Delay (FID) as a Core Web Vital in 2024?

    1. First Contentful Paint (FCP)
    2. Interaction to Next Paint (INP)
    3. Total Blocking Time (TBT)
    4. Time to First Byte (TTFB)

    Answer: B. Interaction to Next Paint (INP) INP looks at the latency of interactions across the whole visit, not just the first one.

Practice all 261 questions

More Front End