# Protocol Based Interview Questions
## What port does HTTP use
HTTP uses port 80. HTTPS uses port 443.
## What port does FTP use
FTP uses port 21 for control connection and port 20 for data connection.
## What port does SSH use
SSH uses port 22.
## What port does DNS use
DNS uses port 53. It uses UDP for queries and TCP for zone transfers.
## What port does SMTP use
SMTP uses port 25 for server to server communication and port 587 for client to server submission.
## What port does DHCP use
DHCP uses port 67 on the server side and port 68 on the client side.
## What is the difference between HTTP GET and POST
GET requests data from a server. The data is included in the URL. GET requests can be cached and bookmarked. POST submits data to a server. The data is included in the request body and not in the URL. POST is used for form submissions and when sending sensitive data.
## What does a 404 HTTP status code mean
A 404 status code means the requested resource was not found on the server. Other important codes are 200 which means success, 301 which means permanent redirect, 403 which means forbidden, 500 which means internal server error.
## How does DNS resolution work step by step
When a user types a domain name the browser checks its local cache first. If not found it queries the operating system resolver. The resolver checks its own cache. If not found it contacts a recursive resolver provided by the ISP. The recursive resolver queries the root name server which refers it to the TLD name server. The TLD name server refers it to the authoritative name server for the domain. The authoritative name server returns the IP address. The resolver caches the result and returns it to the client.
## What is the DORA process in DHCP
DORA stands for Discover, Offer, Request, and Acknowledge. The client broadcasts a Discover message. The server responds with an Offer containing an available IP address. The client broadcasts a Request accepting the offer. The server responds with an Acknowledge confirming the assignment.
## What is the difference between active and passive FTP
In active FTP the server initiates the data connection to the client. This can be blocked by client-side firewalls. In passive FTP the client initiates both the control and data connections to the server. Passive FTP works better through firewalls.
## What is SNMP used for
SNMP stands for Simple Network Management Protocol. It is used to monitor and manage network devices such as routers, switches, and servers. Network management systems use SNMP to collect performance data, receive alerts, and configure devices remotely.
## What is the difference between POP3 and IMAP
POP3 downloads email from the server to the local device and typically deletes it from the server. It does not synchronize state between multiple devices. IMAP keeps email on the server and synchronizes state across all devices. If you read an email on your phone it is marked as read on your laptop too.
## What protocol is used to synchronize time across networks
NTP stands for Network Time Protocol and is used to synchronize clocks across networked devices. Accurate time is important for security certificates, logs, and distributed applications.
## What is the difference between TCP and UDP in terms of headers
The TCP header is a minimum of 20 bytes and contains fields for source port, destination port, sequence number, acknowledgment number, flags, window size, checksum, and urgent pointer. The UDP header is only 8 bytes and contains source port, destination port, length, and checksum. The smaller UDP header contributes to its speed advantage.
## What is a socket
A socket is the combination of an IP address and a port number. It identifies a specific application endpoint on a specific device. A TCP connection is identified by the pair of sockets at each end, meaning source IP, source port, destination IP, and destination port together uniquely identify every connection.
## What happens when you type a URL in a browser
The browser parses the URL to extract the protocol, domain, and path. It performs DNS resolution to find the IP address of the domain. It establishes a TCP connection to the server on port 80 for HTTP or 443 for HTTPS. If HTTPS it performs the TLS handshake. It sends an HTTP GET request. The server responds with the HTML content. The browser parses the HTML, makes additional requests for CSS, JavaScript, and images, and renders the page.
## What is HTTPS and how does it differ from HTTP
HTTPS is HTTP with TLS encryption. All data exchanged between the browser and server is encrypted. The server presents a digital certificate to prove its identity. HTTPS prevents eavesdropping, tampering, and impersonation attacks. The padlock icon in the browser indicates an HTTPS connection.Back to Subject