CSS Prepare

optional · CSS study notes

P-II.II. Computer Communications & Networks

CSS Computer Science (Optional) — Paper-II, Section-A, Topic II.

Organised by OSI layer, bottom-up (Physical → Data Link/WAN → Network → Transport → Application), with cross-layer Devices and Security groups kept separate — so topics that get compared against each other in the exam (e.g. hub vs switch vs router, or TCP vs UDP) now sit together instead of being scattered across a flat book-order list. Topic pages follow Definition → Key Points → CSS Exam Angle → Example → Practice Questions → Past-Paper Questions & Structured Answers. Use the exact year/paper/question references in each final section; a year in a legacy title is not sufficient evidence of an exam occurrence.

🧭

Navigation outline — the list below jumps to each section of this page; the Quick Reference table under it links straight to every topic page, grouped by layer.

🗺️ Quick Reference — Topic → Category Map


📖 Topics by Category

🌐 Foundations & Models

Prerequisite concepts and the reference model everything else below builds on.

🔌 Physical Layer (L1)

Raw bits, transmission media, physical/signal-level topics.

Framing, error/flow control on one hop, and the switching/WAN technologies built on top of it.

🗺️ Network Layer (L3)

Logical addressing and routing — host-to-host delivery.

🌐 Cross-Layer — Network Devices

One page, but the devices on it span L1–L3: repeaters/hubs (L1), bridges/switches (L2), routers/gateways (L3).


📦 Transport Layer (L4)

Process-to-process delivery — TCP/UDP family.

🖥️ Application Layer (L5–L7)

Application architectures, the servers that implement them, and application-layer protocols.

🔒 Cross-Layer — Security & Overlay Networks

Attacks, defences, and overlay/legal topics that cut across every layer above.


📜 Past-Paper Coverage — Networks (2016–2026)

All 41 topic pages end with relevant past-paper questions and structured answers, or a clear “no direct question located” note. The table maps the core Paper-II networking questions checked in the linked examination copies; selected related Paper-I and web/security/image-transmission questions are labelled separately on their topic pages.

How to use the answers: 1–2 marks → direct result plus reason; 3–4 marks → compact explanation/table; 5–8 marks → organised mechanisms/comparison/example; numerical → given values, formula, units, working, result and assumptions; 20 marks → developed analysis, example, limitations and conclusion. These are suggested answer priorities, not an official FPSC marking scheme. Questions are paraphrased and retain paper, year, number and printed marks.

Paper-II year / sourceVerified core questions and marksAnswer pages
2016 paperQ2(a–c): topology links (6), impairments (7), switching (7)Network Topologies · Transmission Media (2016) · Switching
2017 paperQ3(a–c): four protocols (8), transmission time (6), subnet (6); Q5(b): Ethernet (6)Connectionless Transport with UDP (2017) · Physical Layer Functionalities · Network Layer · LAN Technologies
2018 paperQ3(A–C): devices (8), NAT (6), transport multiplexing (6)Network Devices · Network Address Translation (NAT) · Multiplexing In UDP and TCP
2019 paperQ3(a–c): IPv4/6 (8), routing (6), CRC (6); Q5(a–c): multiplexing (8), ARP (6), voice switching (6)IPv6 · Internet Routing Protocols and Algorithms · Error Detection & Control · Multiplexing In UDP and TCP · ARP (Address Resolution Protocol) · Switching
2020 paperQ4(a–b): headers + NAT (8), subnetting (6); Q5(a–c): encoding (8), ARP/RARP (5), transport multiplexing (7)IPv6 · Network Layer · Physical Layer Functionalities · ARP (Address Resolution Protocol) · Multiplexing In UDP and TCP
2021 paperQ5(a–c): wireless TCP/UDP (6), misdelivery (6), window size (8)Connectionless Transport with UDP (2017) · Reliable Data Transfer and TCP
2022 paperQ5(a–c): routing (8), campus design (6), SYN flood/backlog (6)Internet Routing Protocols and Algorithms · LAN Technologies · Reliable Data Transfer and TCP
2023 paperQ3(a–c): router delay (7), fragmentation/source route (7), service choices (6); Q5(b): Class B count (5)Network Devices · Network Layer · Transport Layer
2024 paperQ4(a–c): OSI/TCP-IP (7), overlays/CDNs (7), subnet analogy (6)OSI Model · Content Distribution Networks · Network Layer
2025 paperQ3(a)(i–iv): DNS (2), Internet diagram (3), queue delay (3), TCP choice (2); Q3(b)(i–ii): conditional GET (4), cache delay (6)DNS (Domain Name System) · Overview of Networking · Network Devices · FTP (File Transfer Protocol) · HTTP (HyperText Transfer Protocol)
2026 paperQ4: TCP/UDP congestion and network stability (20)Congestion Avoidance

