🎓 BookMCQ
← Back to 24. Transport Layer Protocols

📝 Port numbers well known registered dynamic (10 MCQs)

Sixteen-Bit Identifiers for Transport Endpoints

TCP and UDP use 16-bit source and destination port fields to identify application endpoints on a host. Port values range from 0 through 65535 and operate alongside IP addresses and the transport protocol number. The Internet Assigned Numbers Authority classifies ports into well-known, registered, and dynamic or private ranges, helping applications coordinate service identifiers. It defines the boundary between application processes and packet delivery.

Why Standard Service Ports and Temporary Client Ports Coexist

Servers need predictable service identifiers so clients can contact services without prior negotiation of arbitrary port values. Clients, however, need many simultaneous outgoing conversations without manually selecting a permanent local port. Port allocation therefore separates commonly recognized server services from registered application assignments and temporary client-side ports selected by the operating system.

Port Range Assignment and Socket Demultiplexing

The well-known range is 0–1023, the registered range is 1024–49151, and the dynamic or private range is 49152–65535. A client commonly receives an ephemeral source port, while a server listens on its service port. The operating system uses protocol, local and remote addresses, and ports to identify the appropriate socket.

Identifying a Web Connection and Its Temporary Client Port

A client at 192.0.2.15 may connect from TCP port 53024 to a server at 198.51.100.8 on TCP port 443. Port 443 is a well-known HTTPS service port; 53024 is in the dynamic range. The IP addresses identify the hosts, and the TCP ports distinguish the connection endpoints.

Service Discovery, Port Reuse and Security

Standard ports simplify configuration, firewall rules, service discovery, and troubleshooting. Registered ports help avoid accidental conflicts, while ephemeral ports support many concurrent client sessions. Port numbers do not encrypt traffic or prove application identity, and malicious software can use nonstandard ports. Firewalls should consider protocol and connection context rather than trusting a port value alone.

Misunderstandings About Port Classes

'Port 80 is an IP address' is false: it is a TCP or UDP port value, commonly used for HTTP over TCP. 'Dynamic ports are always server ports' is false: they are often temporary client ports. 'TCP port 53 and UDP port 53 are the same socket' is false: TCP and UDP have separate port spaces.

Exam Focus: Port Ranges and Endpoint Tuples

Memorize the three IANA ranges and classify example values such as 80, 3306, and 54000. Interpret a connection using source and destination IP addresses, transport protocol, and port numbers. Distinguish a server's listening port from a client's ephemeral port, and remember that TCP and UDP port namespaces are separate. Use the assumptions stated in each question when calculating.

Key Terms for Port Numbers: Well-Known, Registered and Dynamic

  • Well-known port - Assigned value from 0 through 1023.
  • Registered port - Assigned value from 1024 through 49151.
  • Dynamic port - Temporary-use range from 49152 through 65535.
  • Ephemeral port - Temporary client-side source port.
  • Socket - OS communication endpoint.
  • Port tuple - Address-port endpoint identifier.
3
Easy
5
Medium
2
Hard

📝 All Port numbers well known registered dynamic MCQs

Q1. If a server is configured to listen on port 80 and a packet arrives addressed to port 443, what is the most likely outcome?

A.The packet is processed as a normal request
B.The packet is discarded because the port does not match ✅
C.The server automatically switches its listening port to 443
D.The packet is forwarded to a different server on the same host
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Since the server only accepts traffic on the port it is bound to (80), any packet targeting a different port such as 443 will not match the listening socket. The operating system therefore discards the packet, and no application receives it. This behavior protects the service from unintended traffic.

Q2. In a sliding‑window protocol with sequence numbers modulo 1616 and a window size of 77, the sender has just received acknowledgments for packets 0, 1, 2, and 3. What is the new base (lowest unacknowledged) sequence number?

A.4 ✅
B.5
C.0
D.7
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Acknowledgments for 0‑3 free those slots, so the earliest outstanding packet becomes 4. Because sequence numbers wrap at 16, the base simply advances to the next unacknowledged number, which is 4. The window then covers 4‑10, maintaining the size of 7.

Q3. A NAT device maps an internal host’s source port 50000 to external port 40000. If the same internal host quickly opens a second TCP connection, which situation most likely causes a port‑collision error?

A.The NAT reassigns external port 40001, which is already in use elsewhere
B.The internal host reuses port 50000 before the first connection closes
C.The NAT discards the SYN packet due to firewall rules
D.The NAT attempts to reuse external port 40000 before the previous mapping times out ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: NAT devices maintain a translation table that pairs internal (IP, port) with external (IP, port). When a new connection is initiated before the old mapping expires, the NAT may try to allocate the same external port (40000). If the previous mapping is still active, this creates a collision, causing the new connection to fail or be misrouted. Proper timeout handling avoids this problem.

Q4. Which of the following statements correctly distinguishes well‑known ports from registered ports?

A.Well‑known ports are above 49152, while registered ports are 0‑1023
B.Both ranges are identical
C.Well‑known ports range from 0 to 1023, and registered ports range from 1024 to 49151 ✅
D.Registered ports are reserved for system services only
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The IANA defines well‑known ports as the range 0‑1023, typically assigned to core services like HTTP (80) and SSH (22). Ports from 1024 to 49151 are called registered ports and are allocated for less common applications. Ports above 49151 are dynamic or private. This categorization helps avoid conflicts between critical and user‑level services.

Q5. Using dynamic (private) ports for client‑side connections mainly improves security by which mechanism?

A.It encrypts the payload
B.It makes it harder for attackers to predict the exact source port ✅
C.It disables all inbound traffic
D.It forces the use of TLS
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Dynamic ports are chosen from a large range (49152‑65535), providing a high degree of randomness. This unpredictability reduces the success rate of blind port‑scanning attacks that rely on guessing a service’s listening port. However, the data itself is not encrypted, and other security measures such as TLS are still required to protect confidentiality.

Q6. Given the throughput formula Throughput=Window size×Packet sizeRTT\text{Throughput}= \frac{\text{Window size}\times\text{Packet size}}{\text{RTT}}, which statement best describes the effect of doubling the sliding‑window size while keeping packet size and RTT constant?

A.Throughput doubles until the network becomes congested ✅
B.Throughput remains unchanged because RTT dominates
C.Throughput halves due to increased queuing delay
D.Throughput becomes unpredictable and may drop to zero
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Doubling the window size directly doubles the numerator, so ideal throughput would double. In practice, the network may reach capacity, causing packet loss and retransmissions, which can limit or even reduce throughput. Therefore the theoretical increase holds only while the path remains uncongested.

Q7. Which port range is typically recommended for short‑lived or temporary services on a host?

A.0‑1023
B.1024‑49151
C.49152‑65535 ✅
D.65536‑70000
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The dynamic or private port range (49152‑65535) is reserved for temporary allocations such as client‑side connections. Because these ports are not permanently assigned to any specific service, they are ideal for short‑lived processes that need a unique identifier without risking conflict with well‑known or registered services.

Q8. A protocol uses 12‑bit sequence numbers. What is the maximum number of distinct sequence numbers, and what is the largest window size that can be used without risking ambiguity?

A.4096 distinct numbers; window ≤ 2048 ✅
B.2048 distinct numbers; window ≤ 1024
C.4096 distinct numbers; window ≤ 4096
D.8192 distinct numbers; window ≤ 4096
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: With 12 bits, the total count of unique sequence numbers is 212=40962^{12}=4096. To avoid the sender’s window overlapping with previously transmitted numbers that may still be in transit, the window size must be at most half the sequence space, i.e., ≤4096/2=2048\le 4096/2 = 2048. This ensures that any acknowledgment can be interpreted unambiguously.

Q9. How does the port number contribute to transport‑layer multiplexing on a single host?

A.It uniquely identifies each application process, allowing multiple sockets to coexist ✅
B.It encrypts the data for each application
C.It determines the routing path across the Internet
D.It replaces the need for IP addresses
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The transport layer uses the combination of IP address and port number to form a socket identifier. Different applications on the same machine listen on distinct ports, enabling the operating system to direct incoming packets to the correct process. This multiplexing allows many concurrent network connections without address conflicts.

Q10. What is the IANA‑assigned port number for the Domain Name System (DNS) service?

A.25
B.110
C.80
D.53 ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The DNS protocol operates over UDP and TCP using port number 53, as designated by the Internet Assigned Numbers Authority (IANA). This well‑known port allows clients to query name servers for domain resolution. The other listed ports correspond to SMTP (25), POP3 (110), and HTTP (80).

🔗 Related Topics (MCQs)