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

Quiz: Reliability Patterns · Question 3 of 10

What does this print? (code)

What does this print?

delays = [min(8, 0.5 * 2 ** a) for a in range(6)]
print(delays)
  1. A.[0.5, 1.0, 1.5, 2.0, 2.5, 3.0]
  2. B.[0.5, 1.0, 2.0, 4.0, 8.0, 16.0]
  3. C.[0.5, 1.0, 2.0, 4.0, 8, 8]
  4. D.[1, 2, 4, 8, 8, 8]
Answer & explanation

Correct answer: [0.5, 1.0, 2.0, 4.0, 8, 8]

The delay doubles each time and is capped at 8. Python prints the cap as 8 because min returned the integer.

Can you get the rest right without peeking?

Take the timed Quiz: Reliability Patterns quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →