Question

In an IPv4 datagram, the M bit is 0, the value of HLEN is 10, the value of total length is 400 and the fragment offset value is 300. The position of the datagram, the sequence numbers of the first and the last bytes of the payload, respectively are

Choose one option
Official answer and solution
Official answer
C
From
Official GATE 2013 answer key

Solution

Extract IPv4 header length, total length, fragment offset, and M bit to deduce the fragment position and payload byte sequence numbers.

Let us extract the IPv4 header fields:

  • MM bit (More Fragments): M=0M = 0. This indicates that this datagram is not followed by any more fragments. Because the fragment offset is non-zero (300≠0300 \ne 0), this is the Last fragment.
  • Header Length (HLEN): HLEN=10\text{HLEN} = 10. The actual header size in bytes is HLEN×4=10×4=40 bytes\text{HLEN} \times 4 = 10 \times 4 = 40\text{ bytes}.
  • Total Length: Total Length=400 bytes\text{Total Length} = 400\text{ bytes}.
  • Payload Length:
    Payload size=Total Length−Header Size=400−40=360 bytes\text{Payload size} = \text{Total Length} - \text{Header Size} = 400 - 40 = 360\text{ bytes}
  • Fragment Offset: The fragment offset is given as 300 (measured in units of 8 bytes). Therefore, the first byte of the payload in the original unfragmented datagram has byte sequence number:
    First byte number=300×8=2400\text{First byte number} = 300 \times 8 = 2400
  • Last byte sequence number:
    Last byte number=2400+360−1=2759\text{Last byte number} = 2400 + 360 - 1 = 2759

Therefore, the datagram is the last fragment, and the first and last byte numbers of the payload are 2400 and 2759, respectively.

Final answer

C

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2013 Computer Science and Information Technology (CS)
Question
37 of 65, printed as CS Q.37
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.