TCP vs UDP
- 31Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What is one primary function of Layer 4 (Transport Layer) protocols?
What is one primary function of Layer 4 (Transport Layer) protocols?
31 questions
- 1
What is one primary function of Layer 4 (Transport Layer) protocols?
- A
Encapsulating data into frames for physical transmission
- B
Performing routing between different networks
- C
Assigning MAC addresses to network interfaces
- D
Providing transparent transfer of data between end hosts
Correct answer
DProviding transparent transfer of data between end hosts
Explanation
Layer 4 provides transparent transfer of data between end hosts, meaning the hosts are unaware of the underlying network details. MAC addresses are Layer 2, routing is Layer 3, and framing is Layer 2.
- A
- 2
Which of the following is NOT a service provided by TCP to applications?
- A
Flow control
- B
Error recovery
- C
Session multiplexing
- D
Reliable data transfer
Correct answer
CSession multiplexing
Explanation
Session multiplexing is provided by both TCP and UDP using port numbers. TCP provides reliable data transfer, error recovery, and flow control, while UDP does not.
- A
- 3
What is the purpose of Layer 4 port numbers?
- A
To provide error checking for the data payload
- B
To identify the physical interface on a network device
- C
To enable routing of packets across different networks
- D
To identify the Application Layer protocol and manage sessions
Correct answer
DTo identify the Application Layer protocol and manage sessions
Explanation
Port numbers identify the Application Layer protocol (e.g., HTTP uses port 80) and allow session multiplexing, enabling hosts to handle multiple communication sessions simultaneously.
- A
- 4
According to IANA, which range of port numbers is considered 'well-known'?
- A
0–255
- B
49152–65535
- C
1024–49151
- D
0–1023
Correct answer
D0–1023
Explanation
Well-known port numbers are from 0 to 1023. Registered ports are 1024–49151, and ephemeral/dynamic ports are 49152–65535.
- A
- 5
Which port number range should a host use when selecting a random source port for TCP or UDP?
- A
Reserved range
- B
Well-known range
- C
Ephemeral range
- D
Registered range
Correct answer
CEphemeral range
Explanation
Source ports are randomly selected from the ephemeral (private/dynamic) range (49152–65535) to ensure uniqueness for each session.
- A
- 6
How many bits are used for the source and destination port fields in the TCP and UDP headers?
- A
16 bits
- B
64 bits
- C
8 bits
- D
32 bits
Correct answer
A16 bits
Explanation
Each port field is 16 bits (2 bytes), providing a total of 65536 port numbers (216).
- A
- 7
Which characteristic distinguishes TCP as a connection-oriented protocol?
- A
It uses a three-way handshake before data exchange
- B
It sends data without establishing a connection
- C
It requires both hosts to use the same subnet mask
- D
It relies on IP for addressing
Correct answer
AIt uses a three-way handshake before data exchange
Explanation
TCP is connection-oriented; it establishes a connection via the three-way handshake (SYN, SYN-ACK, ACK) before sending data, ensuring both sides are ready.
- A
- 8
What are the three steps of the TCP three-way handshake in order?
- A
SYN, ACK, SYN-ACK
- B
ACK, SYN, SYN-ACK
- C
SYN, SYN-ACK, ACK
- D
SYN-ACK, SYN, ACK
Correct answer
CSYN, SYN-ACK, ACK
Explanation
The three-way handshake proceeds as: 1) SYN, 2) SYN-ACK, 3) ACK. This establishes a reliable connection.
- A
- 9
Which TCP header flags are used to initiate a connection?
- A
SYN and ACK
- B
FIN and ACK
- C
SYN only
- D
RST and SYN
Correct answer
ASYN and ACK
Explanation
The SYN flag initiates a connection, and the ACK flag acknowledges the SYN during the handshake. The first message uses SYN; the second uses SYN+ACK; the third uses ACK.
- A
- 10
In TCP, what does the acknowledgment number indicate in a segment?
- A
The number of bytes in the segment
- B
The total number of segments sent
- C
The next sequence number the host expects to receive
- D
The sequence number of the last received byte
Correct answer
CThe next sequence number the host expects to receive
Explanation
TCP uses forward acknowledgment: the acknowledgment number is the next expected sequence number, telling the sender that all data up to that number minus one has been received.
- A
- 11
How does TCP ensure reliable data delivery?
- A
By using checksums to detect and correct errors
- B
By requiring every segment to be acknowledged and retransmitting if not acknowledged
- C
By resending all data if any error occurs
- D
By using a sliding window to increase throughput
Correct answer
BBy requiring every segment to be acknowledged and retransmitting if not acknowledged
Explanation
TCP provides reliability through acknowledgments and retransmission: if a segment is not acknowledged within a timeout, it is retransmitted.
- A
- 12
What is the purpose of the TCP window size field?
- A
To indicate the number of bits in the segment
- B
To enable encryption of the data stream
- C
To specify the version of TCP being used
- D
To provide flow control by limiting how much data can be sent before an acknowledgment
Correct answer
DTo provide flow control by limiting how much data can be sent before an acknowledgment
Explanation
The window size field allows flow control; it tells the sender how many bytes of data it can transmit before requiring an acknowledgment, preventing the receiver from being overwhelmed.
- A
- 13
How does TCP handle segments that arrive out of order?
- A
It tells the sender to resend all segments
- B
It uses sequence numbers to reorder them correctly
- C
It ignores the order and processes them as they arrive
- D
It discards them and requests retransmission
Correct answer
BIt uses sequence numbers to reorder them correctly
Explanation
TCP sequence numbers allow the receiver to reorder out-of-order segments into the correct order before passing data to the application.
- A
- 14
Which three flags are commonly used in TCP for connection establishment and termination?
- A
ACK, PSH, URG
- B
SYN, RST, FIN
- C
SYN, ACK, FIN
- D
FIN, ACK, RST
Correct answer
CSYN, ACK, FIN
Explanation
SYN and ACK are used for connection establishment (three-way handshake), and FIN is used for connection termination (four-way handshake).
- A
- 15
Which of the following is a characteristic of UDP?
- A
Flow control using window size
- B
Connection-oriented communication
- C
Low overhead communication
- D
Reliable data delivery
Correct answer
CLow overhead communication
Explanation
UDP is connectionless, unreliable, and has low overhead because it has a minimal header (8 bytes) and no flow control or sequencing. It provides best-effort delivery.
- A
- 16
Which fields are present in the UDP header?
- A
Source port, destination port, window size, checksum
- B
Source port, destination port, length, checksum
- C
Source port, destination port, flags, urgent pointer
- D
Source port, destination port, sequence number, acknowledgement number
Correct answer
BSource port, destination port, length, checksum
Explanation
The UDP header contains only four fields: source port, destination port, length, and checksum. It lacks sequence number, acknowledgment number, window size, and flags.
- A
- 17
How does UDP handle lost segments?
- A
It retransmits them after a timeout
- B
It uses forward error correction to recover lost data
- C
It has no mechanism for retransmission; segments are sent best-effort
- D
It requests the sender to resend using a NAK
Correct answer
CIt has no mechanism for retransmission; segments are sent best-effort
Explanation
UDP does not provide any reliability; it sends segments best-effort. If a segment is lost, there is no retransmission mechanism.
- A
- 18
UDP does not provide which of the following TCP features? (Select three)
- A
Port numbers
- B
Flow control
- C
Sequencing
- D
Error recovery
Correct answer
BFlow control
Explanation
UDP does not provide error recovery, sequencing, or flow control. However, both TCP and UDP provide port numbers for addressing.
- A
- 19
Which transport protocol is more suitable for real-time voice and video applications?
- A
TCP, because it ensures reliable delivery
- B
UDP, because it supports larger packet sizes
- C
TCP, because it provides flow control
- D
UDP, because it has low overhead and is delay-sensitive
Correct answer
DUDP, because it has low overhead and is delay-sensitive
Explanation
Real-time applications like VoIP and video conferencing are delay-sensitive. UDP's low overhead and lack of retransmission avoid delays, making it preferable despite sacrificing reliability.
- A
- 20
Why is TCP preferred for file downloads over UDP?
- A
TCP guarantees reliable delivery and error recovery
- B
TCP provides faster transfer speeds
- C
TCP uses smaller headers than UDP
- D
TCP does not require acknowledgments
Correct answer
ATCP guarantees reliable delivery and error recovery
Explanation
File downloads require data integrity; TCP ensures all data is received correctly by retransmitting lost segments. UDP does not guarantee delivery.
- A
- 21
Which application layer protocol uses both TCP and UDP?
- A
FTP
- B
DHCP
- C
DNS
- D
HTTP
Correct answer
CDNS
Explanation
DNS uses UDP for most queries (port 53) but can use TCP for zone transfers or when responses exceed 512 bytes.
- A
- 22
Which of the following is true about TCP and UDP?
- A
Both provide sequencing of data segments
- B
Both provide reliable delivery
- C
Both provide flow control
- D
Both provide Layer 4 addressing using port numbers
Correct answer
DBoth provide Layer 4 addressing using port numbers
Explanation
Both TCP and UDP use port numbers for Layer 4 addressing. Only TCP provides flow control, reliability, and sequencing.
- A
- 23
What is a common application that uses UDP but implements reliability at the application layer?
- A
HTTP
- B
TFTP
- C
SMTP
- D
SSH
Correct answer
BTFTP
Explanation
TFTP (Trivial File Transfer Protocol) uses UDP but adds its own reliability mechanisms at the application layer, such as acknowledgments and retransmissions.
- A
- 24
Which port numbers are used by FTP for control and data?
- A
TCP 21 and 22
- B
UDP 20 and 21
- C
TCP 20 and 23
- D
TCP 20 and 21
Correct answer
DTCP 20 and 21
Explanation
FTP uses TCP ports 20 for data transfer and 21 for control commands.
- A
- 25
Which protocol uses TCP port 22?
- A
HTTP
- B
SMTP
- C
SSH
- D
Telnet
Correct answer
CSSH
Explanation
SSH (Secure Shell) uses TCP port 22 for secure remote access.
- A
- 26
What is the default TCP port for HTTP?
- A
25
- B
8080
- C
80
- D
443
Correct answer
C80
Explanation
HTTP uses TCP port 80 by default. HTTPS uses port 443.
- A
- 27
Which port does SMTP use by default?
- A
UDP 25
- B
UDP 110
- C
TCP 25
- D
TCP 110
Correct answer
CTCP 25
Explanation
SMTP (Simple Mail Transfer Protocol) uses TCP port 25 for sending email.
- A
- 28
Which protocol uses UDP ports 67 and 68?
- A
DHCP
- B
DNS
- C
TFTP
- D
SNMP
Correct answer
ADHCP
Explanation
DHCP (Dynamic Host Configuration Protocol) uses UDP ports 67 (server) and 68 (client).
- A
- 29
Which application uses UDP port 69?
- A
DNS
- B
SNMP
- C
TFTP
- D
Syslog
Correct answer
CTFTP
Explanation
TFTP (Trivial File Transfer Protocol) uses UDP port 69.
- A
- 30
Which protocol uses UDP ports 161 and 162?
- A
Syslog
- B
SNMP
- C
DHCP
- D
DNS
Correct answer
BSNMP
Explanation
SNMP (Simple Network Management Protocol) uses UDP ports 161 (queries) and 162 (traps).
- A
- 31
Which protocol uses UDP port 514?
- A
DHCP
- B
TFTP
- C
Syslog
- D
SNMP
Correct answer
CSyslog
Explanation
Syslog uses UDP port 514 for sending log messages.
- A

Ask anything
We've read this whole study set, so questions about it get the best answers.