GATE | GATE CS 2019 | Question 37

Consider three machines M, N and P with IP addresses 100.10.5.2, 100.10.5.5 and 100.10.5.6 respectively. The subnet mask is set to 255.255.255.252 for all the three machines. Which one of the following is true?

(A) M, N and P all belong to the same subnet
(B) Only N and P belong to the same subnet
(C) M, N, and P belong to three different subnets
(D) Only M and N belong to the same subnet


Answer: (B)

Explanation: First, we will do bitwise AND between Subnet mask and given IP address one by one
For M: 100.10.5.2
Bitwise AND:

    01100100.00001010.00000101.00000010 (100.10.5.2)
AND 11111111.11111111.11111111.11111100 (255.255.255.252)
___________________________________________________________
   = 01100100.00001010.00000101.00000000 (100.10.5.0)

For N: 100.10.5.5
Bitwise AND:

    01100100.00001010.00000101.00000101 (100.10.5.5)
AND 11111111.11111111.11111111.11111100 (255.255.255.252)
___________________________________________________________
   = 01100100.00001010.00000101.00000100 (100.10.5.4)

For P: 100.10.5.2
Bitwise AND:

    01100100.00001010.00000101.00000110 (100.10.5.6)
AND 11111111.11111111.11111111.11111100 (255.255.255.252)
___________________________________________________________
   = 01100100.00001010.00000101.00000100 (100.10.5.4)

It is sure from the above computation that N and P belong to the same network (i.e., 100.10.5.4), while M can belong to the same network or it can be from any other network.

So, option (B) is correct.


Quiz of this Question



My Personal Notes arrow_drop_up


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.