DEV Community

Pavan Kumar Sadashiv
Pavan Kumar Sadashiv

Posted on

Computer Networks (CN) CIE-3 Complete 30/30 Exam Guide: Module 3 & Module 4 Important Questions & Solved Numericals

Computer Networks (CN) — CIE-3 Complete 30/30 Exam Guide

Exam Scope Overview:

  • Module 3: Starts from Transport Layer (Transport Service, Elements of Transport Protocols, Connection Establishment & Release, Multiplexing & Demultiplexing, Crash Recovery, UDP, TCP Segment Structure, RTT Estimation & Timeout, Congestion Control) + IPv4 vs IPv6 Differences.
  • Module 4: Application Layer (HTTP Persistent vs Non-Persistent, Conditional GET, Cookies, Web Caching, FTP, SMTP vs HTTP, POP3/IMAP, DNS) + AI in Computer Networks (AI in SDN & Self-Healing Networks).

Master Checklist of Important CN Questions

Module 3:

  1. RTT Estimation & TCP Timeout Numerical (also HTTP RTT calculation)
  2. TCP Segment Structure (neat diagram + explain every field)
  3. TCP Three-Way Handshake (connection establishment + handling old duplicates)
  4. Transport-Layer Multiplexing & Demultiplexing (UDP 2-tuple vs TCP 4-tuple)
  5. Difference between IPv4 and IPv6
  6. Crash Recovery (ACK-first vs Write-first & Forbidden Region)

Module 4:

  1. HTTP: Persistent vs Non-Persistent Connections (+ 2M Quick Hits: Stateless, Conditional GET, Status Codes)
  2. Cookies — How Information Is Stored & User-Server Interaction
  3. DNS — Function, Types/Classes of DNS Servers & Resource Records
  4. Difference between HTTP and SMTP
  5. SDN & AI in SDN
  6. Self-Healing Networks

Module 3 — High-Priority Questions & Exam Answers

1. RTT Estimation & TCP Timeout Problem (Guaranteed Numerical)

Formulas (RFC 6298):

  • EstimatedRTT (Exponential Weighted Moving Average): EstimatedRTT = (1 - α) × EstimatedRTT + α × SampleRTT (recommended α = 0.125 = 1/8)
  • DevRTT (RTT variability / deviation): DevRTT = (1 - β) × DevRTT + β × |SampleRTT - EstimatedRTT| (recommended β = 0.25 = 1/4)
  • Retransmission Timeout Interval: TimeoutInterval = EstimatedRTT + 4 × DevRTT

Exam Tip: Always compute in this exact order for EACH sample:
(1) EstimatedRTT → (2) DevRTT using the newly updated EstimatedRTT → (3) TimeoutInterval.

Solved Example 1

Given: Initial EstimatedRTT = 100 ms, DevRTT = 5 ms, α = 0.125, β = 0.25. Measured SampleRTT = 140 ms, 90 ms.

  • After SampleRTT = 140 ms:
    1. EstimatedRTT = 0.875(100) + 0.125(140) = 87.5 + 17.5 = 105 ms
    2. DevRTT = 0.75(5) + 0.25|140 - 105| = 3.75 + 8.75 = 12.5 ms
    3. TimeoutInterval = 105 + 4(12.5) = 155 ms
  • After SampleRTT = 90 ms:
    1. EstimatedRTT = 0.875(105) + 0.125(90) = 91.875 + 11.25 = 103.125 ms
    2. DevRTT = 0.75(12.5) + 0.25|90 - 103.125| = 9.375 + 3.28125 = 12.65625 ms
    3. TimeoutInterval = 103.125 + 4(12.65625) = 153.75 ms

Solved Practice Problem 2 (Very High Chance)

