Top 10 Interview Questions & Answers | TCP/UDP


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.

Ans:

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

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 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:

ProtocolPort NumberDescription
File Transfer Protocol (FTP)20/21Protocol helps in transferring files between client and server.
Secure Shell (SSH)22This method helps to access remote server securely.
Telnet23This method also helps to access remote server but here, data is transmitted in clear text.
Simple Mail Transfer Protocol (SMTP)25This protocol helps in managing email services.
Domain Name System (DNS)53This 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.

Comments:

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

 
error: