Top 10 Interview Questions & Answers | TCP/UDP

Network traffic is mainly categorized into two types of packets: Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). Both protocols help 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.

TCP/UDP Interview Questions and Answers

Q1. Explain Transmission Control Protocol, TCP.

Ans:

  • TCP is a connection-oriented protocol. It simply means when data is transferred from source to destination, the protocol takes care of data integrity by sending the data packet again if it is lost during transmission.
  • TCP ensures reliability and an 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.

Ans: 

  • 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.

Ans:

  • 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?

Ans: 

  • Telnet is a protocol used to access remote servers 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 common TCP/IP ports and protocols.

Ans: I am listing out common TCP/IP ports and protocols:

ProtocolPort NumberRFCTCP/UDP
File Transfer Protocol (FTP)20/21959TCP
Secure Shell (SSH)224250-4256TCP
Telnet23854TCP
Simple Mail Transfer Protocol (SMTP)255321TCP
Domain Name System (DNS)531034-1035TCP/UDP
Dynamic Host Configuration Protocol (DHCP)67/682131UDP
Trivial File Transfer Protocol (TFTP)691350UDP

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.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

10 Blockchain Security Vulnerabilities OWASP API Top 10 - 2023 7 Facts You Should Know About WormGPT OWASP Top 10 for Large Language Models (LLMs) Applications Top 10 Blockchain Security Issues