Related additions: 2023 Q7(a) image-transmission calculation is in Physical Layer; three-tier architecture questions (2018, 2022, 2025) are in Application Architectures; website encryption (2021, 2025) is in Security Overlays. Relevant Paper-I ports, transport, cybercrime/privacy and digital-IP questions are identified where used.

Objective-paper limit: available Paper-II sheets for 2024–2026 were checked for relevant networking/security MCQs. The reviewed copies for 2016–2023 do not establish complete MCQ coverage; no claim is made that all historical MCQs or papers before 2016 are covered. Ambiguous MCQs are labelled as reasoned answers rather than official keys.

Corrections: the old “2016 attack types” label and “2017 application architectures” attribution were not supported by those exam papers. The 2017 intellectual-property question means the digital domain broadly, not only Internet domain names.


✅ Self-Test Questions (Practice, with Answers)

Q1. List the 7 OSI layers in order and map them to the 4 TCP/IP layers.

Ans: OSI (bottom-up): Physical → Data Link → Network → Transport → Session → Presentation → Application (mnemonic: Please Do Not Throw Sausage Pizza Away). Mapping:

OSI layerTCP/IP layerExamples
Application, Presentation, Session (5–7)ApplicationHTTP, FTP, SMTP, DNS, SSL/TLS
Transport (4)TransportTCP, UDP
Network (3)InternetIP, ICMP; routing functions (ARP operates at the link/Internet boundary)
Data Link, Physical (1–2)Network Access / LinkEthernet, Wi-Fi, PPP

Data units: bits (L1), frames (L2), packets (L3), segments/datagrams (L4), data (L5–7).

Q2. Compare TCP and UDP by reliability, overhead, and typical use case.

Ans:

FeatureTCPUDP
ConnectionConnection-oriented (three-way handshake)Connectionless
ReliabilityAcknowledgements, retransmission, sequencing, in-order deliveryBest effort — no acknowledgement or retransmission
Flow / congestion controlYes (sliding window, AIMD)None
Header overhead20 bytes minimum8 bytes
DelayRecovery and ordering can add delayNo built-in recovery delay; actual delay depends on network/application
Use casesWeb (HTTP), email, file transfer, remote login — anything needing accuracyVoIP, video streaming, online gaming, DNS, DHCP, SNMP — anything preferring speed over perfection

Q3. What is the difference between circuit switching and packet switching?

Ans: Circuit switching sets up a dedicated end-to-end circuit with reserved capacity before any data flows (setup → transfer → teardown). Bandwidth is reserved, delay is fixed and low with no reordering — ideal for continuous voice — but capacity is wasted when idle, setup takes time, and a failed link breaks the call. Example: the traditional telephone network. Packet switching breaks data into packets routed independently (datagram) or along a pre-established logical path (virtual circuit). It shares links statistically, so utilisation is high and it is robust to failures, but it introduces variable delay (jitter), possible reordering and congestion loss. Example: the Internet (IP). For real-time voice over packet networks, QoS mechanisms compensate for jitter.

Q4. Distinguish a hub, a switch, and a router by the OSI layer at which each operates.

