Computer Networks Important Questions: 7 Worked Exam-Practice Answers
Can you explain a protocol without mixing up layers, and show every step in a numerical? This Computer Networks practice set helps you check that. It adds worked answers and marking checks to the full Computer Networks notes, rather than repeating the whole subject.
These are original exam-style questions, not previous-year questions or predictions. Your university may cover different units. Check the syllabus and your teacher's instructions first.
Pocket reference: 8 terms this set uses
- Prefix (subnet): a block of IP addresses; /26 means 26 network bits and 6 host bits.
- Next hop: the device on your own link that moves the packet closer to its destination.
- ARP / Neighbor Discovery: how a device finds the link-layer (MAC) address of an IPv4 or IPv6 next hop.
- Transmission delay: time to push a packet's bits onto the link; size divided by link rate.
- Propagation delay: time the signal takes to travel the link; depends on distance, not rate.
- Flow control: protects the receiving endpoint's buffer.
- Congestion control: protects the network path from overload.
- Longest-prefix match: when several routes match, the most specific prefix wins.
1. Switch versus router: explain the next hop
Question: A laptop sends a packet to a server outside its IPv4 subnet. Does it put the server's MAC address in the local Ethernet frame?
Worked answer: Normally, no. The laptop checks its route and sends the packet toward a gateway. On its local Ethernet link, the frame is addressed to the gateway's MAC address. ARP can resolve that local next-hop IPv4 address. The IP destination remains the remote server unless a device translates it. At the next routed link, a new frame carries the packet to the next hop.
Laptop -- local Ethernet frame --> Gateway -- new frame --> Next router Frame destination: local next hop IP destination: final server (without address translation)
Answer check: Mention both kinds of address and the purpose of each. "A router uses IP, a switch uses MAC" is a start, but the next-hop example shows that you understand the difference. IPv6 uses Neighbor Discovery rather than ARP.
How a packet is wrapped, in 5 seconds
+ TCP header → segment: order, retransmission, byte stream
+ IP header → packet: source and destination IP; destination normally stays the same
+ Ethernet header → frame: MAC addresses for the local link only, replaced at each routed link
This is why question 1 has two address answers. The IP destination normally stays unchanged (without address translation); other fields such as TTL change. The frame header carries only the local next hop, so a router replaces it on each outgoing link.
2. Solve an IPv4 /26 subnet step by step
Question: Find the network, broadcast, conventional usable-host range and host count for 192.0.2.77/26.
- IPv4 has 32 bits. A /26 prefix leaves 6 host bits.
- Total addresses = 26 = 64. The mask is 255.255.255.192.
- Last-octet blocks start at 0, 64, 128 and 192. Since 77 lies from 64 through 127, the network is 192.0.2.64.
- The final address in that block is 192.0.2.127, the conventional broadcast.
- Conventional host range: 192.0.2.65 to 192.0.2.126. Host count = 64 - 2 = 62.
The 192.0.2.0/24 block is reserved for documentation. Do not use this example as a real public destination. The "subtract two" rule describes ordinary IPv4 subnet exercises; do not apply it blindly to /31 point-to-point links, /32 routes or IPv6.
Self-test: What block contains 192.0.2.150/26? Answer: network 192.0.2.128, broadcast 192.0.2.191, conventional hosts .129 through .190.
3. Transmission delay is not propagation delay
Question: An ideal store-and-forward path has two links. A 1,500-byte packet crosses a 6 Mb/s link and then a 3 Mb/s link. Propagation is 2 ms per link. Ignore headers, processing and queues. How long until the final bit reaches the destination?
- Packet size = 1,500 × 8 = 12,000 bits.
- First transmission = 12,000 / 6,000,000 seconds = 2 ms.
- Second transmission = 12,000 / 3,000,000 seconds = 4 ms.
- Propagation = 2 + 2 = 4 ms.
- Total = 2 + 4 + 4 = 10 ms.
Store-and-forward means the intermediate device receives the complete packet before transmitting it on the next link in this model. This calculation is for one packet, not a sustained stream with overlapping transmissions.
Common mistake: Adding 1,500 directly to Mb/s mixes bytes and bits. Write units at every step. Increasing link rate reduces transmission time; it does not eliminate the time a signal takes to travel.
4. TCP flow control versus congestion control
Question: Why are both needed?
Answer: Flow control stops a sender from overwhelming the receiving TCP endpoint's available buffering. Congestion control limits load in response to conditions along the network path. A receiver may have space while the network is congested, or the network may be clear while the receiver cannot accept more data.
TCP provides an ordered reliable byte stream using sequence numbers, acknowledgments and recovery from loss. It does not preserve application message boundaries. An application must define how one message ends and another begins. TCP also does not encrypt the data by itself.
Answer check: Name the resource being protected. Do not write "both prevent packet loss" as your entire comparison.
5. Does UDP mean the application cannot be reliable?
Question: Compare TCP and UDP without saying one is always faster.
Answer: TCP supplies connection state and reliable ordered stream delivery. UDP supplies datagrams without a built-in guarantee of delivery or order. An application can add acknowledgments, retransmission or other delivery rules over UDP. QUIC is an example of a transport built over UDP with additional features.
Choose according to the application's needs, not a slogan. Real-time media may prefer a late packet to be dropped, while file transfer needs complete data. Actual speed depends on the protocol implementation, network, workload and recovery behavior.
| Property | TCP | UDP |
|---|---|---|
| Delivery | Reliable, with retransmission | No built-in guarantee |
| Order | Ordered byte stream | Independent datagrams |
| Setup | Connection handshake first | None; just send |
| Fits well | Web pages, files, mail: complete data matters | Live media, DNS lookups; QUIC builds reliability on top |
6. Trace DNS, transport, TLS and HTTP separately
Question: DNS resolves a website correctly, but the server returns HTTP 404. Should you change the DNS server?
Answer: Not as the first fix. Resolution succeeded and an HTTP response arrived. Check the requested path and the server's resource routing. A 404 is different from a DNS lookup failure, connection timeout or TLS certificate error.
- DNS obtains a record for the hostname, possibly from a cache.
- A common HTTPS connection uses TCP followed by TLS, then HTTP. Existing connections can be reused.
- HTTP/3 uses QUIC over UDP, so not every request follows the TCP sequence.
- HTTP returns a status, headers and body. More resources may require more requests.
Answer check: Keep the stage and symptom together. Never disable certificate checks as a general fix for a TLS error.
7. Longest-prefix matching practice
A routing table has 0.0.0.0/0 via A, 192.0.2.0/24 via B and 192.0.2.64/26 via C. Which route matches 192.0.2.90?
All three prefixes match, but /26 is the longest matching prefix, so choose C. For 192.0.2.200, the /26 does not match; choose B. For 198.51.100.8, only the default matches; choose A. This example assumes the table entries are usable and omits equal-cost and policy details.
Check every number with Python
The program below was executed before publishing. It recomputes the subnet answers from question 2, the delay answer from question 3 and the routing answers from question 7, using Python's ipaddress module and plain arithmetic. The results match the worked steps above.
import ipaddress
def subnet_summary(cidr):
net = ipaddress.ip_network(cidr, strict=False)
hosts = list(net.hosts())
return net.network_address, net.broadcast_address, hosts[0], hosts[-1], len(hosts)
for cidr in ["192.0.2.77/26", "192.0.2.150/26"]:
n, b, first, last, count = subnet_summary(cidr)
print(f"{cidr}: network {n}, broadcast {b}")
print(f" conventional hosts {first} to {last}, count {count}")
packet_bits = 1500 * 8
t1 = packet_bits / 6_000_000 * 1000
t2 = packet_bits / 3_000_000 * 1000
prop = 2 + 2
print(f"delay: {t1:.0f} ms + {t2:.0f} ms transmit + {prop} ms propagation = {t1 + t2 + prop:.0f} ms")
routes = [("0.0.0.0/0", "A"), ("192.0.2.0/24", "B"), ("192.0.2.64/26", "C")]
def best_route(ip):
addr = ipaddress.ip_address(ip)
matches = [(ipaddress.ip_network(p).prefixlen, via)
for p, via in routes
if addr in ipaddress.ip_network(p)]
return max(matches)[1]
for ip in ["192.0.2.90", "192.0.2.200", "198.51.100.8"]:
print(f"{ip}: route via {best_route(ip)}")Output:
192.0.2.77/26: network 192.0.2.64, broadcast 192.0.2.127
conventional hosts 192.0.2.65 to 192.0.2.126, count 62
192.0.2.150/26: network 192.0.2.128, broadcast 192.0.2.191
conventional hosts 192.0.2.129 to 192.0.2.190, count 62
delay: 2 ms + 4 ms transmit + 4 ms propagation = 10 ms
192.0.2.90: route via C
192.0.2.200: route via B
198.51.100.8: route via AA note on method: the conventional host count uses net.hosts(), which excludes the network and broadcast addresses. For /31 point-to-point links, RFC 3021 changes that convention, which is why question 2 warns against applying the rule blindly.
8. A 20-minute revision routine
- 5 minutes: explain next-hop delivery aloud and sketch the frame/IP distinction.
- 5 minutes: solve the /26 subnet without looking at the answer.
- 5 minutes: solve the two-link delay numerical with units.
- 5 minutes: compare flow/congestion control and diagnose the HTTP 404 example.
For code-based exercises, use the Computer Networks Lab File. The Numericals Hub collects separate worked guides. Find your other subjects in the semester-wise Exam Notes hub.
Exam and interview quick answers
- Which address changes at every hop? The link-layer (MAC) addresses. The IP destination stays the same unless a device translates it.
- Why subtract two in an ordinary IPv4 host count? One address names the network and one is the conventional broadcast.
- Why doesn't a faster link remove all delay? It cuts transmission delay, but propagation delay depends on distance and signal speed.
- Does TCP preserve message boundaries? No. It delivers an ordered byte stream; the application must frame its own messages.
- Is an application on UDP always unreliable? No. UDP adds no guarantee, but the application can add acknowledgments and retransmission; QUIC does exactly this.
- DNS resolves but you see HTTP 404. DNS problem? No. Resolution succeeded and a response arrived; check the path and server routing.
- Two routes match a destination. Which wins? The longest matching prefix; /26 beats /24, which beats the default route.
- Why does store-and-forward matter in delay questions? Each device must receive the whole packet before forwarding, so transmission delay is paid on every link.
Sources and further reading
The questions, examples and revision routine are original. Protocol facts were checked against RFC 9293: TCP, RFC 4632: CIDR and Cloudflare's subnet explanation. Documentation-address usage is described in RFC 5737. IPv4 /31 exceptions are covered in RFC 3021. QUIC is specified in RFC 9000.
Which answer is hardest to explain without memorizing? Ask a specific question in the comments.
Comments
Post a Comment