Given: Initial EstimatedRTT = 100 ms, DevRTT = 10 ms, α = 0.125, β = 0.25. Measured SampleRTT = 110 ms, 150 ms, 120 ms.

  • Sample 1 (110 ms):
    • EstimatedRTT = 0.875(100) + 0.125(110) = 101.25 ms
    • DevRTT = 0.75(10) + 0.25|110 - 101.25| = 7.5 + 2.1875 = 9.6875 ms
    • TimeoutInterval = 101.25 + 4(9.6875) = 140 ms
  • Sample 2 (150 ms):
    • EstimatedRTT = 0.875(101.25) + 0.125(150) = 107.34375 ms
    • DevRTT = 0.75(9.6875) + 0.25|150 - 107.34375| = 7.265625 + 10.6640625 = 17.9297 ms
    • TimeoutInterval = 107.34375 + 4(17.9296875) = 179.0625 ms
  • Sample 3 (120 ms):
    • EstimatedRTT = 0.875(107.34375) + 0.125(120) = 108.9258 ms
    • DevRTT = 0.75(17.9296875) + 0.25|120 - 108.92578125| = 16.2158 ms
    • TimeoutInterval = 108.92578 + 4(16.21582) = 173.79 ms

(Bonus — HTTP RTT Delay Formula if asked in Module 4: Non-persistent HTTP takes 2 × RTT + transmission time per object: 1 RTT for TCP handshake + 1 RTT for HTTP request/response. Persistent HTTP uses 1 RTT once for TCP + 1 RTT per object without pipelining, or 1 RTT for all referenced objects with pipelining.)


2. TCP Segment Structure (Diagram + Explanation)

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Source Port # (16)    |      Destination Port # (16)  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        Sequence Number (32)                   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Acknowledgment Number (32)                 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Header|           |U|A|P|R|S|F|                               |
| Length|  Unused   |R|C|S|S|Y|I|      Receive Window (16)      |
|  (4)  |    (6)    |G|K|H|T|N|N|                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|      Internet Checksum (16)   |     Urgent Data Pointer (16)  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                    Options (variable length)                  |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|               Application Data (variable length)              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Enter fullscreen mode Exit fullscreen mode

Field Explanations:

  1. Source & Destination Port Numbers (16 bits each): Used for multiplexing and demultiplexing to identify sending and receiving application sockets.
  2. Sequence Number (32 bits): Byte-stream number of the first byte of data in this segment (counts bytes, not segments).
  3. Acknowledgment Number (32 bits): Sequence number of the next byte expected from the other side (cumulative ACK).
  4. Header Length (4 bits): Length of the TCP header in 32-bit words (minimum 5 words = 20 bytes when Options is empty).
  5. Unused (6 bits): Reserved for future use.
  6. Flag Field (6 bits):
    • ACK: Indicates the acknowledgment number field is valid.
    • RST, SYN, FIN: Connection setup (SYN), teardown (FIN), and reset/abort (RST).
    • PSH: Requests receiver to push buffered data immediately to the application.
    • URG: Indicates urgent data is present (end marked by Urgent Data Pointer).
  7. Receive Window (16 bits): Used for flow control — specifies the number of bytes the receiver is willing to accept (free buffer space).
  8. Internet Checksum (16 bits): Error detection covering header, data, and pseudo-header.
  9. Urgent Data Pointer (16 bits): Points to the last byte of urgent data when URG = 1.
  10. Options (variable) & Application Data (variable): Optional parameters (e.g., MSS negotiation, window scaling) followed by payload data.

3. TCP Three-Way Handshake (Connection Establishment)

Client (Host 1)                                   Server (Host 2)
      |                                                 |
      |--- Step 1: SYN=1, seq = x (CR) ---------------->|
      |                                                 | (allocates buffers)
      |<-- Step 2: SYN=1, ACK=1, seq = y, ack = x+1 ----|
      |                                                 |
(allocates buffers)                                     |
      |--- Step 3: ACK=1, seq = x+1, ack = y+1 (+data)->|
      |                                                 |
                  [ CONNECTION ESTABLISHED ]
Enter fullscreen mode Exit fullscreen mode

