GATE | GATE-CS-2003 | Question 90
The subnet mask for a particular network is 255.255.31.0. Which of the following pairs of IP addresses could belong to this network?
(A) 22.214.171.124 and 126.96.36.199
(B) 10.35.28.2 and 10.35.29.4
(C) 188.8.131.52 and 184.108.40.206
(D) 220.127.116.11 and 18.104.22.168
Background required – Subnetting and SubNet Mask
Answer – D
Explanation – Suppose we have a host A with IP Address IPA and Subnet mask of the subnet of which A is a part is Ms. Now when A wants to send packet to a host B with an IP address say IPB, then A will first AND the subnet-Mask Ms with IPA to find out the subnet-id IDN of the subnet in order to identify whether IPB belongs to the same network. Now if B also belongs to the same network, then IPB BITWISE-AND Ms must be equal to IDN which A has calculated.
If IPA and IPB belongs to same network, we must have
IPA BITWISE-AND Ms == IPBBITWISE-AND Ms
Out of the 4 options, only option D matches.
22.214.171.124 BITWISE-AND 255.255.31.0 = 126.96.36.199 188.8.131.52 BITWISE-AND 255.255.31.0 = 184.108.40.206
You can check rest of the options.
This explanation has been provided by Pranjul Ahuja.
Quiz of this Question