Blog
Internet Architecture and Protocols BSCS 5th Mid Past Paper – UOS Main Campus
University of Sargodha main campus Internet Architecture and Protocols (IAP) mid-term exam for BSCS 5th (R+S), 30 marks, 1.5 hours. Retyped from the original paper (the virtual-circuit figure has been redrawn), with solved answers below.
Solved answers
Q1 – IP addressing (10)
The network figure was too faint in the available copy, so here is the method with a worked plan. The figure has 8 networks (labelled 1–8: department LANs and router-to-router links). To give each network its own network part, borrow 3 bits (2³ = 8 subnets) from the host part of 180.16.0.0/24 → /27 (255.255.255.224), 30 usable hosts per subnet:
| Net | Network address | Usable hosts | Broadcast |
|---|---|---|---|
| 1 | 180.16.0.0/27 | .1 – .30 | .31 |
| 2 | 180.16.0.32/27 | .33 – .62 | .63 |
| 3 | 180.16.0.64/27 | .65 – .94 | .95 |
| 4 | 180.16.0.96/27 | .97 – .126 | .127 |
| 5 | 180.16.0.128/27 | .129 – .158 | .159 |
| 6 | 180.16.0.160/27 | .161 – .190 | .191 |
| 7 | 180.16.0.192/27 | .193 – .222 | .223 |
| 8 | 180.16.0.224/27 | .225 – .254 | .255 |
Give every host and every router interface on the same network an address from that network’s range (e.g. router interface = first usable address, hosts get the next ones). The network part is 27 bits. (If the “default mask” is read strictly as the /24 purchased block without subnetting, all interfaces share 180.16.0.x with a 24-bit network part — but then the routers would have no separate networks, so subnetting is required.)
Q2 – CRC with generator 1101 (8)
a) Degree of generator = 3, so append three 0s: 10011010000. Dividing by 1101 with XOR (modulo-2) long division gives remainder 101. Transmitted message = 10011010101.
b) If the rightmost bit is inverted, the receiver gets 10011010100. Dividing by 1101 gives remainder 001. A non-zero remainder means the frame is corrupted, so the receiver detects the error (a correct frame always gives remainder 000).
Q3 – Virtual circuit tables (8)
Ports: S1 — 1 A, 2 B, 3 S2 · S2 — 1 S1, 2 C, 3 S3 · S3 — 1 S2, 2 D, 3 E. Lowest unused VCI per link, and freed VCIs are reused.
a) A → B:
| Switch | In port | In VCI | Out port | Out VCI |
|---|---|---|---|---|
| S1 | 1 | 0 | 2 | 0 |
b) C → D:
| Switch | In port | In VCI | Out port | Out VCI |
|---|---|---|---|---|
| S2 | 2 | 0 | 3 | 0 |
| S3 | 1 | 0 | 2 | 0 |
c) C → E:
| Switch | In port | In VCI | Out port | Out VCI |
|---|---|---|---|---|
| S2 | 2 | 1 | 3 | 1 |
| S3 | 1 | 1 | 3 | 0 |
d) D → B:
| Switch | In port | In VCI | Out port | Out VCI |
|---|---|---|---|---|
| S3 | 2 | 1 | 1 | 2 |
| S2 | 3 | 2 | 1 | 0 |
| S1 | 3 | 0 | 2 | 1 |
e) C disconnects from D: remove the entries S2 (2,0 → 3,0) and S3 (1,0 → 2,0). VCI 0 becomes free on the C–S2, S2–S3 and S3–D links.
f) A → E: A–S1 uses VCI 0 already → 1; S1–S2 uses 0 → 1; S2–S3 has 0 free again → 0; S3–E uses 0 → 1.
| Switch | In port | In VCI | Out port | Out VCI |
|---|---|---|---|---|
| S1 | 1 | 1 | 3 | 1 |
| S2 | 1 | 1 | 3 | 0 |
| S3 | 1 | 0 | 3 | 1 |
Complete final tables: S1: (1,0→2,0), (3,0→2,1), (1,1→3,1). S2: (2,1→3,1), (3,2→1,0), (1,1→3,0). S3: (1,1→3,0), (2,1→1,2), (1,0→3,1).
Q4 (a) – IPv4 header (4)
32-bit rows: Version (4) | IHL (4) | Type of Service (8) | Total Length (16) / Identification (16) | Flags (3) | Fragment Offset (13) / TTL (8) | Protocol (8) | Header Checksum (16) / Source IP Address (32) / Destination IP Address (32) / Options + Padding (variable) / Data.
Q4 (b) – Sliding window, SWS = RWS = 3, timeout ≈ 2×RTT
(a) Frame 4 lost: the sender sends 1, 2, 3, gets ACKs and slides; frames 4, 5, 6 are sent, 4 is lost. The receiver buffers 5 and 6 (within RWS) but keeps acknowledging 3 (cumulative ACK). Frame 4’s timer expires after 2×RTT; the sender retransmits 4. The receiver now delivers 4, 5, 6 and sends ACK 6; the window slides to 7–9.
(b) Frames 4–6 lost: nothing arrives, so the receiver sends no new ACK (or repeats ACK 3). The window is full, so the sender waits; timeouts expire for 4, 5 and 6 one after another and all three are retransmitted. When they arrive the receiver sends ACK 6 and the window moves to 7–9. Draw both as sender/receiver timelines with slanted arrows, crosses on lost frames and the timeout intervals marked.
