GATE / CS ARCHIVE

GATE CSE 2003 / QUESTION 82

Subnet equality under a noncontiguous mask

Computer Networks · IP Addressing, Fragmentation & Address Resolution · Full GATE CSE 2003 paper

GATE 2003, Q82 2 marks · MCQ
Report issue

IP Addressing, Fragmentation & Address Resolution

Question 82, GATE 2003: A network uses the printed subnet mask 255.255.31.0. Which pair of addresses could belong to that 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 [GFG; GateForum prints 191.03.31.87 as the first address.]
D. 128.8.129.43 and 128.8.161.55
The printed mask is noncontiguous; apply its literal bitwise AND, not an assumed CIDR repair.
Question 82, GATE 2003: A network uses the printed subnet mask 255.255.31.0. Which pair of addresses could belong to that 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 [GFG; GateForum prints 191.03.31.87 as the first address.]
D. 128.8.129.43 and 128.8.161.55
The printed mask is noncontiguous; apply its literal bitwise AND, not an assumed CIDR repair.
Tap to enlarge
Your answer
Answer & solution

Answer: D (no official key was published)

1. Membership under the printed mask requires address 1 AND mask = address 2 AND mask. Its first two 255 octets preserve both first octets, while the final zero octet discards the host's last octet.
2. A fails because 57≠56 in octet two; C fails because 203≠234. B's first two octets match, but 28 AND 31=28 and 29 AND 31=29, so it fails too.
3. For D, 129=10000001₂ and 161=10100001₂. AND with 31=00011111₂ gives 00000001₂ for both. Both network values are 128.8.1.0.
4. Thus the literal calculation selects D. Because 00011111 is not a contiguous prefix-mask octet, this is not a valid ordinary CIDR mask; that caveat must remain explicit.

Solution: Compare the bitwise AND of each address with the printed mask. Options A and C have unequal second octets, which are fully retained. Option B retains third octets 28 and 29 under AND 31, so they differ. For D, 129 AND 31=1 and 161 AND 31=1; both addresses therefore map to 128.8.1.0. The raw mask calculation gives D. The printed 31 octet is 00011111, so this is a noncontiguous mask and cannot be expressed as a standard CIDR prefix; it must not be silently changed to 224 or another contiguous-mask octet.

Original paper, page 12