COMSATS University Islamabad
Department of Computer Science
Mid-Term Examination BS(CS) SPRING-2023
Instructor: Dr. Mariam Akbar, Dr. Sheneela Naz, Dr. Zulfiqar Ali, Dr. Abdul Rehman Salehi
Course Title: CSC340 Data Computer Networks Maximum Marks: 50
Dated: 2023 Time Allowed: 80 Min
Name:__________________________________________ Reg no._______________________________
-----------------------------------------------CLO-1 --------------------------------------------------
(Summarize the fundamental concepts of computer networks)
Q (1) = 15 marks total
Q (1) Part A (marks=1+2+3=6)
The following Figure shows Hosts, routers, and switches; each contains a different set of layers,
reflecting their differences in functionality. Using knowledge of protocol stack, label the figure
and message transformation at different layer throughout the transmission path.
Solution:
Q (1) Part B (marks=3+3=6)
Consider the car-caravan analogy and assume a propagation speed of 100 km/hour.
a. Suppose the caravan travels 175 km, beginning in front of one tollbooth, passing through
a second tollbooth, and finishing just after a third tollbooth. What is the end-to-end
delay?
Given:
Distance traveled (D) = 175 km
Propagation speed (S) = 100 km/hour
Propagation Delay=175 km100 km/hourPropagation Delay=100 km/hour175 k
Propagation Delay=1.75 hours
b. Repeat (a), now assuming that there are eight cars in the caravan instead of ten.
As discussed in part (a), the propagation delay is 1.75 hours.
The number of cars in the caravan doesn't affects this calculation. The end-to-end delay is still the
propagation delay because we are assuming negligible transmission, queuing, and processing delays.
End-to-End Delay=1.75 hours
So, even if there are eight cars instead of ten in the caravan, the end-to-end delay remains 1.75 hours.
Q (1) Part C (marks=3)
Suppose a client cis.poly.edu wants to open www.csmit.edu on his web browser for the first time.
For the given figure, draw the path showing the sequence of DNS queries and replies for both the
recursive and iterative methods. Moreover, explain which query will be more suitable iterative or
recursive. Why?
-----------------------------------------------CLO-2 --------------------------------------------------
(Apply the concepts of computer networks to solve their related problems)
Q (2) = 16 marks total
Q (2) Part B (2+2+3=7)
1. If a channel operates with a bit rate of 4 Kbps and a one-way propagation delay of 20
msec, while employing the stop-and-wait protocol and assuming negligible transmission
time for acknowledgment frames, what is the minimum frame size in bits required to
achieve a channel efficiency of at least 50%.
2. In a Satellite Communication system with an average source-to-destination distance of
15,000 kilometers and a one-way delay of 250 milliseconds, what data rate would be
required for the round-trip delay to be equal to the transmission delay for a 1 KB packet?
Solution-
Given-
Distance = 15,000 Km
Propagation delay (Tp) = 250 milliseconds
Packet size = 1 KB
We need to have-
Round Trip Time = Transmission delay
2 x Propagation delay = Transmission delay
2 x 250 milliseconds = 1 KB / Bandwidth
Bandwidth = 1 KB / 500 milliseconds
Bandwidth = 16000 bps
3. Consider a real-time scenario where you're streaming high-definition video content over a
long-distance network connection. The video content is transmitted at a rate of 10 Mbps,
and it needs to travel over a network link that spans 2,000 kilometers with a propagation
speed of 2 x 10^8 meters per second.
a. Calculate the Time of Propagation
b. Explain the Delay Dependencies
\\\\\\\\\\\\\\
b. Explain the Delay Dependencies
Propagation Delay: This is dependent on the physical length of the link and the propagation
speed of the signal in the medium (e.g., copper wire, fiber optic, wireless). In this scenario, the
propagation delay is the time it takes for a bit to travel from the source to the destination.
Transmission Delay: This is the time it takes to push all the bits of a packet into the link.
Transmission delay depends on the packet's length and the data rate of the link. In this scenario,
transmission delay is not relevant to the calculation, but it is a factor in the overall delay.
Queueing Delay: This occurs when packets are held in a queue due to a busy link. Queueing
delay varies dynamically with the network's state, depending on the router's queue length and the
traffic intensity.
Processing Delay: This is the time routers take to process the packet header, check for bit-level
errors in the packet, and determine the packet's outbound link. Processing delay is typically very
small compared to other delays.
Jitter: This is the variation in packet arrival times and is critical for video content. Jitter can be
caused by queueing delays, processing delays, and variations in propagation delays.
Q (2) Part A (marks-=1+1=2)
Consider the scenario shown below, with four different servers connected to four different clients
over four three-hop paths.
1. What is the maximum achievable end-end throughput (in Mbps) for each of the four client-to-
server pairs, assuming that the middle link is fair-shared?
2. Which link is the bottleneck link for each session?
Solution:
a) Throughput=min(100, 300/4, 60)=min(100, 75,60)= 60mbps
b) Rc
Q (2) Part C (3)
Suppose that the five measured SampleRTT values are 106 ms, 120 ms. Compute the
EstimatedRTT after each of these SampleRTT values is obtained, using a value of α = 0.125 and
assuming that the value of EstimatedRTT was 100 ms just before the first of these five samples
were obtained. Compute also the DevRTT after each sample is obtained, assuming a value of β =
0.25 and assuming the value of DevRTT was 5 ms just before the first of these five samples was
obtained. Last, compute the TCP TimeoutInterval after each of these samples is obtained.
Calculate the EstimatedRTT after obtaining the first sample
RTT=106ms,
EstimatedRTT = α * SampleRTT+(1- α) * EstimatedRTT
EstimatedRTT =0.125 * 106 + (1-0.125) * 100
=0.125* 106 + 0.875 * 100
=13.25 + 87.5
=100.75ms
Calculate the DevRTT after obtaining the first sample RTT:
DevRTT = β * | SampleRTT- EstimatedRTT|+(1- β)* DevRTT
=0.25 * |106-100.75| + (1-0.25) *5
=0.25 *5.25 + 0.75 * 5
=1.3125 + 3.75
=5.0625ms
Calculate the Timeout Interval after obtaining the first sample RTT:
TimeoutInterval = EstimatedRTT +4* DevRTT
= 100.75 + 4 *5.0625
=121ms
Calculate the EstimatedRTT after obtaining the second sample
RTT=120ms,
EstimatedRTT = α * SampleRTT+(1- α) * EstimatedRTT
EstimatedRTT =0.125 * 120 + (1-0.125) * 100.75
=0.125* 120 + 0.875 * 100.75
=15 + 88.15625
=103.15625ms
Calculate the DevRTT after obtaining the second sample RTT:
DevRTT = β * | SampleRTT- EstimatedRTT|+(1- β)* DevRTT
=0.25 * |120-103.15625| + (1-0.25) *5.0625
=0.25 *16.84 + 0.75 * 5.0625
=4.21 + 3.79
=8ms
Calculate the Timeout Interval after obtaining the second sample
RTT:
TimeoutInterval = EstimatedRTT +4* DevRTT
= 103.15 + 4 *8
=135.15ms
Calculate the EstimatedRTT after obtaining the third sample
RTT=140ms:
EstimatedRTT = α * SampleRTT+(1- α) * EstimatedRTT
EstimatedRTT =0.125 * 140 + (1-0.125) * 103.15
=0.125* 140 + 0.875 * 103.15
=17.5 +90.26
=107.75ms
Calculate the DevRTT after obtaining the third sample RTT:
DevRTT = β * | SampleRTT- EstimatedRTT|+(1- β)* DevRTT
=0.25 * |140-107.75| + (1-0.25) *8
=0.25 *32.25 + 0.75 * 8
=8.06 + 6
=14.06ms
Calculate the Timeout Interval after obtaining the third sample RTT:
TimeoutInterval = EstimatedRTT +4* DevRTT
= 107.75 + 4 *14.06
=164ms
Calculate the EstimatedRTT after obtaining the fourth sample
RTT=90ms:
EstimatedRTT = α * SampleRTT+(1- α) * EstimatedRTT
EstimatedRTT =0.125 * 90 + (1-0.125) * 107.75
=0.125* 90 + 0.875 * 107.75
=11.25 +94.28
=105.53ms
Calculate the DevRTT after obtaining the fourth sample RTT:
DevRTT = β * | SampleRTT- EstimatedRTT|+(1- β)* DevRTT
=0.25 * |90-105.53| + (1-0.25) *14.06
=0.25 *15.53 + 0.75 * 14.06
=3.88 + 10.545
=14.42ms
Calculate the Timeout Interval after obtaining the fourth sample
RTT:
TimeoutInterval = EstimatedRTT +4* DevRTT
= 105.53 + 4 *14.42
=163.21ms
Calculate the EstimatedRTT after obtaining the fifth sample
RTT=115ms:
EstimatedRTT = α * SampleRTT+(1- α) * EstimatedRTT
EstimatedRTT =0.125 * 115 + (1-0.125) * 105.53
=0.125* 115 + 0.875 * 105.53
=14.375 +92.34
=106.715ms
Calculate the DevRTT after obtaining the fifth sample RTT:
DevRTT = β * | SampleRTT- EstimatedRTT|+(1- β)* DevRTT
=0.25 * |115-106.715| + (1-0.25) *14.42
=0.25 *8.285 + 0.75 * 14.42
=2.07 + 10.815
=12.885ms
Calculate the Timeout Interval after obtaining the fifth sample RTT:
TimeoutInterval = EstimatedRTT +4* DevRTT
= 106.715 + 4 *12.885
=158.255ms
Q (2) Part D (4)
Assign IP addresses for your new MAN (Metropolitan Area Network), which consists of 8 different
buildings, each building will have 255 workstations. Your administrator tells you to only use as much of
the 164.10.0.0 network as you need. Your administrator will assign the IP addresses to the serial interfaces
using a different network. You will need to determine the following four items for each of the eight
buildings:
(a) Subnet masks
(b) Network addresses
(c) Broadcast address for each subnet
(d) Valid host ranges on each subnet
Solution:
To assign IP addresses for the new MAN, we need to first determine the number of bits required for the
network and host portions of the address. Since each building has 255 workstations, we need at least 8
bits to represent the host portion (2^8 - 2 = 254, where 2 is subtracted for the network and broadcast
addresses). We can allocate the remaining bits to the network portion.
Since we are only allowed to use as much of the 164.10.0.0 network as we need, we can use the Class B
network address 164.10.0.0/16. We can further divide this network into eight subnets, one for each
building, using the following subnet mask:
(a) Subnet masks: 255.255.255.0 (/24)
Each building will have a subnet mask of 255.255.255.0, which allows for 256 IP addresses per subnet,
with 254 usable for hosts.
(b) Network addresses:
Building 1: 164.10.1.0
Building 2: 164.10.2.0
Building 3: 164.10.3.0
Building 4: 164.10.4.0
Building 5: 164.10.5.0
Building 6: 164.10.6.0
Building 7: 164.10.7.0
Building 8: 164.10.8.0
Each building will have a unique network address, obtained by setting the host portion of the address to
0.
(c) Broadcast addresses:
Building 1: 164.10.1.255
Building 2: 164.10.2.255
Building 3: 164.10.3.255
Building 4: 164.10.4.255
Building 5: 164.10.5.255
Building 6: 164.10.6.255
Building 7: 164.10.7.255
Building 8: 164.10.8.255
The broadcast address for each subnet is obtained by setting the host portion of the address to all 1s.
(d) Valid host ranges:
Building 1: 164.10.1.1 to 164.10.1.254
Building 2: 164.10.2.1 to 164.10.2.254
Building 3: 164.10.3.1 to 164.10.3.254
Building 4: 164.10.4.1 to 164.10.4.254
Building 5: 164.10.5.1 to 164.10.5.254
Building 6: 164.10.6.1 to 164.10.6.254
Building 7: 164.10.7.1 to 164.10.7.254
Building 8: 164.10.8.1 to 164.10.8.254
The valid host range for each subnet is obtained by setting the first and last addresses of the subnet for
the network and broadcast addresses, respectively.
------------------------------------------------------------CLO-
3--------------------------------------------------------------
(Analyze various protocols, algorithms, and their functions in a network)
Q (3) = 19 marks total
Q (3) Part A (marks=10)
What will be the output if checksum algorithm is applied on given data: 1110011001100110 and
1101010101010101?
0100 0100 0100 0011 (Check sum calculated)
Q (3) Part B (9)
1. Is it possible for an application to enjoy reliable data transfer even when the application
runs over UDP? If so, how?
Yes, it is possible for an application to achieve reliable data transfer even when it
runs over the User Datagram Protocol (UDP), which is traditionally considered an
unreliable, connectionless transport protocol. The reliability would need to be
implemented at the application layer since UDP itself does not provide
mechanisms for reliable data delivery, error recovery, or flow control.
2. Suppose a process in Host C has a UDP socket with port number 6789. Suppose both
Host A and Host B each send a UDP segment to Host C with destination port number
6789. Will both segments be directed to the same socket at Host C? If so, how will the
process at Host C know that these two segments originated from two different hosts?
In a UDP-based communication model, the destination port number is used to direct incoming UDP
segments to the appropriate process or socket on the receiving host. In this scenario, both Host A and
Host B are sending UDP segments to Host C with the same destination port number, 6789.
Yes, both UDP segments will be directed to the same UDP socket at Host C because the destination port
number is what identifies the receiving socket. The operating system at Host C uses the destination port
number to determine which process or application should receive the incoming UDP segments.
Now, to distinguish between the UDP segments originated from Host A and Host B, the information
about the source IP address and source port number is used. Each UDP segment contains source and
destination port numbers, as well as source and destination IP addresses.
The combination of source IP address and source port number uniquely identifies the sender of each
UDP segment. Therefore, even though both UDP segments are destined for the same port (6789) on
Host C, the process at Host C can examine the source IP address and source port number in each
received UDP segment to differentiate between the segments sent by Host A and Host B.
In summary, both UDP segments will be directed to the same socket at Host C based on the destination
port number. The process at Host C can distinguish between the segments from Host A and Host B by
examining the source IP address and source port number in each UDP segment.