Ans: A hub works at the physical layer (L1): it repeats an incoming signal to all other ports, so all devices share one collision domain and one broadcast domain — it is "dumb" and now obsolete. A switch works at the data link layer (L2): it learns MAC addresses into a table and forwards known-unicast frames to the learned destination port and floods broadcasts/unknown unicasts within the VLAN, giving each port its own collision domain (all ports still share a broadcast domain unless VLANs are used). A router works at the network layer (L3): it forwards packets between different networks using IP addresses and a routing table, separates broadcast domains, and performs functions such as NAT and filtering.

Q5. Explain TCP's three-way handshake and its congestion control phases.

Ans: Handshake: (1) the client sends SYN with its initial sequence number; (2) the server replies SYN+ACK, acknowledging the client's ISN and sending its own; (3) the client sends ACK. The connection is then established, with both sides' sequence numbers and window sizes synchronised. (Closing uses a four-way FIN/ACK exchange.)

Congestion control phases: (a) Slow start — cwnd begins at a standard/implementation-dependent initial window and grows roughly exponentially per RTT until it reaches the threshold (ssthresh); (b) Congestion avoidance — above ssthresh cwnd grows by about 1 MSS per RTT (linear, additive increase); (c) Fast retransmit — three duplicate ACKs trigger immediate retransmission without waiting for a timeout; (d) Fast recovery — cwnd is halved (multiplicative decrease) and avoidance resumes (TCP Reno); on a timeout, ssthresh becomes half of cwnd and cwnd resets to 1, restarting slow start. The overall behaviour is called AIMD.

Q6. Why was IPv6 introduced, and how does NAT relate to that problem?

Ans: IPv6 was introduced mainly because IPv4's 32-bit address space (about 4.3 billion addresses) was exhausted by the growth of the Internet and mobile/IoT devices; IPv6 uses 128 bits (about 3.4 × 10³⁸ addresses) and also brings simplified fixed headers, support for IPsec (not automatic encryption), stateless autoconfiguration, better multicast and no need for fragmentation by routers. NAT was a stop-gap for the same problem: it lets a whole private network (10.x, 172.16.x, 192.168.x) share one or a few public addresses by rewriting addresses and ports. NAT extended IPv4's life by years — which is partly why IPv6 adoption has been slow — but it breaks end-to-end connectivity, complicates peer-to-peer applications, VoIP and IPsec, and adds state and processing at the gateway.

Q7. Compare Stop-and-Wait, Go-Back-N, and Selective Repeat ARQ.

Ans:

FeatureStop-and-WaitGo-Back-NSelective Repeat
Sender window1NN
Receiver window11 (discards out-of-order frames)N (buffers out-of-order frames)
On errorRetransmit that frameRetransmit the lost frame and all after itRetransmit only the lost frame
AcknowledgementsIndividualCumulativeIndividual (selective)
EfficiencyVery low on long/fast linksGood, wasteful after an errorBest bandwidth use
Complexity / buffersSimplestModerateMost complex; needs receiver buffering and sorting
Max window (m-bit seq. no.)12^m − 12^(m−1)

Efficiency of Stop-and-Wait = 1/(1+2a) where a = propagation time / transmission time; sliding-window protocols raise this to N/(1+2a) while N ≤ 1+2a.

Q8. Explain a CDN and why local caching matters for a country's bandwidth costs.

Ans: A Content Delivery Network is a geographically distributed set of edge servers that cache copies of content (video, images, scripts, software updates) close to users; DNS or anycast steers each request to the nearest healthy edge, which serves the cached object and only contacts the origin on a miss. Benefits: lower latency and faster page loads, less load on the origin, resilience to traffic spikes and some DDoS absorption.

Why local caching matters for a country such as Pakistan: without local caches, every view of a popular video crosses expensive international transit links (submarine cables), so the same bytes are paid for repeatedly in foreign exchange. Local caches and Internet Exchange Points keep that traffic domestic — cutting international bandwidth bills, improving speed, and keeping content available if a submarine cable is cut. This is why operators host Google Global Cache, Akamai, Facebook and Netflix appliances locally.


🗂️ Original Subpages & Archive

The category links above open these same pages. They are retained here as the chapter's original subpages.

Continue studying