← 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])
- A.da39a3e
- B.e69de29
- C.0000000
- 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 →