HomeSubjectsUniversityBlogAbout

Web Performance & Optimization

Topic in Web Development

210 total MCQsShowing 30 with explanations10 Easy10 Medium10 Hard

About This Topic

Web performance optimization is the process of making pages load, render and respond faster by cutting bytes, requests and main-thread work. Current questions revolve around Core Web Vitals, namely Largest Contentful Paint, Interaction to Next Paint and Cumulative Layout Shift, plus metrics like Time to First Byte. Know techniques such as minification, compression with gzip or Brotli, code splitting, tree shaking, lazy loading images, and modern image formats like WebP and AVIF. Caching appears through Cache-Control headers, ETags, service workers and CDNs. Resource hints (preload, prefetch, preconnect), font-display, async and defer scripts, and Lighthouse audits complete the list.

Below are 30 practice questions from a pool of 210 Web Performance & Optimization MCQs, one of 17 topics in Web Development. Each shows the correct answer with an explanation; when you are ready, take a timed quiz to test recall under exam conditions.

Practice Questions

Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.

Web Performance & OptimizationEasy

Q1. What is web performance optimization?

  1. A.A CSS framework for building optimized page layouts
  2. B.A JavaScript library for animation performance
  3. C.Making websites look visually better with design
  4. D.Techniques to make websites load and respond faster✓ Correct

Explanation

Web performance optimization reduces load times and improves responsiveness.

Report an error in this question

Web Performance & OptimizationEasy

Q2. What is caching?

  1. A.Storing data copies for faster subsequent access✓ Correct
  2. B.A type of database for key-value storage
  3. C.A payment method for online transactions
  4. D.A CSS property for visual element styling

Explanation

Caching stores copies of resources for faster future access.

Report an error in this question

Web Performance & OptimizationEasy

Q3. What is image compression?

  1. A.Permanently deleting images from the server
  2. B.Reducing image file size while keeping quality✓ Correct
  3. C.A JavaScript function for image manipulation
  4. D.A CSS filter for applying visual image effects

Explanation

Image compression reduces file sizes to decrease page load time.

Report an error in this question

Web Performance & OptimizationEasy

Q4. What is minification?

  1. A.A CSS technique for reducing selector specificity
  2. B.Making fonts smaller on the rendered page
  3. C.Removing unnecessary characters without changing function✓ Correct
  4. D.A database optimization for reducing table sizes

Explanation

Minification removes whitespace, comments, and shortens names to reduce file sizes.

Report an error in this question

Web Performance & OptimizationEasy

Q5. What is lazy loading?

  1. A.A database query that runs in the background
  2. B.A CSS animation with a slow timing function
  3. C.Deferring non-critical resource loading until needed✓ Correct
  4. D.Loading pages intentionally at a slower speed

Explanation

Lazy loading delays loading resources until they enter the viewport.

Report an error in this question

Web Performance & OptimizationEasy

Q6. What is a CDN used for in web performance?

  1. A.A database network for distributed data storage
  2. B.Creating dynamically generated HTML pages
  3. C.Distributing content across global servers for speed✓ Correct
  4. D.A CSS framework for building responsive layouts

Explanation

A CDN caches content worldwide, serving from the nearest location.

Report an error in this question

Web Performance & OptimizationEasy

Q7. Why are large images bad for web performance?

  1. A.They look bad on high-resolution displays
  2. B.They break CSS layouts on mobile devices
  3. C.They increase page load time and bandwidth use✓ Correct
  4. D.They cause JavaScript runtime errors in browsers

Explanation

Large images slow page loads and consume more bandwidth.

Report an error in this question

Web Performance & OptimizationEasy

Q8. What is page load time?

  1. A.A server uptime metric for availability
  2. B.The time to write the application code
  3. C.The total time for a web page to fully load✓ Correct
  4. D.A CSS duration for transition animations

Explanation

Page load time measures how long it takes for a page to fully render.

Report an error in this question

Web Performance & OptimizationEasy

Q9. What does the async attribute do on a script tag?

  1. A.Makes CSS load asynchronously in parallel
  2. B.Downloads script without blocking HTML parsing✓ Correct
  3. C.Makes the script execute synchronously in order
  4. D.Delays the script loading permanently from page

Explanation

async downloads the script without blocking and executes it immediately upon download.

Report an error in this question

Web Performance & OptimizationEasy

Q10. What is browser caching?

  1. A.Storing resources locally for faster repeat access✓ Correct
  2. B.A JavaScript method for storing session data
  3. C.A CSS property for caching computed style values
  4. D.A browser plugin for extending capabilities

Explanation

Browser caching stores files locally so repeat visits load faster.

Report an error in this question

Web Performance & OptimizationMedium

Q11. What is the difference between FCP and LCP?

  1. A.LCP measures only the first pixel painted on screen
  2. B.FCP is always slower than LCP in page loading time
  3. C.FCP is when first content appears; LCP is when largest renders✓ Correct
  4. D.They are identical metrics measuring the same event

Explanation

FCP measures first content render, while LCP measures the largest visible element render.

Report an error in this question

Web Performance & OptimizationMedium

Q12. What is code splitting?

  1. A.Breaking JavaScript bundles into on-demand chunks✓ Correct
  2. B.Dividing CSS files into smaller partial imports
  3. C.Database partitioning for distributing table rows
  4. D.Splitting HTML files across different server endpoints

Explanation

Code splitting divides code into smaller bundles loaded only when needed.

Report an error in this question

Web Performance & OptimizationMedium

Q13. What is the purpose of loading='lazy' on images?

  1. A.To defer loading off-screen images until scrolled to✓ Correct
  2. B.To load images using CSS background properties
  3. C.To compress images for smaller file sizes
  4. D.To slow down image rendering on the page

Explanation

loading='lazy' defers loading images outside the viewport.

Report an error in this question

Web Performance & OptimizationMedium

Q14. What is GZIP compression?

  1. A.A JavaScript minifier for reducing bundle sizes
  2. B.A CSS compression tool for minifying stylesheets
  3. C.Image compression for reducing file sizes
  4. D.A server-side method reducing transferred file sizes✓ Correct

Explanation

GZIP compresses text-based files before sending them to the client.

Report an error in this question

Web Performance & OptimizationMedium

Q15. What are Core Web Vitals?

  1. A.A CSS framework for building optimized page layouts
  2. B.A testing tool for measuring code quality metrics
  3. C.Google metrics for UX: LCP, INP, and CLS scores✓ Correct
  4. D.Core JavaScript functions built into the language

Explanation

Core Web Vitals measure loading (LCP), interactivity (INP), and visual stability (CLS).

Report an error in this question

Web Performance & OptimizationMedium

Q16. What is render-blocking CSS?

  1. A.CSS that blocks images from loading on page
  2. B.CSS that blocks JavaScript from executing code
  3. C.CSS preventing rendering until fully downloaded✓ Correct
  4. D.CSS that blocks individual element visibility

Explanation

Render-blocking CSS delays rendering because the browser must parse all CSS first.

Report an error in this question

Web Performance & OptimizationMedium

Q17. What is prefetching?

  1. A.A CSS property for preloading font resources
  2. B.A JavaScript fetch method for making API requests
  3. C.Fetching data from databases in advance
  4. D.Loading resources in advance the user will likely need✓ Correct

Explanation

Prefetching downloads resources before they are needed.

Report an error in this question

Web Performance & OptimizationMedium

Q18. What is Cumulative Layout Shift (CLS)?

  1. A.A CSS layout property for element positioning
  2. B.A database migration for moving records between tables
  3. C.A metric measuring unexpected visual shifts during loading✓ Correct
  4. D.A JavaScript shift operation for bitwise manipulation

Explanation

CLS measures the total of all unexpected layout shifts during the page lifecycle.

Report an error in this question

Web Performance & OptimizationMedium

Q19. What is the purpose of a service worker in performance?

  1. A.To minify JavaScript bundles for production
  2. B.To manage CSS stylesheets and style rules
  3. C.To compress images for reduced file sizes
  4. D.To cache assets and serve them offline for speed✓ Correct

Explanation

Service workers intercept network requests and serve cached responses.

Report an error in this question

Web Performance & OptimizationMedium

Q20. What is tree shaking?

  1. A.A CSS technique for optimizing selector performance
  2. B.Removing tree images from web page content
  3. C.Eliminating unused code from JavaScript bundles✓ Correct
  4. D.A database optimization for removing unused indexes

Explanation

Tree shaking removes dead code from the final bundle.

Report an error in this question

Web Performance & OptimizationHard

Q21. What is the difference between preload, prefetch, and preconnect?

  1. A.They are identical in resource loading behavior
  2. B.Prefetch is exclusively used for CSS stylesheet resources only
  3. C.Preconnect downloads files from the server in advance before needed
  4. D.Preload fetches current-page resources; prefetch loads future; preconnect opens connections✓ Correct

Explanation

Preload is for current page, prefetch for future navigations, preconnect for early connections.

Report an error in this question

Web Performance & OptimizationHard

Q22. What is the PRPL pattern?

  1. A.A CSS color pattern for theming web pages
  2. B.Push, Render, Pre-cache, Lazy-load for delivery✓ Correct
  3. C.A database pattern for query optimization strategies
  4. D.A JavaScript design pattern for state management

Explanation

PRPL stands for Push, Render, Pre-cache, and Lazy-load.

Report an error in this question

Web Performance & OptimizationHard

Q23. What is the purpose of requestAnimationFrame?

  1. A.To request data from REST API server endpoints
  2. B.To request images from a remote CDN server
  3. C.To schedule animations synced with the repaint cycle✓ Correct
  4. D.To create CSS animations using keyframe declarations

Explanation

requestAnimationFrame syncs JavaScript animations with the browser's refresh rate.

Report an error in this question

Web Performance & OptimizationHard

Q24. What is the impact of the critical rendering path on performance?

  1. A.No impact on web application performance at all
  2. B.It determines how quickly a page becomes visible✓ Correct
  3. C.It only affects how CSS styles are calculated
  4. D.It only affects how images are decoded and shown

Explanation

The critical rendering path determines initial render speed.

Report an error in this question

Web Performance & OptimizationHard

Q25. What is HTTP/2 Server Push?

  1. A.A WebSocket feature for real-time data streaming
  2. B.A database push operation for replication updates
  3. C.Proactively sending resources before they are requested✓ Correct
  4. D.Pushing CSS stylesheets to the client browser

Explanation

HTTP/2 Server Push sends resources to the client before the browser requests them.

Report an error in this question

Web Performance & OptimizationHard

Q26. What is the difference between synthetic and real user monitoring?

  1. A.They are identical monitoring approaches
  2. B.Synthetic uses simulated tests; RUM collects real user data✓ Correct
  3. C.Synthetic monitoring collects data from actual users
  4. D.RUM uses simulated automated tests in lab environments

Explanation

Synthetic runs automated tests, while RUM collects data from actual user sessions.

Report an error in this question

Web Performance & OptimizationHard

Q27. What is layout thrashing?

  1. A.A JavaScript error from undefined variable references
  2. B.A CSS bug causing layout calculation errors
  3. C.Forcing repeated layout recalculations by reading/writing DOM✓ Correct
  4. D.A database deadlock from concurrent transaction conflicts

Explanation

Layout thrashing occurs when JavaScript repeatedly reads layout properties then modifies the DOM.

Report an error in this question

Web Performance & OptimizationHard

Q28. What is the purpose of resource hints in HTML?

  1. A.To add HTML comments for developer documentation
  2. B.To create resource files for internationalization support
  3. C.To inform the browser about resources to preload or prefetch✓ Correct
  4. D.To add tooltip text to page elements on hover

Explanation

Resource hints help the browser prioritize and fetch resources early.

Report an error in this question

Web Performance & OptimizationHard

Q29. What is the benefit of WebP or AVIF image formats?

  1. A.Better CSS support across all web browsers
  2. B.Better database storage efficiency for images
  3. C.Better JavaScript integration with image APIs
  4. D.Significantly smaller file sizes than JPEG/PNG✓ Correct

Explanation

WebP and AVIF achieve 25-50% smaller file sizes than JPEG/PNG.

Report an error in this question

Web Performance & OptimizationHard

Q30. What is Time to Interactive (TTI)?

  1. A.A CSS animation duration for transition effects
  2. B.The time until the page is fully interactive✓ Correct
  3. C.A server response time for processing API requests
  4. D.The time to write the application source code

Explanation

TTI measures when the page becomes truly usable and responsive to input.

Report an error in this question

Ready to test yourself on Web Performance & Optimization?

Take a timed quiz drawn from 210+ questions on this topic. No signup required — your progress saves in your browser.

Start Web Performance & Optimization Quiz