# Viva Questions Computer Networks
## What is the purpose of the Physical layer
The Physical layer is responsible for transmitting raw bits over a physical medium. It defines the electrical, mechanical, and functional specifications for the physical connection. It deals with cables, connectors, voltages, and signal timing.
## What is the purpose of the Data Link layer
The Data Link layer provides reliable transmission of frames between two directly connected nodes. It handles framing, error detection using CRC, flow control, and media access control. It uses MAC addresses to identify devices within a local network.
## What is encapsulation
Encapsulation is the process of adding header information at each layer of the OSI model as data moves from the Application layer down to the Physical layer. At each layer the data from the layer above becomes the payload and a new header is added.
## What is decapsulation
Decapsulation is the reverse of encapsulation. As data moves up through the OSI layers on the receiving side, each layer reads and removes the header added by its corresponding layer on the sending side.
## What is a PDU
PDU stands for Protocol Data Unit. It is the name for the data unit at each OSI layer. At the Transport layer it is called a segment. At the Network layer it is called a packet. At the Data Link layer it is called a frame. At the Physical layer it is called a bit.
## What is the difference between connectionless and connection-oriented protocols
A connection-oriented protocol like TCP establishes a connection before data transfer begins and maintains that connection throughout the communication. A connectionless protocol like UDP sends each packet independently without establishing a connection first.
## What is half-duplex and full-duplex
In half-duplex mode data can flow in both directions but not at the same time. Only one side can transmit at a time. Walkie-talkies are an example. In full-duplex mode data can flow in both directions simultaneously. Modern Ethernet and telephone calls are full-duplex.
## What is a collision domain
A collision domain is a network segment where only one device can transmit at a time. If two devices transmit simultaneously their signals collide and both must retransmit. A hub creates a single collision domain. Each port of a switch is a separate collision domain.
## What is a broadcast domain
A broadcast domain is a network segment where a broadcast packet sent by one device is received by all other devices in the segment. Routers separate broadcast domains. Switches do not separate broadcast domains but VLANs do.
## What is the loopback address
The loopback address is 127.0.0.1 in IPv4. It is used by a device to send packets to itself to test the local network stack. Any packet sent to 127.0.0.1 never leaves the device and is returned to the sender.
## What is TTL in an IP packet
TTL stands for Time to Live. It is a field in the IP header that is decremented by 1 at each router the packet passes through. When TTL reaches zero the router discards the packet and sends an ICMP Time Exceeded message to the source. TTL prevents packets from circulating indefinitely in the network.
## What is the difference between routing and switching
Switching operates at Layer 2 and forwards frames within a local network based on MAC addresses. Routing operates at Layer 3 and forwards packets between different networks based on IP addresses. A switch connects devices within the same network. A router connects different networks.
## What is a default route
A default route is a routing table entry that matches all destination addresses that are not matched by any more specific route. It is written as 0.0.0.0/0. Traffic that does not match any specific route is forwarded to the next hop specified in the default route, typically the internet gateway.
## What is port forwarding
Port forwarding is a NAT configuration that allows incoming connections from the internet to be directed to a specific device and port on the internal private network. For example port forwarding on port 80 to an internal web server allows the server to be accessible from the internet.
## What is a proxy server
A proxy server acts as an intermediary between clients and servers. Clients send requests to the proxy, the proxy forwards them to the destination server, and returns the response to the client. Proxies can cache responses, filter content, provide anonymity, and log traffic.
## What is the difference between a router and a gateway
A router connects networks using the same protocol and routes packets based on IP addresses. A gateway connects networks that use different protocols and may perform protocol translation. In common usage the term default gateway refers to the router a device uses to reach other networks.
## What is Ethernet
Ethernet is the dominant technology for wired local area networks. It is defined by the IEEE 802.3 standard. Ethernet uses CSMA/CD for media access control on shared segments. It uses twisted pair cables with RJ-45 connectors or fiber optic cables. Modern Ethernet supports speeds from 10 Mbps to 100 Gbps.
## What is the spanning tree protocol
Spanning Tree Protocol or STP is a Layer 2 protocol that prevents loops in switched networks. If there are multiple paths between switches, a loop would cause broadcast storms that would bring down the network. STP selects one path as active and blocks the others. If the active path fails STP activates a blocked path.Back to Subject