🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: DNS in Depth: all 10 questions

Quiz: DNS in Depth · Question 10 of 10

What does this print? (code)

What does this print?

cache = {"skills101.in": ("203.0.113.7", 500)}   # (IP, expires_at)
for now in (100, 499, 500, 600):
    hit = now < cache["skills101.in"][1]
    print("hit" if hit else "miss", end=" ")
print()
  1. A.hit hit hit miss
  2. B.hit hit miss miss
  3. C.hit miss miss miss
  4. D.miss miss hit hit
Answer & explanation

Correct answer: hit hit miss miss

The entry is valid only while now is less than 500, so 500 and 600 are misses.

Can you get the rest right without peeking?

Take the timed Quiz: DNS in Depth quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →