🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: File Organization and Hashing: all 9 questions

Quiz: File Organization and Hashing · Question 7 of 9

What does this print? (code)

What does this print?

gd = 2
for key in [6, 13, 20]:
    print(format(key % 2 ** gd, f'0{gd}b'), end=' ')
  1. A.01 10 00
  2. B.10 01 00
  3. C.11 01 10
  4. D.10 11 00
Answer & explanation

Correct answer: 10 01 00

The last two bits: 6 = 110 → 10, 13 = 1101 → 01, 20 = 10100 → 00.

Can you get the rest right without peeking?

Take the timed Quiz: File Organization and Hashing quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →