Network traffic mainly categorizes into two types: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). Both protocols help in to establish the connection and transfer data between two ends of the communication. Below are the TCP/UDP interview questions and answers which generally asked in an interview.
Q1. Explain Transmission Control Protocol, TCP.
- TCP is a connection-oriented protocol. It simply means when data is transferring from source to destination, protocol takes care of data integrity by sending data packet again if it lost during transmission.
- TCP ensures reliability and error-free data stream.
- TCP packets contain fields such as Sequence Number, AcK number, Data offset, Reserved, Control bit, Window, Urgent Pointer, Options, Padding, checksum, Source port, and Destination port.
Q2. Explain User Datagram Protocol, UDP.
- UDP is a connection-less protocol. In simple terms, if one data packet is lost during transmission, it will not send that packet again.
- This protocol is suitable where minor data loss is not a major issue.
Q3. How does TCP work?
Ans: TCP uses a three-way handshake to establish a connection between client and server. It uses SYN, ACK and FIN flags (1 bit) for connecting two endpoints. After the establishment of the connection, data is transferred sequentially. If there is any loss of packet, it retransmits data.
Q4. List out common TCP/IP protocols.
- HTTP – Used between a web client and a web server, for non-secure data transmissions.
- HTTPS – Used between a web client and a web server, for secure data transmissions.
- FTP – Used between two or more computers to transfer files.
Q5. Comparison between TCP/IP & OSI model.
Ans: TCP/IP is the alternate model that also explains the information flow in the network. It is a simpler representation in comparison to the OSI model but contains fewer details of protocols than the OSI model.
Q6. Is UDP better than TCP?
Ans: Both protocols are used for different purposes. If the user wants error-free and guarantees to deliver data, TCP is the choice. If the user wants fast transmission of data and little loss of data is not a problem, UDP is the choice.
Q7. What is the port number of Telnet and DNS?
- Telnet is a protocol used to access remote server but insecurely. Port no of Telnet is 23.
- DNS is a protocol used to translate a domain name to IP address. Port no of DNS is 53.
Q8. What is the UDP packet format?
Ans: The UDP packet format contains four fields:
- Source Port and Destination Port fields (16 bits each): Endpoints of the connection.
- Length field (16 bits) : length of the header and data.
- Checksum field (16 bits) : It allows packet integrity checking (optional).
Q9. What is the TCP packet format?
Ans: The TCP packet format consists of these fields:
Source Port and Destination Port fields (16 bits each); Sequence Number field (32 bits); Acknowledgement Number field (32 bits); Data Offset (a.k.a. Header Length) field (variable length); Reserved field (6 bits); Flags field (6 bits) contains the various flags: URG, ACK, PSH, RST, SYN, FIN; Window field (16 bits); Checksum field (16 bits) ; Urgent pointer field (16 bits) ; Options field (variable length) & Data field (variable length).
Q10. List out some TCP/IP ports and protocols.
Ans: I am listing some TCP/IP ports and protocols:
|File Transfer Protocol (FTP)||20/21||Protocol helps in transferring files between client and server.|
|Secure Shell (SSH)||22||This method helps to access remote server securely.|
|Telnet||23||This method also helps to access remote server but here, data is transmitted in clear text.|
|Simple Mail Transfer Protocol (SMTP)||25||This protocol helps in managing email services.|
|Domain Name System (DNS)||53||This protocol helps in translating domain name into IP addresses.|
Subscribe us to receive more such articles updates in your email.
If you have any questions, feel free to ask in the comments section below. Nothing gives me greater joy than helping my readers!
Disclaimer: This tutorial is for educational purpose only. Individual is solely responsible for any illegal act.