Steps:

  1. Step 1 (SYN): Client sends a TCP segment with SYN = 1, no application data, and an initial sequence number seq = x (CR(seq = x)).
  2. Step 2 (SYN-ACK): Server allocates TCP buffers/variables and replies with SYN = 1, ACK = 1, its initial sequence number seq = y, and ack = x + 1.
  3. Step 3 (ACK): Client allocates buffers/variables and responds with ACK = 1, ack = y + 1 (may include payload data). Connection is now ESTABLISHED.

Why 3-Way Handshake (and not 2-Way)?

  • Prevents old duplicate CR segments (delayed in the network from an earlier session) from opening a phantom connection:
    • When an old CR(seq = x) arrives at Host 2, Host 2 replies ACK(seq = y, ACK = x).
    • Host 1 realizes it never initiated that CR and sends REJECT(ACK = y) (RST in TCP), causing Host 2 to abort cleanly.
    • Even if an old duplicate DATA also replays, its ACK = z fails to match y, so Host 2 rejects it.

4. Transport-Layer Multiplexing & Demultiplexing

  • Multiplexing (at sender): Gathering data chunks from different sockets at the source host, encapsulating each with a transport-layer header (source/dest ports), and passing segments to the network layer.
  • Demultiplexing (at receiver): Examining header fields of incoming segments to identify the target socket and delivering data to the correct application process.
  • Port Numbers: 16-bit numbers (0–65535). Ports 0–1023 are well-known ports (e.g., HTTP = 80, FTP = 21, SMTP = 25). The source port acts as a "return address" so the receiver knows where to send replies.
Feature Connectionless Demultiplexing (UDP) Connection-Oriented Demultiplexing (TCP)
Socket Identifier 2-tuple: (Destination IP, Destination Port) 4-tuple: (Source IP, Source Port, Destination IP, Destination Port)
Behavior Segments with the same dest IP & dest port from different sources go to the same socket. Segments from different source IPs or source ports (even targeting port 80) go to separate sockets (one per connection).

5. Differences Between IPv4 and IPv6

Parameter IPv4 IPv6
Address Size 32-bit (~4.3 billion addresses, 2³²) 128-bit (~3.4 × 10³⁸ addresses, 2¹²⁸)
Notation Dotted decimal (192.168.1.10) Colon-separated hexadecimal (2001:0db8:85a3::8a2e:0370:7334)
Header Size Variable 20–60 bytes (due to Options) Fixed 40 bytes (8 fields; faster routing)
Header Checksum Present (recomputed at every router) Removed (handled by Link & Transport layers)
Fragmentation Performed by both sender and routers Performed only by sender (Path MTU Discovery)
Broadcast Supported Not supported (uses Multicast & Anycast)
Address Config Manual or DHCP Auto-configuration (SLAAC) + DHCPv6
Security (IPsec) Optional Built-in support
NAT Dependence Heavy reliance on NAT Eliminates need for NAT

(Transition Mechanisms: **1. Dual Stack, **2. Tunneling, **3. Protocol Translation / NAT64.)


6. Crash Recovery

  • Problem: Packet loss on the wire is handled by retransmissions, but if a host crashes and restarts, it loses volatile connection state (sequence numbers, unacked buffers).
  • Why Crash Recovery Is Difficult (Stop-and-Wait Client → Server):
    1. Case 1: ACK First, Then Write
      • Server sends ACK before delivering data to the application.
      • If server crashes after sending ACK and before writing, the client assumes success → Result: Data is lost.
    2. Case 2: Write First, Then ACK
      • Server delivers data to the application before sending ACK.
      • If server crashes after writing and before sending ACK, the client retransmits → Result: Duplicate data is delivered.
  • Takeaway: Without stable storage or application-level idempotency, a transport protocol cannot avoid both loss and duplication across a host crash. (Also note the **Forbidden Region* on restart: avoid reusing sequence numbers until old packets expire after time T.)*

