Web Performance Optimization interview questions

33 questions from the Web Performance Optimization course, each with the correct answer and an explanation. Try to answer before you open the answer.

Module 1: Getting started

1. What is the typical conversion impact of 100ms delay?

  1. About 5% drop
  2. About 1% drop in conversions
  3. Performance doesn't affect conversions
  4. A 10% gain in conversions
Show answer

Answer: About 1% drop in conversions

Widely cited studies link each extra 100ms of delay to roughly a 1% drop in conversions.

Lesson: Why performance matters

Module 2: Foundation

2. What does CLS measure?

  1. Page load time
  2. Input response time
  3. Unexpected layout changes
  4. Server response time
Show answer

Answer: Unexpected layout changes

CLS scores how much visible content shifts unexpectedly while the page loads.

Lesson: Core Web Vitals

3. What does TTFB measure?

  1. Total transfer time
  2. Time to finish loading
  3. Time to render the largest image
  4. Time to first response byte
Show answer

Answer: Time to first response byte

TTFB covers network latency plus server processing until the first byte arrives.

Lesson: Performance metrics fundamentals

Module 3: Core optimization

4. What is a major advantage of WebP format?

  1. 30% smaller file size than JPEG
  2. Universal browser support
  3. Animated without performance cost
  4. Lossless quality at any size
Show answer

Answer: 30% smaller file size than JPEG

WebP typically produces smaller files than JPEG at similar quality.

Lesson: Image optimization

5. What is typical compression reduction with gzip?

  1. 10-20% for text assets
  2. 70-80% for text assets
  3. Compression doesn't work for text
  4. 30% increase in file size
Show answer

Answer: 70-80% for text assets

Text assets such as HTML, CSS and JS compress very well, often by 70–80%.

Lesson: Asset compression and minification

6. What is a good cache TTL for static assets?

  1. 1 hour
  2. No caching
  3. 1 year (31536000 seconds)
  4. 1 minute
Show answer

Answer: 1 year (31536000 seconds)

Fingerprinted static assets can be cached for a year because a changed file gets a new URL.

Lesson: Caching strategies

Module 4: Data delivery

7. What is a key advantage of HTTP/3?

  1. Smaller file sizes
  2. No compression needed
  3. It requires a separate connection per request
  4. Uses UDP instead of TCP for faster handshake
Show answer

Answer: Uses UDP instead of TCP for faster handshake

HTTP/3 runs over QUIC (UDP), which speeds up connection setup and recovers from loss better.

Lesson: HTTP/2 and HTTP/3

8. What is a typical cache hit rate target for CDN?

  1. >90%
  2. >50%
  3. >70%
  4. <10%
Show answer

Answer: >90%

A high hit rate means most requests are served from the edge instead of your origin.

Lesson: CDN usage and optimization

Module 5: Design and architecture

9. What can route-based code splitting achieve?

  1. Eliminates the need for caching
  2. Reduces initial bundle by 50-70%
  3. Compresses assets automatically
  4. Doubles the initial bundle size
Show answer

Answer: Reduces initial bundle by 50-70%

Loading only the current route's code shrinks the initial bundle substantially.

Lesson: Code splitting and bundling

10. What is Intersection Observer used for?

  1. Measuring page load time
  2. Compressing images
  3. Detecting when elements enter viewport
  4. Encrypting network requests
Show answer

Answer: Detecting when elements enter viewport

It reports when elements cross the viewport without costly scroll listeners.

Lesson: Lazy loading and infinite scroll

11. What blocks rendering in the critical path?

  1. Images only
  2. Nothing, rendering happens independently
  3. Only fonts loaded with swap
  4. CSS and synchronous JavaScript
Show answer

Answer: CSS and synchronous JavaScript

Stylesheets and synchronous scripts hold up first paint until they are processed.

Lesson: Critical rendering path

Module 6: Optimization techniques

12. What is considered a long task in JavaScript?

  1. Task taking >50ms
  2. Task taking >1 second
  3. Any task
  4. Task using more than 1MB of memory
Show answer

Answer: Task taking >50ms

Tasks over 50ms block the main thread long enough to delay input handling.

Lesson: JavaScript optimization

13. What CSS properties are GPU-accelerated?

  1. All CSS properties
  2. transform and opacity
  3. Only colors
  4. width and height
Show answer

Answer: transform and opacity

Compositor-friendly properties avoid layout and paint work, keeping animations smooth.

Lesson: CSS optimization

14. What does font-display: swap do?

  1. Hides text until font loads
  2. Disables font loading
  3. Shows fallback text immediately, swaps font when loaded
  4. Downloads the font twice
Show answer

Answer: Shows fallback text immediately, swaps font when loaded

`swap` avoids invisible text by showing a fallback font until the web font is ready.

Lesson: Font optimization

15. Which preload value avoids downloading video data until the user plays?

  1. Always preload=auto
  2. preload="metadata", which still fetches some data
  3. preload=auto on every video
  4. preload="none"
Show answer

Answer: preload="none"

preload=none avoids downloading video data until the user chooses to play.

Lesson: Video optimization

Module 7: Measurement & quality

16. What does DevTools Lighthouse audit?

  1. Performance, accessibility, SEO
  2. Only JavaScript errors
  3. Only CSS issues
  4. Only network errors
Show answer

Answer: Performance, accessibility, SEO

Lighthouse audits several categories, including performance, accessibility and SEO.

Lesson: Chrome DevTools and Performance API

17. What is the weight of LCP in Lighthouse scoring?

  1. 15%
  2. 25%
  3. 10%
  4. 50%
