0% found this document useful (0 votes)
181 views

Solution-Final Version Exam Question Paper CN Fall-2024-1

Uploaded by

werelywerelyu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views

Solution-Final Version Exam Question Paper CN Fall-2024-1

Uploaded by

werelywerelyu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

National University of Computer and Emerging Sciences

Islamabad Campus

Computer Networks (CS3001) Final Examination


Course Instructor(s): Total Time (Hrs): 3
Dr. Danish Shehzad, Dr. Ali Zeeshan, Dr. Fehmida Total Marks: 100
Usmani, Ms. Sana Razzaq
Section(s): CS All Sections
Total Questions: 11

Date: Dec 28, 2024

___________ ___________ _____________________


Roll No Course Section Student Signature
Do not write below this line.
Attempt all the questions.

Section I: Transport Layer [30 Marks]


Q 1: Short Questions [15 marks]
a. If the RTT from Lahore to Islamabad is 120ms and all links in the network have a 155
Mbits/second data-rate, how much data can fit in the “pipe” (data in transit)? Express your
answer in bytes.(2 marks)

Solution:
To calculate the amount of data that can fit in the "pipe" (also referred to as the bandwidth-delay
product), use the formula:
Data in transit=Bandwidth×RTT

Given Values:
Bandwidth = 155 Mbits/sec
=155×106 bits/sec
RTT = 120 ms=0.120 seconds
Step 1: Calculate data in transit (in bits):
Data in transit=155×106×0.120=18.6×106 bits
Step 2: Convert to bytes:
Data in transit=18.6×106 /8=2.325×106 bytes
Final Answer:
The amount of data that can fit in the pipe is 2,325,000 bytes.

b. In a connection, the value of cwnd is 3000 and the value of rwnd is 5000. The host has sent
2000 bytes, which have not been acknowledged. How many more bytes can be sent? (2
marks)

Given:
Congestion window size ( cwnd) = 3000 bytes
Receiver window size (rwnd) = 5000 bytes
Unacknowledged bytes = 2000 bytes

Final Exam, Fall 2024 FAST School of Computing Page 1 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

Step 1: Calculate the effective window size:


Effective window size = min(cwnd,rwnd)-Unacknowledged bytes
Effective window size = min(3000,5000)−2000 =1000 bytes

Final Answer:
The host can send 1000 more bytes.

c. Client uses UDP to send data to a server. The data length is 16 bytes. Calculate the efficiency of
this transmission at the UDP level (ratio of useful bytes to total bytes). (2 marks)

Given:
• Data length (payload) = 16 bytes
• UDP header size = 8 bytes
• Total size = Data length+UDP header size
• Total size=16+8=24 bytes
Efficiency Formula:
Efficiency=Useful data (payload) / Total size×100
Calculation:
Efficiency=(16/24) ×100=66.67%
Final Answer:
The efficiency of the UDP transmission is 66.67%.

d. In a TCP connection, the window size fluctuates between 60,000 bytes and 30,000 bytes. If the
average RTT is 30 ms, what is the throughput of the connection? (2 marks)

Solution:
Throughput = Average window size / RTT
Average window size = 60,000+30,000/2=45,000 bytes
RTT = 30 ms=0.030 seconds
Calculation:
Throughput=45,000 bytes / 0.030 seconds=1,500,000 bytes/sec

Final Answer:
Throughput=1.5MB/sec

Final Exam, Fall 2024 FAST School of Computing Page 2 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

e. A client residing on a host with IP address 122.45.12.7 sends a message to the corresponding
server residing on a host with IP address 200.112.45.90. If the well-known port is 161 and the
ephemeral port is 51000, what are the pair of socket addresses used in this communication?
(2 marks)

Answer:

The pair of socket addresses used in this communication is:

(122.45.12.7, 51000) and (200.112.45.90, 161)

f. What are the four aspects related to the reliable delivery of data? (2 marks)
The four aspects are:
1. Error Detection and Correction
2. Flow Control
3. Acknowledgment and Retransmission
4. Sequencing

g. An HTTP client opens a TCP connection using an initial sequence number (ISN) of 14,534 and
the ephemeral port number of 59,100. The server opens the connection with an ISN of 21,732.
Show the three TCP segments during the connection establishment if the client defines the
rwnd of 4000 and the server defines the rwnd of 5000. Ignore the calculation of the checksum
field. (3 marks)

