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)
GATE 2026 CS2 Q.33: solution and answer
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)
The mask is 255.255.240.0. In binary the third octet is , and the first two octets are all ones.
Count the 1-bits in the mask: , so the prefix length is /20.
The number of host bits is .
The network has addresses in total.
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).
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
- GATE 2025 CS1 Q.57 · NAT · 2 marksSuppose a message of size 15000 bytes is transmitted from a source to a destination using IPv4 protocol via…
- GATE 2025 CS2 Q.18 · MCQ · 1 markA machine receives an IPv4 datagram. The protocol field of the IPv4 header has the protocol number of a…
- GATE 2025 CS2 Q.23 · MCQ · 1 markConsider a network that uses Ethernet and IPv4. Assume that IPv4 headers do not use any options field.
- GATE 2024 CS1 Q.31 · MSQ · 1 markWhich of the following fields is/are modified in the IP header of a packet going out of a network address…
