CN GATE Question and Answers
CN GATE Question and Answers
The protocol data unit(PDU) for the application layer in the Internet stack is
(A) Segment
(B) Datagram
(C) Message
(D) Frame
Answer (C)
The Protocol Data Unit for Application layer in the Internet Stack (or TCP/IP) is called
Message.
2. Which of the following transport layer protocolss is used to support electronic
mail?
(A) SMTP
(B) IP
(C) TCP
(D) UDP
Answer (C)
E-mail uses SMTP as application layer protocol. SMTP uses TCP as transport layer
protocol.
3. In the IPv4 addressing format, the number of networks allowed under Class C
addresses is
(A) 2^14
(B) 2^7
(C) 2^21
(D) 2^24
Answer (C)
In class C, 8 bits are reserved for Host Id and 24 bits are reserved for Network Id. Out of
these 24 Network Id bits, the leading 3 bits are fixed as 110. So remaining 21 bits can be
used for different networks. See this for more details.
4. An Internet Service Provider(ISP) has the following chunk of CIDR-based IP
addresses available with it:245.248.128.0/20. The ISP wants to give half of this
chunk of addreses to Organization A, and a quarter to Organization B, while
retaining the remaining with itself. Which of the following is a valid allocation of
addresses to A and B?
(A) 245.248.136.0/21 and 245.248.128.0/22
(B) 245.248.128.0/21 and 245.248.128.0/22
(C) 245.248.132.0/22 and 245.248.132.0/21
(D) 245.248.136.0/22 and 245.248.132.0/21
Answer (A)
Since routing prefix is 20, the ISP has 2^(32-20) or 2^12 addresses. Out of these 2^12
addresses, half (or 2^11) addresses have to be given to organization A and quarter
(2^10) addresses have to be given to organization B. So routing prefix for organization A
will be 21. For B, it will be 22. If we see all options given in question, only options (A) and
(B) are left as only these options have same number of routing prefixes. Now we need
to choose from option (A) and (B).
To assign addresses to organization A, ISP needs to take first 20 bits from
245.248.128.0 and fix the 21st bit as 0 or 1. Similarly, ISP needs to fix 21st and 22nd
bits for organization B. If we take a closer look at the options (A) and (B), we can see the
21st and 22nd bits for organization B are considered as 0 in both options. So 21st bit of
organization A must be 1. Now take the first 20 bits from 245.248.128.0 and 21st bit as
1, we get addresses for organization A as 245.248.136.0/21
The network uses a a Distance Vector Routing Distance Vector Routing protocol. Once
the routes have stabilized, the distance vectors at different nodes are as following.
N1:(0, 1, 7, 8, 4)
N2:(1, 0, 6, 7, 3)
N3:(7, 6, 0, 2, 6)
N4:(8, 7, 2, 0, 4)
N5:(4, 3, 6, 4, 0)
Each distance vector is the distance of the best known path at that instance to nodes,
N1 to N5, where the distance to itself is 0. Also, all links are symmetric and the cost is
identical in both directions. In each round, all nodes exchange their distance vectors
with their respective neighbours. Then all nodes update their distance vectors. In
between two rounds, any change in cost of a link will cause the two incident nodes to
change only that entry in their distance vectors.
The cost of link N2-N3 reduces to 2 (in both directions). After the next round of update
what will be the new distance vector at node, N3?
(A) (3, 2, 0, 2, 5)
(B) (3, 2, 0, 2, 6)
(C) (7, 2, 0, 2, 5)
(D) (7, 2, 0, 2, 6)
Answer (A)
In the next round, every node will send and receive distance vectors to and from neighbors, and
update its dostance vector.
N3 will recieve (1, 0, 2, 7, 3) from N2 and it will update distances to N1 and N5 as 3 and 5
respectively.
10.After the update in the previous question, the link N1-N2 goes down. N2 will
reflect this change immediately in its distance vector as cost, ∞. After the
NEXT ROUND of update, what will be cost to N1 in the distance vector of N3?
(A) 3
(B) 9
(C) 10
(D) ∞
Answer (C)
In the next round, N3 will receive distance from N2 to N1 as infinite. It will receive
distance from N4 to N1 as 8. So it will update distance to N1 as 8 + 2.
11.One of the header fields in an IP datagram is the Time to Live (TTL) field. Which
of the following statements best explains the need for this field?
(A) It can be used to priortize packets
(B) It can be used to reduce delays
(C) It can be used to optimize throughput
(D) It can be used to prevent packet looping
Answer (D)
Time to Live can be thought as an upper bound on the time that an IP datagram
can exist in the network. The purpose of the TTL field is to avoid a situation in
which an undeliverable datagram keeps circulating.
12.Suppose computers A and B have IP addresses 10.105.1.113 and 10.105.1.91
respectively and they both use the same netmask N. Which of the values of N
given below should not be used if A and B should belong to the same network?
(A) 255.255.255.0
(B) 255.255.255.128
(C) 255.255.255.192
(D) 255.255.255.224
Answer : (D)
The last octets of IP addresses of A and B are 113 (01110001) and 91
(01011011). The netmask in option (D) has first three bits set in last octet. If
netmask has first 3 bits set, then these bits n must be same in A and B, but that is
not the case. In simple words, we can say option (D) is not a valid netmask
because doing binary ‘&’ of it with addresses of A and B doesn’t give the same
network address. It must be same address as A and B are on same network.
13. Consider a network with 6 routers R1 to R6 connected with links having weights
as shown in the following diagram
All the routers use the distance vector based routing algorithm to update their
routing tables. Each router starts with its routing table initialized to contain an
entry for each neighbour with the weight of the respective connecting link. After
all the routing tables stabilize, how many links in the network will never be used
for carrying any data?
(A) 4
(B) 3
(C) 2
(D) 1
Answer (C)
We can check one by one all shortest distances. When we check for all shortest
distances for Ri we don’t need to check its distances to R0 to Ri-1 because the network
graph is undirected.
Following will be distance vectors of all nodes.
Shortest Distances from R1 to R2, R3, R4, R5 and R6
R1 (5, 3, 12, 12, 16)
Links used: R1-R3, R3-R2, R2-R4, R3-R5, R5-R6
Shortest Distances from R2 to R3, R4, R5 and R6
R2 (2, 7, 8, 12)
Links used: R2-R3, R2-R4, R4-R5, R5-R6
Shortest Distances from R3 to R4, R5 and R6
R3 (9, 9, 13)
Links used: R3-R2, R2-R4, R3-R5, R5-R6
Shortest Distances from R4 to R5 and R6
R4 (1, 5)
Links used: R4-R5, R5-R6
Shortest Distance from R5 to R6
R5 (4)
Links Used: R5-R6
If we mark, all the used links one by one, we can see that following links are never used.
R1-R2
R4-R6
14.Suppose the weights of all unused links in the previous question are changed to
2 and the distance vector algorithm is used again until all routing tables
stabilize. How many links will now remain unused?
(A) 0
(B) 1
(C) 2
(D) 3
Answer (B)
After the weights of unused links () are changed to following graph.
Answer (b)
Packet is the Network layer Protocol Data Unit (PDU). TCP and UDP are Transport layer
protocols. Packets of same session may be routed through different routes. Most networks
don’t use static routing, but use some form of adaptive routing where the paths used to route
two packets for same session may be different due to congestion on some link, or some other
reason.
Let transmission time to transfer 1 byte for all nodes be t. The first packet will take time
= (packet size)*3*t. After the first packet reaches the destination, remaining packets will
take time equal to (packet size)*t due to parallelism.
If we use 4 bytes as packet size, there will be 24 packets
Total Transmission time = Time taken by first packet +
Time taken by remaining packets
= 3*4*t + 23*4*t = 104t
21.Suppose the round trip propagation delay for a 10 Mbps Ethernet having 48-bit
jamming signal is 46.4 ms. The minimum frame size is:
(a) 94
(b) 416
(c) 464
(d) 512
Answer (c)
Transmission Speed = 10Mbps.
Round trip propagation delay = 46.4 ms
The minimum frame size = (Round Trip Propagation Delay) * (Transmission Speed)
= 10*(10^6)*46.4*(10^-3) = 464 * 10^3 = 464 Kbit
The concept behind the above formula is collision detection. Consider a situation where a
node A wants to send a frame to another node B. When Node A begins transmitting, the
signal must propagate the network length. In the worst-case collision scenario, Node B
begins to transmit just before the signal for Node A’s frame reaches it. The collision signal
of Node A and Node B’s frame must travel back to Node A for Node A to detect that a
collision has occurred.
The time it takes for a signal to propagate from one end of the network to the other is known
as the propagation delay. In this worst-case collision scenario, the time that it takes for
Node A to detect that its frame has been collided with is twice the propagation delay. Node
A’s frame must travel all the way to Node B, and then the collision signal must travel all the
way from Node B back to Node A. This time is known as the slot time. An Ethernet node
must be transmitting a frame for the slot time for a collision with that frame to be detected.
This is the reason for the minimum Ethernet frame size.
22.Which of the following system calls results in the sending of SYN packets?
(A) socket
(B) bind
(C) listen
(D) connect
Answer (D)
socket() creates a new socket of a certain socket type, identified by an integer
number, and allocates system resources to it.
bind() is typically used on the server side, and associates a socket with a socket
address structure, i.e. a specified local port number and IP address.
listen() is used on the server side, and causes a bound TCP socket to enter listening
state.
connect() is used on the client side, and assigns a free local port number to a socket.
In case of a TCP socket, it causes an attempt to establish a new TCP connection.
When connect() is called by client, following three way handshake happens to establish the
connection in TCP.
1) The client requests a connection by sending a SYN (synchronize) message to the server.
2) The server acknowledges this request by sending SYN-ACK back to the client.
3) The client responds with an ACK, and the connection is established.
23.In the slow start phase of the TCP congestion control algorithm, the size of the
congestion window
(A) does not increase
(B) increases linearly
(C) increases quadratically
(D) increases exponentially
Answer (D)
Although the name is slow start, during the slow start phase, window size is
increased by the number of segments acknowledged, which means window size
grows exponentially. This happens until either an acknowledgment is not received
for some segment or a predetermined threshold value is reached.
24.If a class B network on the Internet has a subnet mask of 255.255.248.0, what
is the maximum number of hosts per subnet?
(A) 1022
(B) 1023
(C) 2046
(D) 2047
Answer (C)
The binary representation of subnet mask is
11111111.11111111.11111000.00000000. There are 21 bits set in subnet. So 11
(32-21) bits are left for host ids. Total possible values of host ids is 2^11 = 2048. Out
of these 2048 values, 2 addresses are reserved. The address with all bits as 1 is
reserved as broadcast address and address with all host id bits as 0 is used as
network address of subnet.
In general, the number of addresses usable for addressing specific hosts in each
network is always 2^N – 2 where N is the number of bits for host id.
25.What is the maximum size of data that the application layer can pass on to the
TCP layer below?
(A) Any size
(B) 2^16 bytes-size of TCP header
(C) 2^16 bytes
(D) 1500 bytes
Answer (A)
Application layer can send any size of data. There is no limit defined by standards.
The lower layers divides the data if needed.
26.A client process P needs to make a TCP connection to a server process S.
Consider the following situation: the server process S executes a socket(), a
bind() and a listen() system call in that order, following which it is preempted.
Subsequently, the client process P executes a socket() system call followed by
connect() system call to connect to the server process S. The server process
has not executed any accept() system call. Which one of the following events
could take place?
(A) connect () system call returns successfully
(B) connect () system call blocks
(C) connect () system call returns an error
(D) connect () system call results in a core dump
Answer (C)
Since accept() call is not executed then connect () gets no response for a time
stamp to wait & then return no response server error.
27.A computer on a 10Mbps network is regulated by a token bucket. The token
bucket is filled at a rate of 2Mbps. It is initially filled to capacity with
16Megabits. What is the maximum duration for which the computer can
transmit at the full 10Mbps?
(A) 1.6 seconds
(B) 2 seconds
(C) 5 seconds
(D) 8 seconds
Answer (B)
New tokens are added at the rate of r bytes/sec which is
2Mbps in the given question.
(A) P – 2 Q – 1 R – 3 S – 5
(B) P – 1 Q – 4 R – 2 S – 3
(C) P – 1 Q – 4 R – 2 S – 5
(D) P – 2 Q – 4 R – 1 S – 3
Answer (B)
SMTP is an application layer protocol used for e-mail transmission.
TCP is a core transport layer protocol.
BGP is a network layer protocol backing the core routing decisions on the Internet
PPP is a data link layer protocol commonly used in establishing a direct connection between
two networking nodes.
5
6 5
7 6
8
9
8
9
[Timeout for 7]
7
8 7
9 8
[Timeout for 9]
9
9
38.Let G(x) be the generator polynomial used for CRC checking. What is the
condition that should be satisfied by G(x) to detect odd number of bits in error?
(A) G(x) contains more than two terms
(B) G(x) does not divide 1+x^k, for any k not exceeding the frame length
(C) 1+x is a factor of G(x)
(D) G(x) has an odd number of terms.
Answer (C)
Odd number of bit errors can be detected if G(x) contains (x+1) as a factor.
39.Frames of 1000 bits are sent over a 10^6 bps duplex link between two hosts.
The propagation time is 25ms. Frames are to be transmitted into this link to
maximally pack them in transit (within the link).
What is the minimum number of bits (i) that will be required to represent the
sequence numbers distinctly? Assume that no time gap needs to be given
between transmission of two frames.
(A) i=2
(B) i=3
(C) i=4
(D) i=5
Answer (D)
Transmission delay for 1 frame = 1000/(10^6) = 1 ms
Propagation time = 25 ms
The sender can atmost transfer 25 frames before the first frame reaches the
destination.
The number of bits needed for representing 25 different frames = 5
40.Consider the data of previous question. Suppose that the sliding window
protocol is used with the sender window size of 2^i where is the number of bits
identified in the previous question and acknowledgments are always
piggybacked. After sending 2^i frames, what is the minimum time the sender
will have to wait before starting transmission of the next frame? (Identify the
closest choice ignoring the frame processing time.)
(A) 16ms
(B) 18ms
(C) 20ms
(D) 22ms
Answer (B)
Size of sliding window = 2^5 = 32
Transmission time for a frame = 1ms
Total time taken for 32 frames = 32ms
The sender cannot receive acknoledgement before round trip time which is 50ms
After sending 32 frames, the minimum time the sender will have to wait before
starting transmission of the next frame = 50 – 32 = 18
41.How many bits are allocated for network id (NID) and host id(HID) in the IP
address 25.193.155.233?
(A) 24 bit for NID, 8 bits for HID
(B) 8 bit for NID, 24 bits for HID
(C) 16 bit for NID, 16 bits for HID
(D) none
Answer : B
Explanation:
It is class A IP address and you know, that class A has 24 bits in HID and 8 bits in
NID part. So, option (B) is correct.
42.The bandwidth of the line is 1.5 Mbps with round trip time(RTT) as 45
milliseconds.If the size of each packet is 1 KB(kilobytes), then what is the
efficiency in Stop and wait protocol?
(A) 20.3
(B) 10.0
(C) 10.8
(D) 11
Answer: C
Explanation:
So in order to find the efficiency, lets first calculate the propagation delay (p) and
transmission delay(t). You know that,
(2*p) = RTT = 45 ms
Therefore,
p = 45/2 = 22.5 ms
Now, lets find transmission delay (t), you know that, t = L/B (where, L= size of packet
and B= bandwidth). Therefore,
L = 1KB = (1024*8) = 8192 bits
And
B = (1.5*106)
So,
t = L/B = 8192/(1.5*106) = 5.461 ms
Thus efficiency,
= 1/(1 + 2a) {where a = p/t = 22.5/5.461 = 4.12}
= 1/(1 + 2*4.12)
= 0.108
= 10.8 %
43.A 1 km long broadcast LAN has bandwidth (BW) of 107 bps and uses CSMA/CD,
then what is the minimum size of the packet?
Given:
velocity(v) = 2*108 m/sec
(A) 200 bits
(B) 10
(C) 50
(D) 100
Answer: D
Here,
Distance(d) = 1 km = 1*103 meter,
and BW = 107 bps
So,
p = propagation delay
= (d/v) = (103/2*108) = 5*10(-6)
Therefore, minimum size of the packet is,
= (2*p*BW)
= 2*5*10(-6)*107
= 100 bits
Here, All of the above protocols allow delayed acknowledgement. For more about these
protocols see Selective repeat protocol, Stop and wait protocol, and Go back N protocol.
So, option (D) is true.
49.What is the network ID of the IP address 225.100.123.70?
(A) 225.100.123.71
(B) 225.100.123.72
(C) 225.100.123.75
(D) It does not has any network ID
Explanation:
It is Class D IP and class D IP does not has any network ID part, i.e., no division of
network ID and host ID part.
So, option (D) is true.
50.Which of the following is not true about Supernetting?
(A) It is used to increase security.
(B) It is applicable for two or more networks.
(C) Bits are borrowed from network ID portion.
(D) It is used to improve flexibility of IP address allotment.
Explanation:
Since, Supernetting can not be used to improve security of the network.
So, option (A) is untrue.
51.