Question

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)

Official answer and solution
Official answer
4094
From
Official GATE 2026 answer key

Solution

Count the number of host bits (0s) in the 32-bit subnet mask 255.255.240.0 and compute 2h−22^h - 2.

Writing the subnet mask 255.255.240.0 in binary:

  • First two octets: 8+8=168 + 8 = 16 ones.
  • Third octet: 240=111100002240 = 11110000_2, which has 44 ones and 44 zeros.
  • Fourth octet: 0=0000000020 = 00000000_2, which has 88 zeros.

Thus, there are h=4+8=12h = 4 + 8 = 12 host bits. Excluding the network address (all host bits 00) and the directed broadcast address (all host bits 11), the maximum number of assignable host IP addresses is:

212−2=4096−2=40942^{12} - 2 = 4096 - 2 = 4094
Final answer

4094

Common trap

Forgetting to subtract 2 for the network and broadcast addresses.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2026 Computer Science and Information Technology - Session 2 (CS2)
Question
33 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.