CCN/DCN, Past Papers, University of the Punjab

Computer Networks Past Paper Spring 2025 – BS 6th Semester Punjab University (CC-313)

Semester6th
Year2025
Course codeCC-313
AnswersSolved ✓

University of the Punjab BS 4-year programme, sixth semester Spring 2025, Computer Networks (CC-313) paper (60 marks, 3 hours). The question paper is the official University of the Punjab paper published on pu.edu.pk (BS 4-year programme past papers, Spring 2025); it is retyped here and the answers are written by Shining Study. Worked solutions checked in Python: delays, protocols, internet checksum (0001), error detection, IP classes and subnet mask, GBN/SR window sizes, Hamming code for 1010001100, stop-and-wait/SR/GBN transmissions (29, 29, 70) and /22 → /27 subnetting.

Solved answers

Q1 – Short questions (6 × 5)

1. Transmission vs propagation delay.

Transmission delayPropagation delay
Time to push all bits of a packet onto the linkTime for one bit to travel from sender to receiver over the medium
= packet length L / bandwidth R= distance d / propagation speed s (≈ 2 × 10⁸ m/s in cable)
Depends on packet size and data rateDepends on distance and medium, not on packet size
e.g. 1000 bytes at 1 Mbps = 8 mse.g. 2000 km / 2×10⁸ = 10 ms

2. Need for protocols. A protocol is a set of rules that devices follow to communicate. Different hardware and software from different vendors can talk only if they agree on syntax (format of data), semantics (meaning of each field/action) and timing (when and how fast). Protocols provide addressing (IP), reliable delivery and error control (TCP), flow and congestion control, routing, security (TLS) and standard services (HTTP, SMTP, DNS). Without them data would be misunderstood, lost or collide.

3. Internet checksum of 10110011, k = 2, m = 4. Divide the data into k = 2 segments of m = 4 bits: 1011 and 0011.
Sum (1’s complement arithmetic): 1011 + 0011 = 1110 (no carry out).
Checksum = 1’s complement of the sum = 0001. Sent data: 1011 0011 0001.
Receiver check: 1011 + 0011 + 0001 = 1111 → complement = 0000, so no error detected.

4. Checking that a packet arrived unchanged. Use error-detection codes: the sender adds redundant bits computed from the data – parity bits, an internet checksum (IP/TCP/UDP headers), or a CRC (Ethernet frames, FCS). The receiver recomputes them; if they do not match, the packet is corrupted and discarded or retransmitted (ARQ). For protection against deliberate changes, a cryptographic hash/HMAC or digital signature is used (integrity checks in TLS/IPsec).

5. IP classes, subnet mask.

ClassFirst octetDefault maskRange (excluding broadcast)
A1–126 (0 xxxxxxx)255.0.0.0 (/8)1.0.0.0 – 126.255.255.254
B128–191 (10 xxxxxx)255.255.0.0 (/16)128.0.0.0 – 191.255.255.254
C192–223 (110 xxxxx)255.255.255.0 (/24)192.0.0.0 – 223.255.255.254
D224–239–Multicast
E240–255–Reserved/experimental
(127.x.x.x is loopback.) The subnet mask separates the network/subnet part of an address from the host part, so a device can decide whether a destination is on its own network (deliver directly) or must be sent to the router, and so one large network can be divided into smaller subnets. Without a mask, hosts cannot identify their network, routing tables cannot summarise networks, broadcasts would flood huge networks, addresses would be wasted and security/traffic control between departments would be lost.

6. Window sizes with a 4-bit sequence number. Sequence numbers 0–15 (2⁴ = 16).
a) Go-Back-N ARQ: send window = 2ᵐ − 1 = 15, receive window = 1.
b) Selective Repeat ARQ: send window = receive window = 2ᵐ⁻¹ = 8.

Q2 (1) – Hamming code for 1010001100

Data bits m = 10. Number of parity bits r must satisfy 2ʳ ≥ m + r + 1 → r = 4 (16 ≥ 15). Code length = 14 bits, parity bits at positions 1, 2, 4, 8 (even parity); data bits placed in order (left to right) in positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14.

Position1234567891011121314
TypeP1P2DP4DDDP8DDDDDD
Bit01100100001100
  • P1 checks 1,3,5,7,9,11,13: data bits 1,0,0,0,1,0 → 2 ones → P1 = 0
  • P2 checks 2,3,6,7,10,11,14: 1,1,0,0,1,0 → 3 ones → P2 = 1
  • P4 checks 4,5,6,7,12,13,14: 0,1,0,1,0,0 → 2 ones → P4 = 0
  • P8 checks 8–14: 0,0,1,1,0,0 → 2 ones → P8 = 0

Transmitted code word: 0 1 1 0 0 1 0 0 0 0 1 1 0 0. At the receiver the four checks are recomputed; the binary number formed by the failed checks (P8 P4 P2 P1) gives the position of a single-bit error, which is then flipped to correct it (e.g. failures at P1 and P4 → 0101 = position 5).

Q2 (2) – Total transmissions (20 packets, every 3rd transmission lost)

Assumptions (the usual textbook reading): every 3rd packet transmitted is lost (counting retransmissions too), ACKs are never lost, and in Go-Back-N the window is 4 (the sender times out after sending 4 packets).

(i) Stop and Wait: only the lost packet is resent. If T packets are sent, ⌊T/3⌋ are lost and T − ⌊T/3⌋ must equal 20 → T = 29 (9 lost + 20 delivered; the 29th transmission is not a multiple of 3).

(ii) Selective Repeat: also resends only the lost packets, so again 29 transmissions.

(iii) Go-Back-N (window 4): when a packet is lost, it and every packet after it in the window are resent. Rounds (✗ = lost):

1 2 3x 4 | 3 4x 5 6 | 4x 5 6 7x | 4 5 6x 7 | 6 7x 8 9 | 7x 8 9 10x | 7 8 9x 10
9 10x 11 12 | 10x 11 12 13x | 10 11 12x 13 | 12 13x 14 15 | 13x 14 15 16x
13 14 15x 16 | 15 16x 17 18 | 16x 17 18 19x | 16 17 18x 19 | 18 19x 20 | 19 20x | 20

Total = 70 transmissions in 19 rounds. (Simulated in Python. With a different window size or loss rule the number changes, so state your assumptions in the exam.)

Q2 (3) – Subnetting 170.88.128.0/22

  • i) 32 subnets → 2⁵ = 32 → 5 bits for subnet ID (borrowed from the 10 host bits of /22).
  • ii) 32 usable subnets (modern practice with subnet-zero; with the old rule of excluding all-0 and all-1 subnets: 30).
  • iii) New prefix = /22 + 5 = /27 → subnet mask 255.255.255.224. Each subnet has 2⁵ = 32 addresses, i.e. 30 usable hosts (32 hosts cannot all be usable, since network and broadcast addresses are reserved).
  • iv) Subnets: 170.88.128.0/27, 170.88.128.32/27, 170.88.128.64/27 … 170.88.131.224/27. 5th host of the 2nd subnet = 170.88.128.32 + 5 = 170.88.128.37.
  • v) Broadcast of the 2nd subnet = 170.88.128.63 (the whole /22 block’s broadcast is 170.88.131.255).
Save this paper for offline studyDownload the question paper, or save the paper together with all solved answers as a PDF.
↓ Download Paper (JPG)
Have another year of CCN/DCN?

Upload a photo in 10 seconds — no form to fill. We clean it, solve it and credit you.

Missing years for this subject
202620242023

About Saif R

An educator and technology enthusiast passionate about empowering students through quality education and digital learning. Dedicated to making academic resources and opportunities accessible to everyone.