Data representation · A level · AQA 7517 4.5.5.3, Eduqas A500QS 2.8 · about 30 min
Parity bits, majority voting, checksums and check digits, with checksums on the robot's radio messages.
[1 mark]Even parity is used. What parity bit is added to the 7 bits 1101011?
[1 mark]Even parity is used. The byte 01101011 is received. What can the receiver conclude?
[1 mark]Majority voting sends each bit three times. The groups 110 011 000 are received. Give the three data bits.
[1 mark]Which of these methods can correct an error without the data being sent again?
Tick every answer that is true.
[1 mark]A checksum adds the character codes of a message modulo 256. Which error does it always miss?
[1 mark]What does this program print?
digits = [9, 7, 8, 1, 8, 6, 1, 9, 7, 8, 2, 7]
total = 0
for i in range(12):
weight = 1 if i % 2 == 0 else 3
total = total + digits[i] * weight
print(total, (10 - total % 10) % 10)Write checksum(text). The parameter text is a string. It returns the sum of the character codes (use ord) modulo 256, as a string of exactly two uppercase hex digits (you may use format(n, "02X")).
1. For each command in GO 20, LEFT 90, STOP, in that order, build the packet <command>*<checksum>, send it with send(), and print sent <packet>. Send the packet you built, not typed-in text.
2. For each packet in received, split it at the *, recalculate the checksum of the text part and print <packet> ok if it matches the checksum that arrived, or <packet> corrupt if it does not.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
def checksum(text):
return "00"
received = ["GO 20*18", "G0 20*18", "STOP*46", "LEFT 80*B4"]Plan your program here, then type it in and press Run.
STOP that the checksum misses.GO three times as bits and write the majority-voting decoder.OG 20 now get a different checksum from GO 20?