IAE Academy

GATE 2026 CS2 Q.33: solution and answer

GATE 2026 · CS2Q.33 · 1 mark · NAT

If an IP network uses a subnet mask of 255.255.240.0, the maximum number of IP addresses that can be assigned to network interfaces is ______. (answer in integer)

See the question in the paper

Answer and solution

ANSWER

The maximum number of IP addresses that can be assigned to network interfaces is 4094.

Official answer: 4094Source: Official answer key, GATE 2026 CS2 (IIT Guwahati)

  1. The mask is 255.255.240.0. In binary the third octet is , and the first two octets are all ones.

  2. Count the 1-bits in the mask: , so the prefix length is /20.

  3. The number of host bits is .

  4. The network has addresses in total.

  5. Two of these cannot be assigned to interfaces: the all-zeros host address (the network address) and the all-ones host address (the directed broadcast address).

  6. Assignable addresses .

KEY IDEA

Count the 1-bits in the mask to get the prefix length, then take the host bits as 32 minus the prefix. The number of assignable addresses is , because the network and broadcast addresses are reserved.

WATCH OUT FOR

Answering 4096 (all addresses), which forgets that the network address and the broadcast address cannot be given to interfaces. Another slip is reading 240 as 4 ones in the wrong octet and getting a prefix other than /20.

From the GATE 2026 CS2 paper. Every question of this paper · Download the full paper · All 20 IPv4 questions, with notes

More IPv4 questions