CS Atlas GATE 2027
Computer Networks course
0 / 90 complete

Computer Networks/Phase 4 · Transport Layer (TCP)

Chapter review L4.1 · Item 61 of 90

Transport layer basics, ports & demultiplexing

Read at your own pace. Try the questions before opening the answers.

On this page

Chapter recap

Chapter 4.1 bridged the gap from a computer's network card (IP address) to the exact running program (16-bit port number). Make sure you have the 4-tuple TCP demultiplexing rule and the 3 port ranges locked in before we start reliable delivery and flow control in Chapter 4.2.

Practice questions

  1. NAT · 1 mark

    How many port numbers belong to the Well-Known port range (0 to 1023 inclusive)?

    Write your answer before opening the key.

  2. MCQ · 2 marks

    Host C1 (10.1.1.1) opens 3 concurrent TCP connections to Server S (20.1.1.1) on port 80, and Host C2 (10.1.1.2) opens 2 concurrent TCP connections to the same Server S on port 80. How many distinct connected TCP sockets exist at Server S for these connections, and what is the minimum number of distinct source port numbers used across C1 and C2 combined?

    1. 5 sockets at S; minimum 5 distinct source ports
    2. 5 sockets at S; minimum 3 distinct source ports
    3. 1 socket at S; minimum 5 distinct source ports
    4. 2 sockets at S; minimum 3 distinct source ports
  3. MCQ · 1 mark

    If Client C1 (10.1.1.1:5001) and Client C2 (10.1.1.2:5002) both send UDP datagrams to Server S (20.1.1.1:53), how many UDP sockets at Server S receive these datagrams?

    1. 1 socket (identified by 20.1.1.1:53)
    2. 2 sockets (one per client IP)
    3. 2 sockets (one per source port)
    4. 3 sockets
  4. NAT · 1 mark

    A UDP datagram has a UDP Length field value of 52. How many bytes of application payload does it carry?

    Write your answer before opening the key.

  5. MSQ · 2 marks

    Which of the following services are provided by TCP but NOT by UDP?

    1. Process-to-process demultiplexing using port numbers
    2. Reliable in-order byte-stream delivery
    3. Flow control and congestion control
    4. Connection setup before data transfer
  6. MCQ · 1 mark

    Which field in the 20-byte IPv4 header tells the receiving host’s network layer whether to hand the payload up to TCP (6) or UDP (17)?

    1. Type of Service
    2. Protocol (8 bits)
    3. Identification (16 bits)
    4. Flags (3 bits)
  7. NAT · 2 marks

    How many usable hosts are in a /27 IPv4 subnet?

    Write your answer before opening the key.

  8. NAT · 2 marks

    In a 3-node triangle graph with edge costs (A,B)=2, (B,C)=3, and (A,C)=7, what is the shortest-path cost from A to C?

    Write your answer before opening the key.

Answer key

Try the questions first. Open when you are ready to check.
  1. 1024 — 0 through 1023 inclusive contains 1023 − 0 + 1 = 1024 port numbers.

    Review lesson 4.1

  2. B — Each of the 3 + 2 = 5 TCP connections has its own 4-tuple socket at S. C1 needs 3 distinct source ports (say p1, p2, p3) for its 3 connections, while C2 (which has a different Source IP!) can reuse p1 and p2 for its 2 connections → minimum 3 distinct source port numbers!
    • A: C2 can reuse two of C1’s source port numbers because C2 has a different Source IP.
    • C: TCP creates a separate connected socket per 4-tuple.
    • D: There are 5 active connections, so 5 connected sockets.

    Review lesson 4.1

  3. A — UDP demultiplexes using only the 2-tuple (Destination IP, Destination Port) = (20.1.1.1, 53), so both datagrams go to the same server socket.
    • B: UDP does not split sockets by client IP.
    • C: UDP does not split sockets by client port.
    • D: Only 1 socket is bound to 20.1.1.1:53.

    Review lesson 4.1

  4. 44 — UDP Length includes the 8-byte UDP header, so application payload = 52 − 8 = 44 bytes.

    Review lesson 4.1

  5. BCD — Both TCP and UDP provide process-to-process demultiplexing via 16-bit port numbers; reliability, flow/congestion control, and connection setup are TCP-only.
    • A: Both UDP and TCP provide port-based process-to-process demultiplexing.

    Review lesson 4.1

  6. B — The 8-bit Protocol field in the IPv4 header identifies the upper-layer protocol (6 = TCP, 17 = UDP).
    • A: TOS is for traffic priority/QoS.
    • C: Identification is for fragment reassembly.
    • D: Flags control fragmentation (DF, MF).

    Review lesson 3.2.1

  7. 30 — h = 32 − 27 = 5 host bits → 2⁵ − 2 = 30 usable hosts.

    Review lesson 3.1.3

  8. 5 — Path A → B → C costs 2 + 3 = 5, which is less than the direct edge cost 7.

    Review lesson 3.4.4

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.