Module 4 — High-Priority Questions & Exam Answers

7. HTTP: Persistent vs Non-Persistent Connections (+ 2-Mark Quick Hits)

Feature Non-Persistent HTTP (HTTP/1.0) Persistent HTTP (HTTP/1.1)
TCP Connections Opens a new TCP connection for each object (HTML + each image). Uses a single TCP connection left open to send multiple objects.
Connection Close Server closes TCP connection right after sending one object. Remains open until timeout or Connection: close.
Time / Overhead 2 × RTT + transmit time per object (high latency & TCP overhead). 1 RTT setup + 1 RTT per object (or 1 RTT total for all objects with pipelining).
Example (1 HTML + 10 JPEGs) Needs 11 TCP connections (~22 RTT). Needs 1 TCP connection (~12 RTT unpipelined, ~3 RTT pipelined).

2-Mark HTTP Quick Hits:

  • Why HTTP is stateless: Server stores no state/history about past client requests.
  • Conditional GET: Allows a Web cache (proxy) to verify cached content is fresh. Sends GET with If-modified-since: <date>; if unchanged, server responds HTTP/1.1 304 Not Modified with an empty body.
  • Web Caching Benefits: (1) Reduces client response time; (2) Reduces traffic on the institution's Internet access link.
  • Status Codes: 200 OK, 301 Moved Permanently, 400 Bad Request, 404 Not Found, 505 HTTP Version Not Supported.

8. Cookies — How Information Is Stored & User-Server Interaction

Because HTTP is stateless, websites use cookies to identify returning users.

Four Components of Cookie Technology:

  1. Set-cookie: header line in the HTTP response message (server → client).
  2. Cookie: header line in subsequent HTTP request messages (client → server).
  3. A cookie file stored on the user's end system and managed by the browser (e.g., amazon: 1678, ebay: 8734).
  4. A back-end database at the website mapping cookie ID (1678) to user data/cart.

Step-by-Step Flow:

  1. Client sends an HTTP request to amazon.com.
  2. Server generates ID 1678, saves it in its back-end DB, and responds with Set-cookie: 1678.
  3. Browser writes amazon: 1678 into the local cookie file.
  4. On every later visit, the browser attaches Cookie: 1678 to the HTTP request header; the server queries its DB for personalized actions.

9. DNS — Function, Types of DNS Servers & Resource Records

  • Main Function: Directory service mapping human-friendly hostnames (e.g., www.bietdvg.edu) to IP addresses (121.7.106.83). Uses UDP port 53.
  • Why Distributed (not Centralized)? A centralized DNS suffers from: (1) Single point of failure, (2) Massive traffic volume, (3) High latency from distant DB, (4) Maintenance difficulty.

A. Types / Classes of DNS Servers

  1. Root DNS Servers: Top of hierarchy (13 root server identities A–M globally); return IP addresses of TLD servers.
  2. Top-Level Domain (TLD) Servers: Handle generic TLDs (.com, .org, .net, .edu, .gov) and country TLDs (.in, .uk, .jp); return the authoritative DNS server IP.
  3. Authoritative DNS Servers: Maintained by organizations with public hosts (Web/mail servers); hold actual hostname-to-IP records.
  4. Local DNS Server: ISP/university resolver acting as proxy between client and the DNS hierarchy (8 messages total in a typical uncached lookup: 4 queries + 4 replies).

B. Types of DNS Resource Records (Name, Value, Type, TTL)

Type Name Value Purpose & Example
A Hostname IPv4 Address Hostname-to-IP mapping: (relay1.bar.foo.com, 145.37.93.126, A)
NS Domain Authoritative DNS hostname Identifies authoritative name server: (foo.com, dns.foo.com, NS)
CNAME Alias hostname Canonical hostname Alias-to-real hostname: (foo.com, relay1.bar.foo.com, CNAME)
MX Domain Mail server hostname Identifies mail server for SMTP delivery

