# Previous Year Questions - Computer Networks
## GATE Style Questions
Question 1 (GATE 2019):
Which of the following is NOT a function of the Data Link layer?
A) Framing
B) Error detection
C) Routing
D) Flow control
Answer: C - Routing is a function of the Network layer not the Data Link layer.
Question 2 (GATE 2020):
In a network with 5 routers running RIP, the maximum number of hops between any two routers must be less than?
A) 5
B) 10
C) 15
D) 16
Answer: C - RIP maximum hop count is 15. Any destination with 16 hops is considered unreachable.
Question 3 (GATE 2018):
Which protocol is used to resolve an IP address to a MAC address?
A) RARP
B) ARP
C) ICMP
D) DNS
Answer: B - ARP resolves IP addresses to MAC addresses. RARP does the reverse.
Question 4 (GATE 2021):
A TCP connection uses a window size of 65,535 bytes and round trip time of 30 ms. What is the maximum throughput?
Solution:
Maximum throughput = Window size / RTT = 65,535 bytes / 0.03 seconds = 2,184,500 bytes per second = approximately 17.5 Mbps.
Question 5:
Host A has IP 192.168.1.50/26. Host B has IP 192.168.1.100/26. Can they communicate without a router?
Solution:
Host A subnet: 192.168.1.0/26 range .0 to .63
Host B subnet: 192.168.1.64/26 range .64 to .127
They are in different subnets so they cannot communicate without a router.
## University Exam Style Questions
Question 6:
Explain the concept of sliding window protocol and how it improves efficiency over stop-and-wait.
Answer:
Stop-and-wait allows only one unacknowledged frame at a time. The sender must wait for an acknowledgment before sending the next frame. This wastes bandwidth especially when propagation delay is large compared to transmission time.
Sliding window allows the sender to transmit multiple frames before waiting for acknowledgments up to a window size limit. The window slides forward as acknowledgments are received. This keeps the link busy with data being transmitted while waiting for acknowledgments from earlier frames.
Efficiency = Window size / (1 + 2a) when window is smaller than bandwidth-delay product, where a is propagation delay divided by transmission time. Larger window size gives higher efficiency.
Question 7:
What is the difference between circuit switching and packet switching? Give advantages of each.
Answer:
Circuit switching establishes a dedicated path before communication begins. Resources are reserved for the entire duration. The telephone network traditionally used circuit switching.
Advantages of circuit switching: Guaranteed bandwidth and quality, consistent low latency, no queuing delays once established.
Packet switching divides data into packets that are routed independently. Resources are shared dynamically among multiple communications. The internet uses packet switching.
Advantages of packet switching: Better resource utilization since bandwidth is shared, resilience since packets can take different routes around failures, scalability to support many simultaneous users, suitable for bursty data traffic.
Question 8:
Describe the DORA process in DHCP and explain what happens at each step.
Answer:
DORA is an acronym for Discover Offer Request Acknowledge.
Discover: The client has no IP address so it broadcasts a DHCP Discover message to 255.255.255.255 from source address 0.0.0.0. It includes its MAC address so the server can identify it.
Offer: One or more DHCP servers receive the discover message and respond with a DHCP Offer. The offer includes an available IP address, subnet mask, default gateway, DNS servers, and lease duration. The offer is unicast to the client using its MAC address.
Request: The client receives one or more offers and selects one by broadcasting a DHCP Request message. Broadcasting instead of unicasting informs all servers which offer was selected, allowing other servers to return their offered addresses to the available pool.
Acknowledge: The selected DHCP server sends a DHCP Acknowledge confirming the lease. After receiving this the client configures its network interface with the provided settings.
Question 9:
Calculate all subnet information for IP 192.168.100.130/27.
Answer:
Prefix = /27 so 27 network bits and 5 host bits.
Subnet mask = 255.255.255.224.
Block size = 256 - 224 = 32.
130 / 32 = 4 remainder 2, subnet base = 4 x 32 = 128.
Network address: 192.168.100.128
Broadcast: 192.168.100.159
First host: 192.168.100.129
Last host: 192.168.100.158
Usable hosts: 30
Question 10:
What is NAT and why is it used? Explain PAT with an example.
Answer:
NAT stands for Network Address Translation. It translates private IP addresses to a public IP address when communicating with the internet. NAT is used because IPv4 addresses are exhausted. It allows thousands of devices with private addresses to share a single public IP address.
PAT is Port Address Translation or NAT overload. It is the most common form of NAT used in home routers. The router maintains a NAT table mapping each internal IP address and port to a unique port number on the public IP address.
Example: Three devices at 192.168.1.2 port 1234, 192.168.1.3 port 5678, and 192.168.1.4 port 9012 all send traffic to the internet through a router with public IP 203.0.113.1. The router translates them to 203.0.113.1 port 1024, 203.0.113.1 port 1025, and 203.0.113.1 port 1026 respectively. When responses come back the router uses the port numbers to determine which internal device should receive each response.Back to Subject