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 10: Revision and mastery
24. What is a common performance anti-pattern?
- Polling instead of events
- Using Service Workers
- Optimizing images
- 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?
- Apply all optimizations
- Measure and profile to identify bottlenecks
- Rewrite the code
- 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?
- INP
- LCP
- CLS
- 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?
- Cache-Control: no-store
- Cache-Control: public, max-age=31536000
- Cache-Control: max-age=0
- 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?
- decoding="sync"
- loading="lazy"
- fetchpriority="high"
- 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?
- Any task over 5ms
- Any task over 50ms on the main thread
- Any request over 1 second
- 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?
- To lower CLS
- To raise TTFB
- To disable caching
- 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?
- A single Lighthouse run on your laptop
- Real User Monitoring (RUM)
- Counting HTML files
- 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?
- Fails the build when limits are exceeded
- Speeds up the server
- Compresses images automatically
- 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?
- Measure and profile to find the bottleneck
- Add every optimization
- Rewrite in a new framework
- 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