(Query Types: Client → Local DNS is usually **recursive; Local DNS → Root → TLD → Authoritative is usually **iterative.)


10. Difference Between HTTP and SMTP

Both transfer files over TCP (HTTP port 80, SMTP port 25), with three key differences:

Aspect HTTP SMTP
Mode / Direction Pull Protocol: Users pull files from a Web server at their convenience (Server → Browser). Push Protocol: Sending mail server pushes email messages to receiving mail server.
Data Format Does not require 7-bit ASCII (supports binary directly). Requires every message (including body) in 7-bit ASCII (uses MIME/Base64 for attachments).
Encapsulation Encapsulates each object in its own HTTP response message. Places all objects of a message into one single email message.

(Mail Access Protocols to **pull* mail from recipient's mail server: POP3 [port 110; Authorization, Transaction, Update phases; +OK / -ERR] and IMAP [server-side folders, search, partial fetch].)*


11. SDN & AI in SDN (Module 4 — Part 2)

Software-Defined Networking (SDN) decouples the Control Plane (routing logic/software) from the Data Plane (packet-forwarding switches) and centralizes network intelligence in a programmable SDN Controller.

+-------------------------------------------------------+
|   Application Plane (Routing, Firewall, AI Apps)      |
+-------------------------------------------------------+
            ^   Northbound API (REST)   v
+-------------------------------------------------------+
|   Control Plane: SDN Controller + AI/ML Engine        |
|   (Global topology view, flow computation, policies)  |
+-------------------------------------------------------+
            ^   Southbound API (OpenFlow)   v
+-------------------------------------------------------+
|   Data Plane: Switches & Routers (Forwarding Tables)  |
+-------------------------------------------------------+
Enter fullscreen mode Exit fullscreen mode

Three SDN Planes:

  1. Data Plane: Hardware switches/routers forwarding packets using flow tables.
  2. Control Plane: Centralized SDN Controller computing paths and pushing flow rules via Southbound API (OpenFlow).
  3. Application Plane: Traffic engineering, security, and monitoring apps talking to the controller via Northbound APIs.

Role of AI in SDN:

  • Traffic Prediction & Load Balancing: ML predicts congestion and proactively reroutes flows.
  • Intelligent Routing (Heuristic / RL): Dynamically optimizes latency, throughput, and jitter.
  • Anomaly & Intrusion Detection: Detects DDoS/attacks in real time and pushes OpenFlow drop rules automatically.
  • Intent-Based Networking: Translates high-level policies into flow rules.

12. Self-Healing Networks (Module 4 — Part 2)

A self-healing network automatically detects, diagnoses, isolates, and recovers from network faults, link cuts, or cyberattacks in real time with minimal or zero human intervention.

Closed-Loop Workflow:

  1. Monitor (Telemetry): Continuously gather link state, latency, packet loss, and router/switch metrics.
  2. Detect & Analyze (AI/ML): Spot hardware failures, congestion spikes, or security anomalies.
  3. Diagnose (Root Cause Analysis): Pinpoint failing nodes, links, or misconfigurations.
  4. Heal / Reconfigure: SDN controller computes backup paths, updates flow tables, isolates compromised nodes, or restarts failed services.
  5. Verify & Learn: Confirm SLA recovery and update models for faster future remediation.

Benefits: Maximum uptime/availability, near-zero MTTR (Mean Time to Recovery), reduced manual operations, and resilience against outages or DDoS attacks.


30/30 Exam Strategy

  1. Nail the RTT Numerical first (EstimatedRTT, DevRTT, TimeoutInterval) — guaranteed full marks.
  2. Draw neat diagrams for TCP Segment Header (exact bit widths), 3-Way Handshake, Cookies, and SDN 3-Plane Architecture.
  3. Use comparison tables (IPv4 vs IPv6, Persistent vs Non-Persistent HTTP, HTTP vs SMTP, UDP vs TCP Demux) for crisp, examiner-friendly full-credit answers.

Top comments (0)