# GATE | GATE-CS-2003 | Question 90

• Difficulty Level : Easy
• Last Updated : 28 Jun, 2021

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) 172.57.88.62 and 172.56.87.233
(B) 10.35.28.2 and 10.35.29.4
(C) 191.203.31.87 and 191.234.31.88
(D) 128.8.129.43 and 128.8.161.55

Explanation:
Background required – Subnetting and SubNet Mask

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.

```128.8.129.43 BITWISE-AND 255.255.31.0 = 128.8.1.0
128.8.161.55 BITWISE-AND 255.255.31.0 = 128.8.1.0
```

You can check rest of the options.

This explanation has been provided by Pranjul Ahuja.

Quiz of this Question

My Personal Notes arrow_drop_up