Summary of the Three-Way Handshake:


1. Client → Server: SYN, Seq = 14,534, Ack = -, rwnd = 4000
2. Server → Client: SYN-ACK, Seq = 21,732, Ack = 14,535, rwnd = 5000
3. Client → Server: ACK, Seq = 14,535, Ack = 21,733, rwnd = 4000

Q2: [15 marks]


Consider the following scenario that connects the host computers A and C with a store and forward
switch B. The propagation delays from A TO B is 1ms from B to C is 5ms and bandwidths between A
TO B is 10Mb/s and between B and C is 1.5Mb/s of the respective links are given in the Figure.

a. Assume A wants to send a frame to C. If the frame size is 6000 bits, how long does it take to
deliver the entire frame at the switch B? (5 points)
b. How long does it take to deliver the entire frame from host A to host C? (5 marks)

Final Exam, Fall 2024 FAST School of Computing Page 3 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

c. Suppose A continuously sends frames to C (one after the other/back to back/without giving a
break). However, host B can store at most 10 packets. At what time will B start to drop packets?
What will be the packet dropping rate in terms of packets/sec? (5 marks)

Solution:
(a) Time to deliver the entire frame at switch B
To determine how long it takes for the frame to be delivered to switch B, we need to calculate the
transmission delay from A to B and add the propagation delay from A to B.
1. Transmission Delay (A to B):
Transmission Delay=Frame Size/Bandwidth from A to B
Transmission Delay=6000/107=0.0006 s=0.6 ms

2. Total Time to Deliver to B:


Total Time=Transmission Delay+Propagation Delay
Total Time=0.0006+0.001=0.0016 s=1.6 ms

(b) Time to deliver the entire frame from host A to host C


To calculate the total time for the frame to travel from A to C:
1. The frame must first reach B (computed in part (a)).
2. Once the frame is completely at B, it will be transmitted to C. The total time from B to C
includes:
Transmission Delay (B to C): Transmission Delay=Frame Size/Bandwidth from B to C
Transmission Delay=6000/(1.5×106)=0.004 s=4 ms
Propagation Delay (B to C): 0.005 s=5 ms
Total Time (B to C)=0.004+0.005=0.009 s=9 ms

Total Time from A to C:


Total Time (A to C)=Time (A to B)+Time (B to C)
Total Time (A to C)=0.0016+0.009=0.0106 s=10.6 ms

Final Exam, Fall 2024 FAST School of Computing Page 4 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

C.

Final Answers

Final Answers:
(a): 1.6 ms
(b): 10.6 ms
(c):
o B starts to drop packets at 7.06 ms
o Packet dropping rate: 1416.67 packets/sec

Final Exam, Fall 2024 FAST School of Computing Page 5 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

Section II: Network Layer (Data Plane) [20 Marks]


Q 3: Subnetting [10 Marks]
Consider the router and the three attached subnets below (A, B, and C). The number of hosts is also
shown below. The subnets share the 23 high-order bits of the address space: 172.20.36.0/23. Assign
subnet addresses to each of the subnets (A, B, and C) so that the amount of address space assigned is
minimal, and at the same time leaving the largest possible contiguous address space available for
assignment if a new subnet were to be added. Then answer the questions below.

a. Is the address space public or private? (0.5 mark)


b. How many hosts can there be in this address space? (0.5 mark)
c. What are the subnet addresses of subnet A, B and C? (CIDR notation) (3 marks)
d. What are the broadcast addresses of subnet A, B and C? (3 marks)
e. What are the starting and ending addresses of subnet A, B and C? (3 marks)
Solution:
a) The address space 172.20.36.0/23 belongs to the private IP range 172.16.0.0 –
172.31.255.255.

b) A /23 network provides 232−23=29=512 total IP addresses. Subtracting 2 for the network
and broadcast addresses, we have 510 usable IPs.
c) We need to allocate IP addresses to each subnet while minimizing waste.
Subnet A: Requires 60 hosts. The nearest power of 2 is 26=64. Therefore, Subnet A requires a
/26 network.
Subnet B: Requires 115 hosts. The nearest power of 2 is 27=128. Therefore, Subnet B requires
a /25 network.
Subnet C: Requires 27 hosts. The nearest power of 2 is 25=32. Therefore, Subnet C requires a
/27 network.
Subnet A: 172.20.36.0/26 (64 addresses)
Subnet B: 172.20.36.64/25 (128 addresses)
Subnet C: 172.20.36.192/27 (32 addresses)
d) Subnet A: Broadcast address is 172.20.36.63
Subnet B: Broadcast address is 172.20.36.191

