Computer Networks Module 3
Data link layer: framing and error detection interview questions
Interview questions on “Data link layer: framing and error detection”: warm-ups, then what each harder question tests and how a good answer starts.
Warm-up questions
Short questions with short answers, each answered in full.
-
Fresher
The physical layer already delivers bits. Why does a link layer still need framing?
-
Fresher
What does a code's minimum Hamming distance tell you?
-
Fresher to mid
Why does a receiver add up an IPv4 header, checksum included, and expect 0xFFFF?
-
Fresher
Why does the sender append r zero bits before dividing by the generator?
Appending r zeros multiplies the message by x^r, which shifts it left and leaves r empty places at the end. The remainder of that division, which has at most r bits, then fills those places: adding the remainder (XOR) to the shifted message makes the whole codeword an exact multiple of the generator, without touching a single message bit. The receiver checks precisely that: a codeword that leaves a zero remainder is accepted.
From the lesson Cyclic redundancy check (CRC) step by step
Questions with model answers
What each question tests, the first step of a good answer and the follow-ups to expect.
-
Fresher to mid
Your serial protocol frames messages with PPP-style byte stuffing, and clients choose their own payload bytes. One client starts sending payloads made only of 0x7E bytes. What happens to frame sizes and link time, and how do you design the receiver for it?
- What it tests
- Whether the worst case of byte stuffing is known and computed, and whether buffers and time limits are sized for hostile input rather than for average data.
- First step
- Work out the worst case first: every 0x7E or 0x7D in a payload goes out as two bytes, so an n-byte payload of them takes 2n + 2 bytes with the two flags, against about 1.008n + 2 for random data. Then size every limit in bytes on the link, not in payload bytes.
- Follow-ups
-
- How long does a 1,500-byte payload of flag bytes take at 115,200 bit/s?
- Where should the receiver enforce its maximum frame size?
- Which framing keeps the overhead bounded whatever the data?
From the lesson Link-layer services and framing
Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.Opening the model answers with your pass…
Model answers open with any MySmartCoPilot pass.
- Pro pass · 1 week₹79$2.99
- 30 days₹179$5.99
- 1 year₹1,699$45
One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.
Passes can’t be bought right now, so the model answers can’t be opened at the moment. If you have a pass, enter your licence key.
It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).
In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
A sensor sends 40-byte readings to a gateway over a noisy UART at 9,600 bit/s, and the gateway may start listening in the middle of a reading. Design the framing. How does the gateway find the first good reading, and what does one corrupted byte cost?
- What it tests
- Choosing a framing method for a byte stream, resynchronising after damage, pairing framing with a CRC, and reasoning about the link with numbers.
- First step
- Start from the two failures the design must survive: joining mid-stream and damaged bytes. Both need a marker the receiver can hunt for, so use a flag byte with escaping, plus a CRC over every reading, and reject anything that fails it. A bare length prefix cannot resynchronise.
- Follow-ups
-
- How many readings a second can the link carry, framing included?
- Why is a CRC still needed when flags already mark the boundaries?
- What changes if two sensors share the same pair of wires?
From the lesson Link-layer services and framing
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 4 minutes
-
Mid to senior
A router decrements the TTL of every IPv4 packet it forwards. Show how it can update the header checksum from the change alone, and explain what goes wrong with the obvious shortcut HC' = HC + m + ~m'.
- What it tests
- Ones' complement arithmetic and its two zeros, the formula of RFC 1624 against the older one of RFC 1141, and how receivers verify a checksum.
- First step
- Write the checksum as the complement of a ones' complement sum, so that changing one word from m to m' changes the sum by m' − m. Undo the complement, apply the change, complement again: HC' = ~(~HC + ~m + m'). Then try it on a change that makes the new sum 0xFFFF.
- Follow-ups
-
- Work the TTL change from 64 to 63 on a header whose checksum is 0x3224.
- Why does a receiver that sums the whole header accept both results?
- Why do IPv6 routers not have this work to do?
From the lesson Parity, checksums and Hamming codes
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to staff
An application stores 64 KB records, each with a 16-bit Internet checksum, and corrupted records occasionally pass the check. Which corruptions can that checksum miss, roughly how often, and what would you replace it with?
- What it tests
- The blind spots of the Internet checksum, the escape rate of a 16-bit check, what a CRC adds, and when only a keyed MAC will do.
- First step
- List what a sum of words cannot see: words that swap places or whole blocks written in the wrong order, a 0x0000 word turning into 0xFFFF, and pairs of flips that cancel. Then estimate how often random damage escapes a 16-bit check, about 1 in 65,536, and compare that with what the data needs.
- Follow-ups
-
- Why does a 32-bit CRC do far better on the same records?
- What if the corruption might be deliberate?
- How would you move existing records to the new check?
From the lesson Parity, checksums and Hamming codes
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 4 minutes
-
Fresher to mid
Your CRC-32 code gives a different value from zlib.crc32 on every input, including b"123456789". How do you find the bug quickly?
- What it tests
- The parameters that define a CRC (width, generator, starting value, reflection, final XOR), the use of check values, and debugging one hypothesis at a time.
- First step
- Test two inputs before reading any code: b"123456789" must give the check value 0xCBF43926 and an empty input must give 0. The wrong values themselves point at the parameter: compare them with what each likely mistake produces, then fix one parameter at a time.
- Follow-ups
-
- Your result is the bitwise complement of the right one. What is wrong?
- Your code is right only for the empty input. What does that rule out?
- How would you check a table-driven version against the bit-by-bit one?
From the lesson Cyclic redundancy check (CRC) step by step
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
-
Mid to senior
You design a protocol for 256-byte frames on a radio link where errors come in bursts of up to 20 bits. Would a 16-bit CRC do, or do you need 32 bits? Say what each guarantees and what risk remains.
- What it tests
- Burst guarantees by generator degree, how often longer bursts escape, minimum distance over a frame length, and the cost of extra check bits.
- First step
- Turn the requirement into the rule: a generator of degree r with a constant term catches every burst of up to r bits. A 20-bit burst is guaranteed to be caught only with r of at least 20, so a 16-bit CRC leaves some 20-bit bursts undetected and a 32-bit one leaves none.
- Follow-ups
-
- What fraction of 20-bit bursts does a 16-bit CRC miss, and what does that mean per day?
- What do the two extra bytes cost on each frame?
- Where would you add retransmission or forward error correction?
From the lesson Cyclic redundancy check (CRC) step by step
Model answer, Pro.In the answer:
- Model answer
- Follow-up answers
- Common mistakes
- Rubric
- Variants
- about 3 minutes
All Computer Networks interview questions · The Computer Networks track