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

Quiz: Error Detection and Correction · Question 8 of 10

What does this print? (code)

What does this print?

def crc_remainder(bits, gen):
    n = len(gen) - 1
    work = list(bits + "0" * n)
    for i in range(len(bits)):
        if work[i] == "1":
            for j in range(len(gen)):
                work[i + j] = "0" if work[i + j] == gen[j] else "1"
    return "".join(work[-n:])

print(crc_remainder("1101011011", "10011"))
  1. A.0000
  2. B.1011
  3. C.1110
  4. D.0111
Answer & explanation

Correct answer: 1110

Appending four zeros and XOR-dividing by 10011 leaves 1110, the CRC sent after the data.

Can you get the rest right without peeking?

Take the timed Quiz: Error Detection and Correction quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →