Web Technology Basics

When a web server compresses responses with gzip or Brotli before sending them, which of the following generally gains the least reduction in transferred data from compression?

  1. AAn HTML file
  2. BA JavaScript file
  3. CA JPEG photo
Show answer and explanation

Answer: C. A JPEG photo

The browser states the compression methods it supports with the Accept-Encoding header, and the server indicates the method it used in the compressed response with the Content-Encoding header. Text such as HTML, CSS, JavaScript and JSON contains repeated character sequences, so compression makes it much smaller. Images in JPEG, PNG or WebP, and videos, are already compressed formats, so compressing them again hardly makes them smaller and wastes processing time. For this reason, servers are generally configured to compress only text responses.

  • A. HTML is text in which the same tags and words appear repeatedly, so it compresses well.
  • B. JavaScript is also text, and compression is very effective for it.
  • C. Correct. JPEG is already a compressed format, so compressing it again hardly makes it smaller.
Practice this topic Back to topic

Books on Web Technology Basics Ad

As an Amazon Associate I earn from qualifying purchases.

More Web Technology Basics questions

  1. 1.5 MB of text data is compressed with gzip to one third of its size and sent. The bandwidth is 10 Mbps and the RTT is 100 ms, and before the data starts to be sent, the TCP connection, the TLS handshake and the HTTP request take three round trips in total. Assume 1 MB = 10^6 bytes, and ignore compression and decompression time, headers and waiting caused by TCP congestion control. Which of the following is closest to the time until all the data has been received?
  2. A CDN receives 2,000 requests per second, and its cache hit ratio rises from 90% to 98%. The response time is 20 ms on a hit, and 200 ms on a miss because the content is fetched from the origin server and returned; only requests that miss reach the origin server. Which of the following is the combination of the number of requests reaching the origin server and the average response time after the ratio reaches 98%?
  3. Among Core Web Vitals, the metrics of a web page's user experience, which of the following does CLS (Cumulative Layout Shift) represent?
  4. Which of the following is an appropriate pairing of an image format for web pages with its typical use?
  5. 3,000 bytes of image data are encoded with Base64 and embedded in HTML. If no line breaks are inserted, which of the following is the number of characters after encoding?