Homework Hack Responses

1. What is a hex color code? What are some examples?

A hex color code is a six-digit code that represents a color using numbers 0–9 and letters A–F. It starts with #. Each pair of digits represents the Red, Green, and Blue (RGB) values.

Examples:

  • #FF0000 → Red
  • #00FF00 → Green
  • #0000FF → Blue

2. What is Base64 and how is it used with images?

Base64 is a method of encoding binary data (like images) into text. It allows images to be safely transmitted or embedded into text files like HTML, CSS, and emails.

Use with images: Images can be converted into Base64 text and directly embedded into a webpage without needing a separate image file.

3. Why might you use Base64 instead of a regular image file?

You might use Base64 if:

  • You want to send images inside emails without attachments.
  • You want faster small-image loading (like icons or logos) in websites.
  • You need to avoid extra file requests for performance.

Insert an Image and Explain How It’s Stored and Displayed

Explanation:

  • The image download(8).jpeg is a file containing pixel data.
  • Each pixel’s color is stored using RGB (Red, Green, Blue) values.
  • When the notebook runs <img src=, it reads the file and shows it by decoding the stored pixel data.

Popcorn Hack Answers

1. Alpha Transparency Scenario

Alpha transparency would be helpful when creating a popup notification on a website. The popup background could be 50% transparent so the user can still slightly see the page behind it.

2. Best Format for Transparent Background (Practice MCQ)

Answer: B) PNG

  • PNG supports transparency and keeps images sharp.

3. Drawback of Base64 in Real Life

One downside of Base64 is that it increases the file size by about 33%, making websites or systems slower if used too much.

4. Which is true about Base64? (Practice MCQ)

Answer: B) It increases the size of the data.

Final Quick Summary (TL;DR)

  • Hex Codes = 6-digit color codes like #FF0000.
  • Base64 = text-encoding method to send binary files safely.
  • Base64 Drawbacks = bigger size, not encryption.
  • PNG = best for images with transparent backgrounds.