Related Articles
GATE | GATE-CS-2014-(Set-3) | Question 65
• Difficulty Level : Hard
• Last Updated : 07 Sep, 2018

A bit-stuffing based framing protocol uses an 8-bit delimiter pattern of 01111110. If the output bit-string after stuffing is 01111100101, then the input bit-string is
(A) 0111110100
(B) 0111110101
(C) 0111111101
(D) 0111111111

Explanation: Bit Stuffing is used to create framing.

```8-bit delimiter pattern is 01111110.

The output bit-string after stuffing is 01111100101.

The above highlighted bit is stuffed bit.
So input bit-string must be 0111110101.```

Alternative approach –
The given delimiter pattern is 01111110. Delimiters are used to define the beginning and end of data.
Since delimiters are special bit-patterns used for special purposes, they must be avoided in the encoded form of the input data. To achieve this, Bit Stuffing is used.
On the sending side, any time five consecutive 1’s have been transmitted from the body of the message (i.e., excluding when the sender is trying to transmit the distinguished 01111110 delimiter sequence), the sender inserts a 0 before transmitting the next bit.
If the receiver gets five consecutive 1’s, it makes its decision based on the next bit it sees (i.e., the bit following the five 1s).
If the next bit is a 0, it must have been stuffed, and so the receiver removes it.
If the next bit is a 1, then one of two things is true: Either this is the end-of-frame marker or an error has been introduced into the bit stream.
Going further and reading the next bit distinguishes these two cases. If the next bit is 0, then it is the end of frame marker (delimiter 01111110), and if the next bit is a 1 then there is must be an error in the frame and it is discarded.
So, For the data sequence 0111111101
Encoding would be – 01111101101
Here the bold 0 is stuffed to distinguish it from the delimiter sequence.
Coming back to the question, the encoded string is – 01111100101 and when the receiver senses that it has received 5 consecutive 1’s then
If the next bit is 0, then it is stuffed
If the next bit is 1, then next to next bit would tell if the frame has ended or there is an error.
In this case, the next bit is 0 which means it was stuffed, so the corresponding input sequence is- 0111110101.
Therefore, option (B) is correct.

This explanation is provided by Chirag Manwani.

Quiz of this Question

My Personal Notes arrow_drop_up