In a TCP header, how many bits does each source port and destination port…
2021
In a TCP header, how many bits does each source port and destination port field contain?
Answer: B. 16 bits — ConceptA fixed-width unsigned field of n bits can represent 2n distinct bit patterns, spanning 0 through 2n − 1. TCP uses source and destination port fields…
- A.
8 bits
- B.
16 bits
- C.
32 bits
- D.
128 bits
Attempted by 64 students.
Show answer & explanation
Correct answer: B
Concept
A fixed-width unsigned field of n bits can represent 2n distinct bit patterns, spanning 0 through 2n − 1.
TCP uses source and destination port fields to identify the sending and receiving application endpoints within a segment.
Application
In the TCP header layout defined by RFC 9293, Source Port occupies the first half of the opening 32-bit row.
Destination Port occupies the second half of that same 32-bit row.
Each half spans 16 bit positions, so both port fields are 16 bits wide.
Cross-check
An unsigned 16-bit field supplies 216 = 65,536 values, numbered 0 through 65,535. This matches the TCP port-number space.
Contrast
8 bits would provide only 256 values.
32 bits is the width of TCP sequence and acknowledgment fields, not either port field.
128 bits is not the width assigned to a TCP port field.
Therefore, each source port and destination port field contains 16 bits.