1. LPU MCA Semester 1
  2. CAP7001
  3. Unit 3

CAP7001 · Unit 3: Data link layer

Framing

12 practice questions · in the MTE and ETE syllabus

Key points

  • Framing marks where each frame starts and ends
  • Byte stuffing: ESC before FLAG and ESC
  • Bit stuffing: 0 after five consecutive 1s
  • Asynchronous: start and stop bits per byte

Framing lets the data link layer divide a bit stream into frames so the receiver knows where each begins and ends. It can use fixed-size frames (the length itself is the boundary) or variable-size frames with delimiters.

  • Byte-oriented (byte stuffing): a FLAG byte marks the boundaries; an ESC byte is inserted before any FLAG or ESC byte in the data.
  • Bit-oriented (bit stuffing): flag 01111110; the sender inserts a 0 after five consecutive 1s and the receiver removes it.

Worked example: payload [A, FLAG, B, ESC, C] becomes A ESC FLAG B ESC ESC C. A payload of 40 bytes with 6 FLAG and 4 ESC bytes grows to 50 bytes. Unstuffing 1111101111100 removes the 0 after each run of five 1s and gives 11111111110.

Asynchronous transmission frames each byte with a start bit and stop bit(s) and allows gaps; synchronous transmission sends a continuous stream with shared timing.

Exam pitfall: in byte stuffing the ESC byte itself must also be escaped. Counting only FLAG bytes undercounts the stuffed length.

Try two questions

Question 1 · Tier 4, Analyse

In byte stuffing an ESC byte is inserted before every FLAG or ESC byte found in the data. The payload is [A, FLAG, B, ESC, C]. What is the stuffed payload?

  1. A ESC FLAG B ESC ESC C
  2. ESC A ESC FLAG B ESC ESC C
  3. A ESC FLAG B ESC C
  4. A FLAG ESC B ESC ESC C
Show the answer

A. A FLAG and an ESC in the data each get an ESC before them. The second option leaves the ESC in the data unescaped, so the receiver would treat it as an escape for the C byte.

Question 2 · Tier 3, Apply

A receiver using bit stuffing (a 0 is inserted after five consecutive 1s) gets the data bits 1111101111100, flags excluded. What was the original data?

  1. 1111111111
  2. 11111011111
  3. 111111111100
  4. 11111111110
Show the answer

D. The 0 after the first five 1s is a stuffed bit, and so is the 0 after the next five 1s; the last 0 is real data. Result 11111111110. Removing only the first stuffed 0 leaves a stuffed bit behind.