Show answer

Answer: 25%

LCP carries a 25% weight in the current Lighthouse performance score.

Lesson: Lighthouse scoring and audits

18. What is RUM (Real User Monitoring)?

  1. Laboratory testing only
  2. Testing with Rum, a beverage
  3. Measuring performance from actual user devices
  4. A paid lab-only benchmark
Show answer

Answer: Measuring performance from actual user devices

RUM collects metrics from real visitors, capturing real devices and networks.

Lesson: WebPageTest and real-world testing

Module 8: Tools and monitoring

19. What does preconnect do?

  1. Immediately loads the resource
  2. Disables connection
  3. Downloads and executes the page script
  4. Opens connection early to third-party server
Show answer

Answer: Opens connection early to third-party server

preconnect does DNS, TCP and TLS work early so later requests start faster.

Lesson: Resource hints and preloading

20. What is Cache First strategy?

  1. Return cache if available, fallback to network
  2. Always fetch from network first
  3. Disable caching
  4. Always show a blank page offline
Show answer

Answer: Return cache if available, fallback to network

Cache First serves stored responses instantly and only goes to the network on a miss.

Lesson: Service Workers and offline support

21. What is a reasonable JavaScript budget?

  1. <1MB uncompressed
  2. <250KB gzipped
  3. >1MB is acceptable
  4. <10MB per page
Show answer

Answer: <250KB gzipped

A gzipped JavaScript budget near 250KB keeps parse and execution time manageable.

Lesson: Performance monitoring and budgets

Module 9: Advanced optimization

22. What does WebAssembly help optimize?

  1. All JavaScript code
  2. Layout rendering
  3. Compute-heavy tasks for 10-50x speedup
  4. DOM updates only
Show answer

Answer: Compute-heavy tasks for 10-50x speedup

WebAssembly suits CPU-heavy work like image processing, not layout or DOM work.

Lesson: Advanced performance techniques

23. What is the key benefit of static-first architecture?

  1. More dynamic features
  2. Requires more JavaScript
  3. Needs no CDN
  4. Faster FCP and LCP, better security, cheaper scaling
Show answer

Answer: Faster FCP and LCP, better security, cheaper scaling

Pre-rendered files served from a CDN respond fast, are harder to attack and are cheap to scale.

Lesson: Performance best practices and patterns

Module 10: Revision and mastery

24. What is a common performance anti-pattern?

  1. Polling instead of events
  2. Using Service Workers
  3. Optimizing images
  4. Compressing images
Show answer

Answer: Polling instead of events

Polling wastes network and CPU; events or push updates are more efficient.

Lesson: Common performance pitfalls and how to avoid them

25. When optimizing performance, what comes first?

  1. Apply all optimizations
  2. Measure and profile to identify bottlenecks
  3. Rewrite the code
  4. Add a CDN before checking anything
Show answer

Answer: Measure and profile to identify bottlenecks

Measuring first ensures you fix the real bottleneck rather than guess.

Lesson: Interview questions and practical scenarios

26. Which Core Web Vital measures responsiveness to user interactions?

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

Answer: INP

INP replaced FID in March 2024 and tracks interaction latency across the visit.

Lesson: Interview questions and practical scenarios

27. Which header gives a fingerprinted static asset the longest useful cache life?

  1. Cache-Control: no-store
  2. Cache-Control: public, max-age=31536000
  3. Cache-Control: max-age=0
  4. Content-Encoding: gzip
Show answer

Answer: Cache-Control: public, max-age=31536000

A one-year max-age is safe when the filename changes with its content.

Lesson: Interview questions and practical scenarios

28. Which attribute defers offscreen images until they are needed?

  1. decoding="sync"
  2. loading="lazy"
  3. fetchpriority="high"
  4. rel="preload"
Show answer

Answer: loading="lazy"

Native lazy loading delays below-the-fold images and reduces the initial payload.

Lesson: Interview questions and practical scenarios

29. What is a long task?

  1. Any task over 5ms
  2. Any task over 50ms on the main thread
  3. Any request over 1 second
  4. Any script over 100KB
Show answer

Answer: Any task over 50ms on the main thread

Tasks over 50ms block the main thread and hurt responsiveness.

Lesson: Interview questions and practical scenarios

30. Why reserve space for ads and images with fixed dimensions?

  1. To lower CLS
  2. To raise TTFB
  3. To disable caching
  4. To enable HTTP/3
Show answer

Answer: To lower CLS

Reserved space stops content jumping when late resources load.

Lesson: Interview questions and practical scenarios

31. Which approach best reveals real-user performance?

  1. A single Lighthouse run on your laptop
  2. Real User Monitoring (RUM)
  3. Counting HTML files
  4. Minifying CSS
Show answer

Answer: Real User Monitoring (RUM)

RUM captures real devices, networks and locations that lab tests miss.

Lesson: Interview questions and practical scenarios

32. What does a performance budget do in CI?

  1. Fails the build when limits are exceeded
  2. Speeds up the server
  3. Compresses images automatically
  4. Replaces monitoring
Show answer

Answer: Fails the build when limits are exceeded

Budgets act as guardrails that catch regressions before release.

Lesson: Interview questions and practical scenarios

33. What should you do first when a page is slow?

  1. Measure and profile to find the bottleneck
  2. Add every optimization
  3. Rewrite in a new framework
  4. Add a CDN only
Show answer

Answer: Measure and profile to find the bottleneck

Fixing the measured bottleneck gives the biggest, most reliable gain.

Lesson: Interview questions and practical scenarios

← Back to the course