Final Exam, Fall 2024 FAST School of Computing Page 6 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

Subnet C: Broadcast address is 172.20.36.223


e) Subnet A: Starting address: 172.20.36.1, Ending address: 172.20.36.62.
Subnet B: Starting address: 172.20.36.65, Ending address: 172.20.36.190.
Subnet C: Starting address: 172.20.36.193, Ending address: 172.20.36.222.

Q 4: Packet Scheduling [5 Marks]


Consider the arrival of 10 packets to an output link at a router in the interval of time [0, 5], as indicated
by the figure below. We’ll consider time to be “slotted”, with a slot beginning at t = 0, 1, 2, 3, etc.
Packets can arrive at any time during a slot, and multiple packets can arrive during a slot. At the
beginning of each time slot, the packet scheduler will choose one packet, among those queued (if
any), for transmission according to the packet scheduling discipline (that you will select below). Each
packet requires exactly one slot time to transmit, and so a packet selected for transmission at time t,
will complete its transmission at t+1, at which time another packet will be selected for transmission,
among those queued.

Consider a Weighted Fair Queuing (WFQ) packet scheduling mechanism with three classes of traffic
(1, 2, 3), with lower class numbers having higher priority. The scheduling weights are 0.5, 0.3, and 0.2
for classes 1, 2, and 3, respectively.
For the given times from t=1 to t=10:
Show the steps to determine which packet is selected for each time interval based on the WFQ
mechanism and specify the packet number on the departure line for each time interval or write 'n/a'
if no packet is sent.
Solution:

Final Exam, Fall 2024 FAST School of Computing Page 7 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

1 mark is for showing working steps.


Q 5: Network Address Translation (NAT) [5 Marks]
Consider the scenario below in which three hosts, with private IP addresses 10.0.1.10, 10.0.1.17,
10.0.1.18 are in a local network behind a NAT'd router that sits between these three hosts and the
larger Internet. IP datagrams being sent from, or destined to, these three hosts must pass through this
NAT router. The router’s interface on the LAN side has IP address 10.0.1.26, while the router’s address
on the Internet side has IP address 135.122.196.214. Suppose that the host with IP address 10.0.1.17
sends an IP datagram destined to host 128.119.161.188. The source port is 3453, and the destination
port is 80.

a. Consider the datagram at step 1, after it has been sent by the host but before it has reached
the router. What is the source and destination IP address for this datagram?

Final Exam, Fall 2024 FAST School of Computing Page 8 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

b. Now consider the datagram at step 2, after it has been transmitted by the router. What is the
source and destination IP address for this datagram?
c. At step 2, Will the source port have changed?
d. Now consider the datagram at step 3, just before it is received by the router. What is the source
and destination IP address for this datagram?
e. At step 4, after it has been transmitted by the router but before it has been received by the
host. What is the source and destination IP address for this datagram?
Solution:
a. The source address will be the local host's IP, which is 10.0.1.17and the destination address will
be the remote machine's IP, which is 128.119.161.188
b. The source address will be the router's public IP, which is 135.122.196.214 and destination
address will be remote machine’s IP 128.119.161.188
c. Yes, the NAT will change the source port.
d. The source address will be the remote machine's IP, which is 128.119.161.188 and the destination
address will be the router's public IP, which is 135.122.196.214
e. The source address will be the remote machine's IP, which is 128.119.161.188 and the destination
address will be the local host's IP, which is 10.0.1.17.

Section III: Network Layer (Control Plane) [30 Marks]


Q 6: Short Questions [13 Marks]
a. Given a network with multiple gateways, analyze how hot potato routing might impact the load
on an intra-AS network compared to the inter-AS costs. (2 marks)
Hot potato routing reduces the load on intra-AS resources at the cost of potentially higher inter-AS costs
and suboptimal routing paths. This trade-off is especially significant in networks with multiple gateways
where balancing intra-AS load and inter-AS cost is critical.

