CRC questions

Question 1 The following bit stream is to be digitally encoded:
1 0 1 1 0 1 0 1 0 1 1 1
Draw the waveforms if the bit stream were to be encoded using
a) Unipolar
b) NRZ
c) Manchester
d) Differential Manchester encoding: Here’s how this scheme works. A logic 0 is represented by a transition
at the beginning AND at the middle of the clock interval. The transition can be from low to high or high
to low, that is, if it was low, it goes to high and if it was high, it goes to low. Logic 1 is represented by a
transition ONLY at the middle of the interval. Again, the transition can be either low to high or high to
low.
In all the above cases, assume that the signal is HIGH to begin with.

Question 2
The following message is to be sent by a host running a protocol with starting and ending flags and bit stuffing.
The starting and ending flags are both 01111110 and they have not yet been added.
0111111011111011110011111100111111000000111110101111110
What is the message actually sent (after bit stuffing and after adding the starting and ending flags)?
Question 3 If the generator polynomial is x5 x3 1 and the message to be sent is 1110010111,
what is the actual bit string transmitted? Show steps.
Question 4 The data link layer of a host receives the bit string 10110011101. The data link layer
uses CRC for error checking and the generator polynomial is 1001. Is there an error detected in the frame? Show
steps.
Question 5 In this exercise, you will be writing a simple program that does the following:
a) Read a String of hex digits
b) Convert the String into a String of binary numbers
c) Perform bit stuffing on the binary String
d) Unstuff the bits from the binary String
e) Produce the original hex String
2
Here’s an example to illustrate the program’s operation:
Input: ABEFFFF
Conversion to binary: 1010101111101111111111111111
After bit stuffing: 10101011111001111101111101111101
After bit unstuffing: 1010101111101111111111111111
Output: ABEFFFF
Your program must have at least four methods/functions:
a) convert Hex String to a binary String; b) convert binary String to stuffed binary String c) convert stuffed binary
String to original binary String and d) convert binary String to Hex String
Note: You can represent all the data types using Strings (you are not actually creating raw binary data).
You may use Java, C, C or Python as your programming language.
Submit the source code, and at least three samples of your program run.
Question 6 Implement the sending and receiving CRC protocols by writing
program routines (functions/methods) for each of the following:
a. Given a bit string, compute the CRC remainder and generate the bit string that is transmitted.
b. Given a bit string with the CRC remainder appended, divide by G(x) and determine if the message is
error-free.
c. Use the above methods in a test program that accepts from user input the values of G(x) and the
input string, introduce random errors in the transmitted bit string and demonstrate how the
receiver can detect the error