Maharevision Part-3
Maharevision Part-3
2 Error control
3 Flow control
2 Error control
3 Flow control
TCP &UDP
Routing Algorithms
Types of Errors
0 1 0 0 1 0 1 0
Sent 0 0 0 0 0 0 1 0 Sent
Corrupted bit
0 1 1 0 1 1 1 0
Received
Received 0 0 0 0 1 0 1 0
Error Control
Error Control
Hamming distance between two Binary string of same size is the number of
differences between corresponding bits.
Hamming distance between two Binary string is denoted by d(x, y)
d(000, 011) = 2
d(100, 011)=3
d(10101, 11110)=3
Hamming distance can easily be found if we apply XOR operation (⊕) on the two
words and count the Number of 1’s in the result.
Minimum Hamming distance
#Q. Consider a binary code that consists of only four valid code words as given
below:
00000, 01011, 10101, 11110
Let the minimum Hamming distance of the code be p and the maximum number
of erroneous bits that can be corrected by the code be q. Then the values of p and
q are
GATE 2017
A p = 3 and q = 1
B p = 3 and q = 2
C p = 4 and q = 1
D p = 4 and q = 2
QUESTION
Assume a binary code that contains only 5 valid code words as given
0000000, 1010110, 0101111, 0101010, 1101001 and assume minimum
hamming distance of a code be x and maximum number of erroneous bits
that can be deleted by the code is y and corrected by code be z, then the
value of x + y + z is_____.
QUESTION
#Q. The minimum Hamming distance to correct upto 5 bit error successfully is ______
Q. An error control code with minimum hamming distance of 11 is
capable of
[MSQ]
A. Detecting 11 bits of error
q In the Simple parity concept one extra bit ( parity bit ) is added to each dataword.
q Simple parity check can detect all single bit error.
q Simple parity check can not detect an even number of errors.
q Simple parity check can detect an odd number of errors .
2D Parity Check Code
q Two-dimensional parity check can detect and correct all single bit error and detect
two- or three-bit error that occur anywhere in the matrix.
q However only some pattern with four or more Errors can be detected.
q In a 2D-parity check code, the information bits are organized in a matrix consisting
of rows and columns.
q For each row and each column one parity check bits is calculated
Introduction to CRC :
Ø Length of the dataword=n
Ø Length of the divisor=k
Ø Append (k-1) Zero’s to the original message
Ø Perform modulo 2 division
Ø Remainder of division = CRC
Ø Code word =(n+k-1)bits
Note: CRC must be (k-1) bits
Ø Codeword = dataword with appended (k-1) Zeros+ CRC
Polynomial Notation in CRC
Ø Data word=d(x)
Ø Codeword=c(x)
Ø Generator=g(x)
Ø Syndrome=s(x)
Ø Error=e(x)
Polynomial Notation in CRC
How to apply the CRC step by step :
1. Determine the degree ‘r’ of g(x) (highest power)
2. Determine xrd(x)
3. Determine the remainder by dividing xrd(x) by g(x)
4. Codeword= xrd(x)+remainder
QUESTION
A 11001001000
B 11001001011
C 11001010
D 110010010011
A d(x) is x7 + x5 + x4 + x2 + 1 transmitted using CRC polynomial
Q.
method. The g(x) is x3 + 1. What is the polynomial of CRC
remainder? [MCQ]
A. x + x0
B. x0
C. x2 + x0
D. x2 + x + x0
NOTE
B. 10111101111
C. 11110101111
D. 10011101111
QUESTION
#Q. Consider hamming code (Signal bit error detection and correction technique),
the minimum parity bits needed for 60 data bits is _____ .
QUESTION
#Q. For single bit error correcting hamming code ,the code length for 12 data bit is
_______
TCP & UDP
Introduction
Transport Layer
TCP UDP
Transmission Control User Datagram
Protocol Protocol
Introduction
11. Data may arrive out of order and be temporarily stored by receiving TCP, but
TCP guarantee that no out of order data delivered to the process.
TCP header
U A P R S F Window Size
Header Length Reserved bits
R C S S Y I (Advertisement
(4 bits) (6 bits)
B K H T N N Window) (16 bits)
Consider a long-lived TCP session with an end-to-end bandwidth of 1 Gbps (= 109 bits
per second). The session starts with a sequence number of 1234. The minimum time
(in seconds, rounded to the closest integer) before this sequence number can be used
again is _______ .
QUESTION
Consider the data transfer using TCP over a 1 Gbps link. Assuming that the maximum
segment lifetime (MSL) is set to 60 seconds, the minimum number of bits required for
the sequence number field of the TCP header, to prevent the sequence number space
from wrapping around during the MSL is ______.
SYN = 1 → Consume one sequence number.
Ack = 1 → Consume zero sequence number.
FIN = 1 → Consume one sequence number.
1 Data byte → Consume one sequence number.
1 0 request
1 1 reply
0 1 Ack/data
0 0 Data
Congestion Control
C Only (i) and (iii) are true D Only (i) and (iv) are true
QUESTION
Let the size of congestion window of TCP connection be 64kb when a time out
occurs. The round trip time of connection is 100 milliseconds and the maximum
segment size used is 4kb. The time taken (in milliseconds) by the TCP connection to
get back to 64kb congestion window is
Consider a TCP client and a TCP server running on two different machines. After completing data
transfer, the TCP client calls close to terminate the connection and a FIN segment is sent to the
TCP server. Server-side TCP responds by sending an ACK. Which is received by the client-side TCP.
As per the TCP connection state diagram (RFC 793). In which state does the client-side TCP
connection wait for the FIN from the server-side TCP?
[GATE-2017-CN: 1M]
A LAST-ACK B TIME-WAIT
C FIN-WAIT-1 D FIN-WAIT-2
QUESTION
Consider a TCP server is in close wait state in TCP state transition diagram , which state TCP server
moves after sending FIN segment to TCP client ?
A LAST-ACK
B TIME-WAIT
C FIN-WAIT-1
D FIN-WAIT-2
TCP header
• Token bucket algorithm allows ideal hosts to accumulate credit for the future in the form of tokens.
• In regular interval, tokens are thrown into the bucket.
• Bucket has a maximum capacity.
• If there is a ready packet a token is removed from bucket and packet is sent.
• If there is no token in the bucket, the packet cannot be sent.
Token Bucket
Let the capacity of token bucket is ‘C’ token and token enter into the bucket at rate of ‘r’ tokens per second.
The maximum number of packet that can be enter into the network during the time interval ‘t’ is
A computer on a 10 Mbps network is regulated by a token bucket. The token bucket is filled at a
rate of 2 Mbps. It is initially filled to capacity with 16 Megabits. What is the maximum duration for
which the computer can transmit at the full 10 Mbps? GATE CS 2008
A 1.6 seconds
B 2 seconds
C 5 seconds
D 8 seconds
UDP
UDP Header
Source port Destination port
(16 bit) (16 bit)
Length Checksum
(16 bit) (16 bit)
NOTE
Unlike TCP, the checksum calculation is not mandatory in UDP. No error control or flow
control is provided by UDP.
Hence UDP depends on IP and ICMP for error reporting.
Optional inclusion of checksum
The sender of UDP packet can choose not to calculate the checksum. In this case the
checksum field is filled with all 0's before being sent.
TCP Vs UDP
TCP UDP
Connection-oriented Connectionless
1. When destination port number is well known port number then data is moving from client to server.
2. When Source port number is well known port number then data is moving from server to client
Routing Algorithms
Routing Algorithm
Routing Algorithm
Disadvantage of Flooding
1. Traffic is very high
2. Many duplicate packets received by receiver
Advantage of Routing
1. Traffic is very Less
2. No duplicate packet Received by Receiver
Disadvantage of Routing
1. Routing table is required
2. Chosen path may be down so it is not highly Reliable
3. Shortest path is depends on the algorithm and some algorithms fails to find the shortest path.
Routing Algorithm
Routing algorithm
Static Dynamic
At A
A Receive Distance vector from B, D
At B
B Receive Distance vector from A,C,D
At C
C Rev Distance vector from B,D
At D
D Rev distance from A,B,C
At C: New Routing table At D: New Routing table
QUESTION
Consider the following subnet. If distance vector routing is used, how many link can
never by used after all the routing table. Are stabilized ?
QUESTION
Consider the network of Figure. Distance vector routing is used, and the following
vectors have just come in to router C: from B: (5, 0, 8, 12, 6, 2); from D: (16, 12,
6, 0, 9, 10); and from E: (7, 6, 3, 9, 0, 4). The cost of the links from C to B, D, and E,
are 6, 3, and 5, respectively. What is C’s new routing table? Give both the outgoing
line to use and the cost
Routing Algorithm
The maximum Hop count allowed For RIP is 15 and Hop count of 16 is considered as
Destination unreachable.
NOTE
RIP uses UDP as its transport protocol with the port number – 530
QUESTION
Which of the following is true about routing information protocol (RIP) and open
shortest path (OSPF)
[GATE 2014]
A RIP uses distance vector routing and OSPF uses link state routing
B OSPF uses distance vector routing and RIP uses link state routing
C Both RIP and OSPF uses link state routing
Consider the following statement about routing information protocol (RIP) and open
shortest path (OSPF) in an IPv4 network
1. RIP uses distance vector routing
2. RIP Packet are sent using UDP
3. OSPF packet are sent using TCP
4. OSPF operation is based on link state routing
Which of the statement above are correct
[GATE 2017
A 1 and 4 only B 1 ,2 and 3 only
Two popular routing algorithms are Distance Vector(DV) and Link State(LS) routing.
Which of the following are true ?
(S1): Count to infinity is the problem only with DV and not LS routing
(S2): In LS, the shortest path algorithm is run only at one node
(S3): In DV, the shortest path algorithm is run only at one node
(S4): DV requires lesser number of networks messages than LS
[GATE 2008]
A S1 , S2 and S4 only
B S1 , S3 and S4 only
C S2 and S3 only
D S1 and S4 only
IP Support Protocol
ARP
1. Address Resolution Protocol(ARP) is used to find the MAC(Media Access Control) address of a
device from its IP address.
2. ARP request: ARP request is broadcasting
3. ARP response/reply: ARP reply is unicasting.
IP Support Protocol
Timestamp
Echo Request Address-Mask Router solicitation
Request &
& Reply Request and
Reply
and reply advertisement
APPLICATION LAYER PROTOCOL
Domain Name System
(DNS)
1. Easy to remember the domain names
2. IP addresses are not static
3. DNS is a protocol used to convert domain name to IP addresses
Domain Name System (DNS)
Most commonly used domain are :
(i) com — usually used by commercial organization eg: Yahoo(yahoo.com)
(ii) edu — usually used by educational institute eg: iisc.edu
(iii) org — used by Non profit organization eg: ieee.org
(iv) mil — used by Military organization
(v) net — It is open public for any commercial organization
(vi) gov — used to represent government organization eg: isro.gov
Iterative Queries
Root DNS
server
Top Level
DNS server
Host Local DNS
server
Authoritative
DNS server
Recursive Queries
Root DNS
server
Top Level
DNS server
Host Local DNS
server
Authoritative
DNS server
Root DNS Server
Root name servers play a key role in resolving any DNS query. There are 13 root name servers
worldwide. If a situation arises that the entire 13 root name servers are unreachable, the Internet would
fail. Usually a host sends a query to its nearest root name server. If any one of these servers fails the
requests are diverted to another nearest server.
E.g. if you are in India the nearest root name server is at Tokyo. If the root name server at Tokyo is down,
all the DNS queries or traffic is diverted to server at Europe, which is the next nearest server to India.
NOTE:
1. By default DNS uses UDP at transport layer.
2. DNS can use either UDP or TCP.
3. In both cases the well known port number used by the server is port number-
53.
4. DNS query size< 512 byte ------ UDP
5. DNS query size>512 byte ------ TCP
E-mail, SMTP, POP, IMAP
E-mail
Email[Electronic Mail]
Sender Receiver
ll)
Sender Mail Receiver Mail
(P
(Pu
Server
us
Server Pop-3
SMTP
h)
Or
SMTP IMAP - 4
Internet
Gmail Yahoo
SMTP(Simple mail transfer protocol)
Ø SMTP cannot transfer other types of data like images, video, audio, etc.
Ø SMTP cannot transfer binary files or executable files.
Ø SMTP cannot transfer the text data for the language other than English (such as French, Japanese,
and Chinese etc.).
Ø Only SMTP is not sufficient to send binary files or to send videos or audio so we require MIME
(Multipurpose Internet mail extension).
Ø MIME is a supplementary protocol that allows non-ASCII data to send through SMTP.
Ø MIME is a set of software function that transforms non-ASCII data to ASCII data or vice versa.
Ø MIME is used to convert non text data to text data and text data to non text data.
NOTE (imp.)
Transfer the message from sending mail server to receiving mail server is done
through SMTP. Finally the message from receiving server to web browser is done
through HTTP only
POP3 IMAP
Mails can be accessed from multiple
(1) Mails can only be accessed from a single device.
device.
(2) Download the email from server to a
The email message is stored on the
single computer and the copy at the
mail server itself.
server is deleted.
(3) User cannot organize the mails in the mail box User can organize mails on the mail
of the mail server. server.
(4) It does not allow user to sync emails. It allows user to sync their emails.
(5) It is unidirectional i.e all the changes made on a
It is bidirectional i.e. all the changes made on
device does not effect the content present on the
server or device are made on the other side too.
server.
File Transfer Protocol (FTP)
1. File transfer protocol is a standard internet protocol for transferring files b/w
computers over TCP/IP connection.
2. It uses port number - 20 & 21 on TCP.
3. It has two types of connection
(i) Control connection (port number. - 21)
(ii) Data connection (port number - 20)
4. Control connection remains connected during the entire interactive FTP
session.
5. The data connection is opened and closed for each file transfer activity.
Continued....
6. When user starts an FTP session, the control connection opens. While the control
connection is open, the data connection can be opened and closed multiple times if
several files are transferred.
7. FTP uses persistent TCP connections for control information.
8. FTP uses Non-persistent TCP connections for data information.
9. FTP is a connection-oriented protocol.
10. FTP is an “out of band” protocol as data and control information flow over different
connection.
11. Some protocols send their request and data in the same TCP connection for this
reason they are called as In-band protocol.
12. HTTP & SMTP are In-Band protocol.
13. FTP is state full protocol.
HTTP Protocol
1. HTTP protocol used mainly to access data on word wide web (www)
2. It is client server protocol using port No - 80 on TCP
3. HTTP is “In-Band” protocol i.e. both request and data we will send only in one
connection.
4. HTTP is a stateless protocol i.e. It does not maintain any information of user.
5. There are two types of HTTP protocol
(i) Non persistent (1.0)
(ii) Persistent (1.1)
Non persistent(1.0)
In a Non persistent connection one TCP connection is made for each request/response.
This strategy follow the following steps :-
(i) The client opens a TCP connection and sends a request.
(ii) Server sends the response and closes the connection.
(iii) In this strategy , If a file contains link to N-different pictures in different files(all
located on same server) the connection must be opened and closed N+1 times.
Persistent (1.1)
1. In a persistent connection the server leaves the connection open for more request
after sending a response.
2. The server closes the connection at the request of client or time out has been
reached.
Importante table
C DNS D SMTP
TCP UDP
SMTP DNS
HTTP SNMP
FTP TFTP
POP DHCP
IMAP All real time &
Telnet Multimedia
Protocol
QUESTION
Which of the following transport layer protocols in used to support electronic mail?
A SMTP B IP
C TCP D UDP
QUESTION
The transport protocols used for real time multimedia, file transfer, DNS and email,
respectively are
A TCP, UDP, UDP and TCP B UDP, TCP, TCP and UDP
C UDP, TCP, UDP and TCP D TCP, UDP, TCP and UDP
Importante table
Control connection is
HTTP 1.0 is non
persistent. Data
Persistent/Non-persistent Non-persistent persistent HTTP 1.1 Persistent Persistent Persistent
connection is non-
is persistent.
persistent.
20 for data
Port Number Used 53 80 25 110 143 connection. 21 for
control connection.
In band/
In band In band In band In band In band Out-of- band
Out-of-band
QUESTION
A m1: HTTP m2: SMTP m3: POP B m1: SMTP m2: FTP m3: HTTP
C m1: SMTP m2: POP m3: HTTP D m1: POP m2: SMTP m3: IMAP
QUESTION
Which of the following protocol pairs can be used to send and retrieve e-mails (in that
order?)
In one of the pairs of protocols given below, both the protocols can use multiple TCP
connections between the same client and the server. Which one is that?
तम
ु $फर से U P आ रहे +या $फर चल0गे पीने
TM P S U P A R Q P C P
Vikas VRFY
Sir SEND FROM
Teaches TURN
Hard HELO
Subject SMOL FROM
iN NOOP
Easy EXPN
Manner MAIL FROM
Difficult DATA
Subject SMAL FROM
Re Quires RSET, QUIT
Ha Rdwork HELP, RCPTTO
HTTP Commands
Consider the three commands : PROMPT, HEAD and RCPT. Which of the following
options indicate a correct association of these commands with protocols where there
are used ?
(GATE 2005)
Identify the correct sequence in which the following packets are transmitted on the
network-by a host when a browser requests a webpage from a remote server, assuming
that the host has just been restarted.
(GATE 2016)
A HTTP GET request, DNS query, TCP B DNS query, HTTP GET request, TCP
SYN SYN
C DNS query, TCP SYN, HTTP GET D TCP SYN, DNS query, HTTP GET
request request
QUESTION
Assume that you have made a request for a web page through your web browser to a
web server. Initially the browser cache is empty. Further, the browser is configured to
send HTTP requests in non-persistent mode. The web page contains text and five very
small images. The minimum number of TCP connections required to display the web
page completely in your browser is ________.
OSI and TCP/IP
Protocol Stack
Functions of Computer Network
Functions
Mandatory Optional
Physical Layer is responsible for movement of individuals bits from one Hop to next
Hop.
Functions of Physical layer
6. It defines Encoding.
7. Bits Synchronization.
8. Bit rate control.
Data Link Layer
Data link layer is responsible for moving frames From One Hop (Node) to Next Hop
(Node).
Function of data link layer
1. Flow control
LLC Flow Control
2. Error control Error Control
3. Access control MAC Synchronization
4. Framing
5. Physical Addressing Framing
The network layer is responsible for the delivery of individual packet from source
to destination.
Network Layer: The network layer is responsible for the delivery of individual
packet fromLayer
Network source to destination(Host to host)
4. Routing:
5. Fragmentation:
This layer take care of syntax and semantics of the information exchange in
between two communicating systems.
1. Character translation
2. Encryption/Decryption
3. Compression
Application Layer
Application Layer is responsible for providing services to users. Users such as:
1. Mail services
2. File sharing
3. File transfer and many more
Q.1 The protocol data unit (PDU) for the application layer in
the Internet stack is
A Segment
B Datagram
C Message
D Frame
Q.2 Assume that source S and destination D are connected
through two intermediate routers labelled R. Determine
how many times each packet has to visit the network layer
and the data link layer during a transmission from S to D
A Segment
B Frame
C PDU
D Datagram
Q.5 Which layer is responsible for Segmentation & reassembly ?
A Application layer
C Transport layer
D Presentation layer
Q.6 Consider the following scenario where source and
destination are connected via three intermediate Router