b. Consider a scenario where an AS wants to avoid routing traffic through a specific neighboring
AS due to security concerns. How can the AS enforce this policy using BGP attributes? (1 mark)
The AS can enforce this policy by configuring BGP import policies to reject route advertisements
containing the specific neighboring AS in the AS-PATH attribute, effectively avoiding routes through that
AS.

c. If an ICMP message with type 3 and code 1 is received at the source, what does it signify, and
how should the source respond? (1 mark)
An ICMP message with type 3, code 1 indicates that the destination host is unreachable.

d. Compute updated forwarding table of b by looking at its neighbors. Use Bellman ford equation
to do so. (3 marks)

Final Exam, Fall 2024 FAST School of Computing Page 9 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

e. In a Distance Vector routing scenario, what happens when a router detects an increase in a link
cost? Illustrate the "count-to-infinity" problem with an example. (1 mark)
When a link cost increases, routers update distances and propagate them. In the "count-to-infinity"
problem, routers repeatedly exchange increasing path costs, causing delays in convergence. Example:
A → B (1), B → C (1). If B→C breaks, A and B loop updates indefinitely.

f. How do OpenFlow controller-to-switch and switch-to-controller messages facilitate SDN


operation and network programmability? (1 mark)
OpenFlow controller-to-switch messages configure switches by managing flow tables, while switch-to-
controller messages report events or forward packets for decision-making. Together, they enable
dynamic SDN control and programmability.

g. Describe how a logically centralized control plane in SDN provides enhanced flexibility and
avoids misconfigurations compared to traditional per-router control. (2 marks)
A logically centralized SDN control plane provides a global network view, enabling optimized routing
and traffic engineering. It avoids misconfigurations by centralizing control logic, eliminating
inconsistencies from distributed configurations in traditional per-router control.

Final Exam, Fall 2024 FAST School of Computing Page 10 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

h. Explain the role of AS-PATH and NEXT-HOP attributes in BGP route advertisement and selection.
(2 marks)
The AS-PATH attribute lists ASs traversed by a route, helping prevent loops and influencing route
selection based on path length. The NEXT-HOP attribute identifies the next router for forwarding traffic,
ensuring accurate routing within and between ASs.

Q 7: [7 Marks]
Consider a network with three autonomous systems (AS1, AS2, AS3). Each AS uses OSPF for intra-
domain routing and BGP for inter-domain routing.
a. Draw a topology where AS1 is connected to both AS2 and AS3. Assume AS1 prefers routing
through AS2 unless AS2's path becomes unavailable. (3 marks)

b. Describe the updates and route advertisements exchanged using eBGP and iBGP when a link
in AS2 fails. (2 marks)

Updates and Route Advertisements in BGP:

1. Before Failure:
o eBGP: AS2 advertises routes to AS1; AS3 advertises its routes to AS1. AS1 selects the
path via AS2 based on preferences.
o iBGP: Within AS1, R1 shares the preferred path (via AS2) with other AS1 routers.
2. After Failure in AS2:
o eBGP: AS2 stops advertising its routes. AS1 detects the failure and switches to the route
advertised by AS3.
o iBGP: R1 updates all other AS1 routers to use the backup path via AS3.

c. Analyze how SDN could simplify or optimize this process using its centralized control plane. (2
marks)

Final Exam, Fall 2024 FAST School of Computing Page 11 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

1. Global View:
SDN's centralized control plane provides a global view of network state, detecting AS2's
link failure instantly.
2. Dynamic Rerouting:
SDN dynamically updates routing tables in AS1 to use AS3 without relying on BGP's
convergence time.
3. Policy Optimization:
SDN can enforce routing preferences directly using traffic engineering policies, eliminating
dependency on distributed BGP updates.

Q 8: [10 Marks]
Consider the following network. With the indicated link costs, use Dijkstra's shortest-path algorithm
to compute the shortest path from A to all network nodes.
Consider the following network. With the indicated link costs, use Dijkstra's shortest-path algorithm
to compute the shortest path from A to all network nodes.
a. Show how the algorithm works, show all necessary steps in the form of table. [marks 5]

b. Draw the resulting shortest-path tree from A to all other nodes. [marks 3]

Final Exam, Fall 2024 FAST School of Computing Page 12 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

c. Provide the resulting forwarding table in A. [marks 2]

NOTE
Please note that you derive (b) and (c) from (a). If (a) is not correct then (b) and (c) will be
automatically considered incorrect.

Final Exam, Fall 2024 FAST School of Computing Page 13 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

Section IV: Data Link Layer [20 Marks]


Q 9: [10 Marks]
A. . How does slotted ALOHA mitigate the drawbacks of pure ALOHA while still being considered a
random access protocol? [2 Marks]

Answer: Both are random access for shared channels, but pure ALOHA allows transmissions at any
point, leading to high collision probability and low efficiency (max 18.4%). Slotted ALOHA
synchronizes transmissions to fixed time slots, reducing collisions to a maximum of 36.8% by
limiting potential overlap. This improves channel utilization despite still being random in nature.

B. Explain how carrier sensing and collision detection in CSMA/CD enhances efficiency. [2 Marks]

Answer: Carrier sensing (CS) allows a node to listen before transmitting; if the channel is busy, it
waits. Collision Detection (CD) continuously monitors during transmission to detect overlapping
signals. If a collision occurs, both nodes stop, use backoff algorithms, and retransmit later. CS
prevents unnecessary transmissions on occupied channels, while CD stops collisions early instead
of wasting entire packets as in pure CSMA.

C. Why is an ARP query broadcast while its response is unicast? [2 Marks]

Answer: ARP maps IP addresses to MAC addresses. A query seeks the MAC for a specific IP, so
it's broadcast to reach all nodes on the subnet potentially holding that address. The response,
knowing the recipient's MAC from the query, is unicast to that specific node.

D. Describe how the token in a Token Ring network ensures fair access to the shared channel while
preventing collisions. [2 Marks]

Answer: In Token Ring, a single "token" circulates around the ring. A node can transmit only when
it possesses this token. This serialized access ensures that nodes take turns transmitting, effectively
preventing simultaneous transmissions (collisions). When a node transmits, it regenerates a new
token after sending its frame, passing it along to the next node in line for its turn.

E. Explain how "backoff" in the context of CSMA/CD helps mitigate network collisions. [2 Marks]

Answer: Backoff is an exponential algorithm used by Ethernet stations after detecting a collision. It
involves waiting for a random amount of time (increasing exponentially with each successive
collision) before attempting to retransmit data. This randomized delay spreads out transmissions,
reducing the likelihood of another simultaneous transmission and causing further collisions.

Q 10: [5 Marks]
Suppose that a packet’s payload consists of 10 eight-bit values (e.g., representing ten ASCII-encoded
characters) shown below. (Here, we have arranged the ten eight-bit values as five sixteen-bit values):
Figure 1:
01110101 00010100
00111110 11011000
00101000 00001110
01011000 00001010
11010110 00110100

Figure 2:

Final Exam, Fall 2024 FAST School of Computing Page 14 of 15


National University of Computer and Emerging Sciences
Islamabad Campus

Both the payload and parity bits are shown. One of these bits is flipped.
00010101 10001010 0
00000000 11101101 0
00100100 00000000 0
11101110 00011101 0
01000110 01011011 0
00011001 00100001 0

Figure 3:
Both the payload and parity bits are shown; Either one or two of the bits have been flipped.
11011110 11111110 1
01101110 11001000 1
10110000 00101100 0
10001001 10000000 0
01011111 10000010 0
11010010 00011000 0
Using the above figures, answer the following questions:
a. For figure 1, compute the two-dimensional parity bits for the 16 columns. Combine the bits into
one string. [2 Marks].
1110110111111100
b. For figure 1, compute the two-dimensional parity bits for the 5 rows (starting from the top).
Combine the bits into one string. [2 Marks]
11110
c. For figure 1, compute the parity bit for the parity bit row from question 1. Assume that the result
should be even. [2 Marks]
0
d. For figure 2, indicate the row and column with the flipped bit (format as: x,y), assuming the top-left
bit is 0,0. [2 Marks]
0,5
e. For figure 3, is it possible to detect and correct the bit flips? Yes or No. [2 Marks]
Yes

Q 11: [5 Marks]
Suppose that the 4-bit generator (G) is 1001 and that r = 3. What are the CRC bits (R) associated with
the data payload D when D is:
a. 10011111 (2.5 marks)
110

b. 10011101 (2.5 marks)


100

Final Exam, Fall 2024 FAST School of Computing Page 15 of 15

You might also like