🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: How Git Works Inside: all 10 questions

Quiz: How Git Works Inside · Question 3 of 10

What does this print? (code)

What does this print?

import hashlib

content = b""
print(hashlib.sha1(f"blob {len(content)}\0".encode() + content).hexdigest()[:7])
  1. A.da39a3e
  2. B.e69de29
  3. C.0000000
  4. D.It raises an error for empty content
Answer & explanation

Correct answer: e69de29

This is the well-known id of an empty file in Git. The bare SHA-1 of nothing is da39a3e…, but Git hashes the header too.

Can you get the rest right without peeking?

Take the timed Quiz: How Git Works Inside quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →